Class DetailedTestDiagnostic

java.lang.Object
org.checkerframework.framework.test.diagnostics.TestDiagnostic
org.checkerframework.framework.test.diagnostics.DetailedTestDiagnostic

public class DetailedTestDiagnostic extends TestDiagnostic
Represents a detailed error/warning message reported by the Checker Framework when the -Adetailedmsgtext flag is used. By contrast, TestDiagnostic represents a simple expected error/warning message in a Java test file or an error/warning reported by the Java compiler without the -Adetailedmsgtext flag.
  • Field Details

    • additionalTokens

      protected final List<String> additionalTokens
      Additional tokens that are part of the diagnostic message.
    • startPosition

      protected final long startPosition
      The start position of the diagnostic in the source file.
    • endPosition

      protected final long endPosition
      The end position of the diagnostic in the source file.
  • Constructor Details

    • DetailedTestDiagnostic

      public DetailedTestDiagnostic(Path file, long lineNo, DiagnosticKind kind, String messageKey, List<String> additionalTokens, long startPosition, long endPosition, String readableMessage, boolean isFixable)
      Create a new instance.
      Parameters:
      file - the file in which the diagnostic occurred
      lineNo - the line number in the file at which the diagnostic occurred
      kind - the kind of diagnostic (error or warning)
      messageKey - a message key that usually appears between parentheses in diagnostic messages
      additionalTokens - additional tokens that are part of the diagnostic message
      startPosition - the start position of the diagnostic in the source file
      endPosition - the end position of the diagnostic in the source file
      readableMessage - a human-readable message describing the diagnostic
      isFixable - whether the diagnostic is fixable
  • Method Details

    • getAdditionalTokens

      public List<String> getAdditionalTokens()
      The additional tokens that are part of the diagnostic message.
      Returns:
      the additional tokens
    • getStartPosition

      public long getStartPosition()
      The start position of the diagnostic in the source file.
      Returns:
      the start position
    • getEndPosition

      public long getEndPosition()
      The end position of the diagnostic in the source file.
      Returns:
      the end position
    • equals

      public boolean equals(@Nullable Object otherObj)
      Equality is compared without isFixable and messageKeyParens.
      Overrides:
      equals in class TestDiagnostic
      Returns:
      true if this and otherObj are equal according to additionalTokens, startPosition, endPosition, and equality of the superclass.
    • hashCode

      public int hashCode()
      Overrides:
      hashCode in class TestDiagnostic
    • toString

      public String toString()
      Returns a representation of this diagnostic as if it appeared as a detailed message.
      Overrides:
      toString in class TestDiagnostic
      Returns:
      a representation of this diagnostic as if it appeared as a detailed message
      See Also:
      • SourceChecker.detailedMsgTextPrefix(Object,String,Object[])