Class DefaultTypeArgumentInference
java.lang.Object
org.checkerframework.framework.util.typeinference8.DefaultTypeArgumentInference
- All Implemented Interfaces:
TypeArgumentInference
Implementation of type argument inference.
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescription<R> RinferStandalone(ExpressionTree tree, Supplier<R> computation) Returns the result ofcomputation, during which the type arguments oftreeare inferred as iftreewere not nested in another expression: without inferring the invocations whose inference includes it, and without a target type.inferTypeArgs(AnnotatedTypeFactory typeFactory, ExpressionTree expressionTree, AnnotatedTypeMirror.AnnotatedExecutableType methodType) Infer the type arguments for the method or constructor invocation given by invocation.booleanReturns true if an inference problem is being solved.booleanReturns true ifinferStandalone(com.sun.source.tree.ExpressionTree, java.util.function.Supplier<R>)is running.static ExpressionTreeouterInference(ExpressionTree tree, @Nullable TreePath parentPath) Returns the outermost tree required to find the type oftree.
-
Constructor Details
-
DefaultTypeArgumentInference
public DefaultTypeArgumentInference()Creates a DefaultTypeArgumentInference.
-
-
Method Details
-
inferStandalone
Returns the result ofcomputation, during which the type arguments oftreeare inferred as iftreewere not nested in another expression: without inferring the invocations whose inference includes it, and without a target type.- Type Parameters:
R- the type of the result- Parameters:
tree- a poly expressioncomputation- the computation- Returns:
- the result of
computation
-
isInferringStandalone
public boolean isInferringStandalone()Returns true ifinferStandalone(com.sun.source.tree.ExpressionTree, java.util.function.Supplier<R>)is running.- Returns:
- true if
inferStandalone(com.sun.source.tree.ExpressionTree, java.util.function.Supplier<R>)is running
-
isInferring
public boolean isInferring()Returns true if an inference problem is being solved. While it is, the types of the expressions that are part of the problem are computed without inferring their type arguments.- Returns:
- true if an inference problem is being solved
-
inferTypeArgs
public InferenceResult inferTypeArgs(AnnotatedTypeFactory typeFactory, ExpressionTree expressionTree, AnnotatedTypeMirror.AnnotatedExecutableType methodType) Description copied from interface:TypeArgumentInferenceInfer the type arguments for the method or constructor invocation given by invocation.- Specified by:
inferTypeArgsin interfaceTypeArgumentInference- Parameters:
typeFactory- the type factory used to create methodTypeexpressionTree- a tree representing the method or constructor invocation for which we are inferring type argumentsmethodType- the declaration type of method elem- Returns:
- the result which includes the inferred type arguments or an error message if they were not inferred
-
outerInference
Returns the outermost tree required to find the type oftree.- Parameters:
tree- tree that may need an outer tree to find the typeparentPath- path to the parent oftreeor null if no such parent exists- Returns:
- the outermost tree required to find the type of
tree
-