Class InferenceResult
java.lang.Object
org.checkerframework.framework.util.typeinference8.InferenceResult
The result of type argument inferrece.
-
Constructor Summary
ConstructorDescriptionInferenceResult
(Collection<Variable> variables, boolean uncheckedConversion, boolean annoInferenceFailed, String errorMsg) Creates an inference result. -
Method Summary
Modifier and TypeMethodDescriptionstatic InferenceResult
Returns 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
.boolean
Whether type argument inference failed because an annotated type could not be inferred.boolean
Whether unchecked conversion was necessary to infer the type arguments.
-
Constructor Details
-
InferenceResult
public InferenceResult(Collection<Variable> variables, boolean uncheckedConversion, boolean annoInferenceFailed, String errorMsg) Creates an inference result.- Parameters:
variables
- instantiated variablesuncheckedConversion
- where unchecked conversion was required to infer the type argumentsannoInferenceFailed
- whether inference failed because of annotationserrorMsg
- 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
-
isUncheckedConversion
public boolean isUncheckedConversion()Whether unchecked conversion was necessary to infer the type arguments.- Returns:
- whether unchecked conversion was necessary to infer the type arguments
-
inferenceFailed
public boolean inferenceFailed()Whether type argument inference failed because an annotated type could not be inferred.- Returns:
- Whether type argument inference failed because an annotated type could not be inferred
-
getTypeArgumentsForExpression
public Map<TypeVariable,AnnotatedTypeMirror> getTypeArgumentsForExpression(ExpressionTree expressionTree) Returns a mapping from type variable to its type argument for theexpressionTree
.- 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
-