Record Class JavacParseResult<T extends Tree>

java.lang.Object
java.lang.Record
org.plumelib.javacparse.JavacParseResult<T>
Type Parameters:
T - the type of the Java code being parsed
Record Components:
tree - the parse tree
diagnostics - the diagnostics

public record JavacParseResult<T extends Tree>(T extends Tree tree, List<Diagnostic<? extends JavaFileObject>> diagnostics) extends Record
Represents the result of parsing Java code (a file or a subpart thereof).
  • Constructor Details

    • JavacParseResult

      public JavacParseResult(T tree, List<Diagnostic<? extends JavaFileObject>> diagnostics)
      Creates an instance of a JavacParseResult record class.
      Parameters:
      tree - the value for the tree record component
      diagnostics - the value for the diagnostics record component
  • Method Details

    • hasParseError

      public boolean hasParseError()
      Returns true if at least one diagnostic is a parse error.
      Returns:
      true if at least one diagnostic is a parse error
    • getParseErrorMessages

      public String getParseErrorMessages()
      Returns all the parse error messages, concatenated. May return an empty string.
      Returns:
      all the parse error messages, concatenated
    • toString

      public String toString(@GuardSatisfied JavacParseResult<T extends Tree> this)
      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.
    • tree

      public T tree()
      Returns the value of the tree record component.
      Returns:
      the value of the tree record component
    • diagnostics

      public List<Diagnostic<? extends JavaFileObject>> diagnostics()
      Returns the value of the diagnostics record component.
      Returns:
      the value of the diagnostics record component