Class DependentTypesError
- java.lang.Object
-
- org.checkerframework.framework.util.dependenttypes.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.
-
Constructor Summary
Constructors Constructor Description DependentTypesError(java.lang.String expression, java.lang.String error)
Create a DependentTypesError for the given expression and error message.DependentTypesError(java.lang.String expression, JavaExpressionParseUtil.JavaExpressionParseException e)
Create a DependentTypesError for the given expression and exception.
-
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.
-
-
-
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 expressionerror
- 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 expressione
- 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 classjava.lang.Object
-
hashCode
public int hashCode()
- Overrides:
hashCode
in classjava.lang.Object
-
toString
public java.lang.String toString()
- Overrides:
toString
in classjava.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().
-
-