Class DependentTypesError

java.lang.Object
org.checkerframework.framework.util.dependenttypes.DependentTypesError

public class DependentTypesError extends Object
Helper class for creating dependent type annotation error strings.

IMPORTANT: This is not an Exception. It is a regular class that is returned, not thrown. The errors are not thrown so that they are only reported once rather than every time the annotation is parsed. See DependentTypesHelper for more details.

  • Field Details

    • FORMAL_PARAM_NAME_STRING

      public static final @Format({INT,GENERAL}) String FORMAL_PARAM_NAME_STRING
      How to format warnings about use of formal parameter name.
      See Also:
    • expression

      public final String expression
      The expression that is unparsable or otherwise problematic.
    • error

      public final String error
      An error message about that expression.
  • Constructor Details

    • DependentTypesError

      public DependentTypesError(String expression, String error)
      Create a DependentTypesError for the given expression and error message.
      Parameters:
      expression - the incorrect Java expression
      error - an error message about the expression
    • DependentTypesError

      public DependentTypesError(String expression, JavaExpressionParseUtil.JavaExpressionParseException e)
      Create a DependentTypesError for the given expression and exception.
      Parameters:
      expression - the incorrect Java expression
      e - wraps an error message about the expression
  • Method Details

    • isExpressionError

      public static boolean isExpressionError(String expression)
      Returns whether or not the given expression string is an error. That is, whether it is a string that was generated by this class.
      Parameters:
      expression - expression string to test
      Returns:
      whether or not the given expressions string is an error
    • unparse

      public static DependentTypesError unparse(String formattedError)
      Create a DependentTypesError by parsing a printed one.
      Parameters:
      formattedError - the toString() representation of a DependentTypesError
    • equals

      public boolean equals(@Nullable Object o)
      Overrides:
      equals in class Object
    • hashCode

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

      public String toString()
      Overrides:
      toString in class Object
    • format

      public String format()
      Like toString, but uses better formatting sometimes. Use this only for the output, because of the design that hides error messages in toString().