Class DependentTypesError


  • public class DependentTypesError
    extends java.lang.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 Summary

      Fields 
      Modifier and Type Field Description
      java.lang.String error
      An error message about that expression.
      java.lang.String expression
      The expression that is unparsable or otherwise problematic.
      static @Format({INT,GENERAL}) java.lang.String FORMAL_PARAM_NAME_STRING
      How to format warnings about use of formal parameter name.
    • Method Summary

      All Methods Static Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      boolean equals​(@Nullable java.lang.Object o)  
      java.lang.String format()
      Like toString, but uses better formatting sometimes.
      int hashCode()  
      static boolean isExpressionError​(java.lang.String expression)
      Returns whether or not the given expression string is an error.
      java.lang.String toString()  
      static DependentTypesError unparse​(java.lang.String formattedError)
      Create a DependentTypesError by parsing a printed one.
      • Methods inherited from class java.lang.Object

        clone, finalize, getClass, notify, notifyAll, wait, wait, wait
    • Field Detail

      • FORMAL_PARAM_NAME_STRING

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

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

        public final java.lang.String error
        An error message about that expression.
    • Constructor Detail

      • DependentTypesError

        public DependentTypesError​(java.lang.String expression,
                                   java.lang.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​(java.lang.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 Detail

      • isExpressionError

        public static boolean isExpressionError​(java.lang.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​(java.lang.String formattedError)
        Create a DependentTypesError by parsing a printed one.
        Parameters:
        formattedError - the toString() representation of a DependentTypesError
      • equals

        public boolean equals​(@Nullable java.lang.Object o)
        Overrides:
        equals in class java.lang.Object
      • hashCode

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

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

        public java.lang.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().