Class InferenceResult
java.lang.Object
org.checkerframework.framework.util.typeinference8.InferenceResult
The result of type argument inference.
-
Constructor Summary
ConstructorsConstructorDescriptionInferenceResult(Collection<Variable> variables, Set<? extends ExpressionTree> needUncheckedConversion, boolean annoInferenceFailed, boolean inferenceCrashed, String errorMsg) Creates an inference result.InferenceResult(Collection<Variable> variables, Set<? extends ExpressionTree> needUncheckedConversion, boolean annoInferenceFailed, String errorMsg) Creates an inference result. -
Method Summary
Modifier and TypeMethodDescriptionstatic InferenceResultReturns an empty inference result.An error message to report to the user.A mapping from a tree that needs type argument inference to a map from type parameter to its inferred annotated type argument.getTypeArgumentsForExpression(ExpressionTree expressionTree) Returns a mapping from type variable to its type argument for theexpressionTree.booleanTrue if inference crashed.booleanTrue if type argument inference failed because an annotated type could not be inferred.booleanneedsUncheckedConversion(ExpressionTree expressionTree) Returns true ifexpressionTreeneeds unchecked conversion.
-
Constructor Details
-
InferenceResult
public InferenceResult(Collection<Variable> variables, Set<? extends ExpressionTree> needUncheckedConversion, boolean annoInferenceFailed, String errorMsg) Creates an inference result.- Parameters:
variables- instantiated variablesneedUncheckedConversion- the expressions that need unchecked conversionannoInferenceFailed- true if inference failed because of annotationserrorMsg- message to report to users if inference failed
-
InferenceResult
public InferenceResult(Collection<Variable> variables, Set<? extends ExpressionTree> needUncheckedConversion, boolean annoInferenceFailed, boolean inferenceCrashed, String errorMsg) Creates an inference result.- Parameters:
variables- instantiated variablesneedUncheckedConversion- the expressions that need unchecked conversionannoInferenceFailed- true if inference failed because of annotationsinferenceCrashed- the type argument inference code crashederrorMsg- message to report to users if inference failed
-
-
Method Details
-
emptyResult
Returns an empty inference result.- Returns:
- an empty inference result
-
getResults
A mapping from a tree that needs type argument inference to a map from type parameter to its inferred annotated type argument. If inference failed, this map will be empty.- Returns:
- mapping from a tree that needs type argument inference to a map from type parameter to its inferred annotated type argument
-
needsUncheckedConversion
Returns true ifexpressionTreeneeds unchecked conversion. If so, the return type ofexpressionTree's invocation type is erased (JLS 15.12.2.6).- Parameters:
expressionTree- a method invocation, class instance creation, or method reference in this inference problem- Returns:
- true if
expressionTreeneeds unchecked conversion
-
inferenceFailed
public boolean inferenceFailed()True if type argument inference failed because an annotated type could not be inferred.- Returns:
- true if type argument inference failed because an annotated type could not be inferred
-
inferenceCrashed
public boolean inferenceCrashed()True if inference crashed.- Returns:
- true if inference crashed
-
getTypeArgumentsForExpression
public Map<TypeVariable,AnnotatedTypeMirror> getTypeArgumentsForExpression(ExpressionTree expressionTree) Returns a mapping from type variable to its type argument for theexpressionTree. If no type arguments were inferred forexpressionTree, then this returns an empty map.- Parameters:
expressionTree- a tree for which type arguments were inferred- Returns:
- a mapping from type variable to its type argument for the
expressionTree
-
getErrorMsg
An error message to report to the user.- Returns:
- an error message to report to the user
-