Class 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


      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.
      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.
      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.
      expression - expression string to test
      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.
      formattedError - the toString() representation of a DependentTypesError
    • equals

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

      public int hashCode()
      hashCode in class Object
    • toString

      public String toString()
      toString in class Object
    • format

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