Record Class Suggestion

java.lang.Object
java.lang.Record
org.ek9lang.compiler.common.Suggestion
Record Components:
name - the bare replacement text (e.g. "false", "stdout")
displayText - human-readable inline form for "Did you mean?" rendering — symbols include their source location, keywords are quoted bare
cost - Levenshtein cost relative to the offending token (lower = closer); parse-token suggestions use 0
line - nullable line number of the symbol definition for visual rendering of "defined at line N"; null for keyword / parse-token suggestions
source - classification — Suggestion.Source.KEYWORD or Suggestion.Source.SYMBOL

public record Suggestion(String name, String displayText, int cost, Integer line, Suggestion.Source source) extends Record
A single ranked suggestion that the compiler can offer the user as a possible replacement for an offending token.

Produced by QuickFixSuggestionExtractor and consumed by:

  • ErrorListener.ErrorDetails.toString() — CLI classic-mode "Did you mean?"
  • VisualErrorFormatter — CLI visual-mode multi-span block
  • Oracle DiagnosticsExtractor — MCP/IDE structured diagnostics
  • IDE quick-fix popup + Problems panel + error tooltip

Single source of truth ensures CLI compile output, IDE rendering, and AI tooling all see the same filtered, ranked candidate set.

  • Constructor Details

    • Suggestion

      public Suggestion(String name, String displayText, int cost, Integer line, Suggestion.Source source)
      Creates an instance of a Suggestion record class.
      Parameters:
      name - the value for the name record component
      displayText - the value for the displayText record component
      cost - the value for the cost record component
      line - the value for the line record component
      source - the value for the source 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. 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.
    • name

      public String name()
      Returns the value of the name record component.
      Returns:
      the value of the name record component
    • displayText

      public String displayText()
      Returns the value of the displayText record component.
      Returns:
      the value of the displayText record component
    • cost

      public int cost()
      Returns the value of the cost record component.
      Returns:
      the value of the cost record component
    • line

      public Integer line()
      Returns the value of the line record component.
      Returns:
      the value of the line record component
    • source

      public Suggestion.Source source()
      Returns the value of the source record component.
      Returns:
      the value of the source record component