Record Class ReplCompileResult

java.lang.Object
java.lang.Record
org.ek9lang.cli.ReplCompileResult
Record Components:
success - Whether compilation succeeded
incomplete - Whether input is incomplete (expecting more, like a block body)
bytecodeDir - Path to generated bytecode (null if failed)
errorOutput - Formatted error messages (empty if successful)

public record ReplCompileResult(boolean success, boolean incomplete, Path bytecodeDir, String errorOutput) extends Record
Result of a REPL compilation attempt.
  • Constructor Details

    • ReplCompileResult

      public ReplCompileResult(boolean success, boolean incomplete, Path bytecodeDir, String errorOutput)
      Creates an instance of a ReplCompileResult record class.
      Parameters:
      success - the value for the success record component
      incomplete - the value for the incomplete record component
      bytecodeDir - the value for the bytecodeDir record component
      errorOutput - the value for the errorOutput record component
  • Method Details

    • success

      public static ReplCompileResult success(Path bytecodeDir)
      Create a successful compilation result.
    • failure

      public static ReplCompileResult failure(String errorOutput)
      Create a failed compilation result with a real error.
    • needsMoreInput

      public static ReplCompileResult needsMoreInput()
      Create a result indicating incomplete input (needs continuation). This is not an error - the parser is expecting more input (like a block body).
    • toString

      public final String toString()
      Returns a string representation of this record class. The representation contains the name of the class, followed by the name and value of each of the record components.
      Specified by:
      toString in class Record
      Returns:
      a string representation of this object
    • hashCode

      public final int hashCode()
      Returns a hash code value for this object. The value is derived from the hash code of each of the record components.
      Specified by:
      hashCode in class Record
      Returns:
      a hash code value for this object
    • equals

      public final boolean equals(Object o)
      Indicates whether some other object is "equal to" this one. The objects are equal if the other object is of the same class and if all the record components are equal. Reference components are compared with Objects::equals(Object,Object); primitive components are compared with the compare method from their corresponding wrapper classes.
      Specified by:
      equals in class Record
      Parameters:
      o - the object with which to compare
      Returns:
      true if this object is the same as the o argument; false otherwise.
    • success

      public boolean success()
      Returns the value of the success record component.
      Returns:
      the value of the success record component
    • incomplete

      public boolean incomplete()
      Returns the value of the incomplete record component.
      Returns:
      the value of the incomplete record component
    • bytecodeDir

      public Path bytecodeDir()
      Returns the value of the bytecodeDir record component.
      Returns:
      the value of the bytecodeDir record component
    • errorOutput

      public String errorOutput()
      Returns the value of the errorOutput record component.
      Returns:
      the value of the errorOutput record component