Record Class TypicalError

java.lang.Object
java.lang.Record
org.ek9lang.assist.TypicalError
Record Components:
error - EK9 error code (e.g., "E11064")
correct - Code snippet found verbatim in the Q&A code body
incorrect - What that snippet looks like when the rule is violated
explanation - Why the compiler rejects the incorrect form

public record TypicalError(String error, String correct, String incorrect, String explanation) extends Record
Describes a typical mistake that triggers a specific EK9 compiler error. Used for AI training data (contrastive learning) and fuzzer consumption.
  • Constructor Details

    • TypicalError

      public TypicalError(String error, String correct, String incorrect, String explanation)
      Creates an instance of a TypicalError record class.
      Parameters:
      error - the value for the error record component
      correct - the value for the correct record component
      incorrect - the value for the incorrect record component
      explanation - the value for the explanation record component
  • Method Details

    • 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. All components in this record class are compared with Objects::equals(Object,Object).
      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.
    • error

      public String error()
      Returns the value of the error record component.
      Returns:
      the value of the error record component
    • correct

      public String correct()
      Returns the value of the correct record component.
      Returns:
      the value of the correct record component
    • incorrect

      public String incorrect()
      Returns the value of the incorrect record component.
      Returns:
      the value of the incorrect record component
    • explanation

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