Class AdditionalArgument
java.lang.Object
org.checkerframework.framework.util.typeinference8.constraint.AdditionalArgument
- All Implemented Interfaces:
Constraint,ReductionResult
A constraint the represent additional argument constraints generated from a method or constructor
invocation that is a part of a larger inference problem. When this constraint is reduced it will
generate more constraints from the invocaton. This is because created the constraints might use
the type of an implicit lambda parameter for which the larger inference problem has not yet found
a type. So, the additional constraints can be created until after the implicit lambda parameter
has a type.
If the invocation is in the body of a lambda, then the input variables of this constraint are
those of the Expression constraint of that lambda. Like the input variables of an Expression constraint, they are resolved before this constraint is reduced (see JLS
18.5.2.2), so the lambda constraint, which is preferred to this constraint when both can be
reduced, has been reduced first: the parameters of the lambda have their types, and the
invocation has been reduced as part of this inference problem if it is part of it at all. The
reduction of this constraint is empty if it is not.
-
Nested Class Summary
Nested classes/interfaces inherited from interface org.checkerframework.framework.util.typeinference8.constraint.Constraint
Constraint.KindNested classes/interfaces inherited from interface org.checkerframework.framework.util.typeinference8.constraint.ReductionResult
ReductionResult.ReductionResultPair -
Field Summary
Fields inherited from interface org.checkerframework.framework.util.typeinference8.constraint.ReductionResult
UNCHECKED_CONVERSION -
Constructor Summary
ConstructorsConstructorDescriptionAdditionalArgument(ExpressionTree methodOrConstructorInvocation) Creates a new constraint that has no input variables.AdditionalArgument(ExpressionTree methodOrConstructorInvocation, Set<Variable> inputVariables) Creates a new constraint. -
Method Summary
Modifier and TypeMethodDescriptionReturns the input variables of this constraint that have not yet been resolved.getKind()Returns the kind of constraint.booleanisInvocationReduced(Java8InferenceContext context) Returns true if the invocation of this constraint has been reduced as part of this inference problem, so that its additional argument constraints can be created.reduce(Java8InferenceContext context) Reduce this constraint what this means depends on the kind of constraint.reduceInvocation(Java8InferenceContext context) Returns the additional argument constraints of the invocation, whether or not it has been reduced as part of this inference problem yet.
-
Constructor Details
-
AdditionalArgument
Creates a new constraint that has no input variables.- Parameters:
methodOrConstructorInvocation- tree for the method or constructor invocation for this constraint
-
AdditionalArgument
public AdditionalArgument(ExpressionTree methodOrConstructorInvocation, Set<Variable> inputVariables) Creates a new constraint.- Parameters:
methodOrConstructorInvocation- tree for the method or constructor invocation for this constraintinputVariables- the inference variables that must be resolved before this constraint is reduced; the caller must not modify the set afterwards
-
-
Method Details
-
getInputVariables
Returns the input variables of this constraint that have not yet been resolved. They must be resolved before this constraint is reduced.- Specified by:
getInputVariablesin interfaceConstraint- Returns:
- the input variables of this constraint that have not yet been resolved
-
getKind
Description copied from interface:ConstraintReturns the kind of constraint.- Specified by:
getKindin interfaceConstraint- Returns:
- the kind of constraint
-
isInvocationReduced
Returns true if the invocation of this constraint has been reduced as part of this inference problem, so that its additional argument constraints can be created.- Parameters:
context- the context- Returns:
- true if the invocation of this constraint has been reduced as part of this inference problem
-
reduce
Description copied from interface:ConstraintReduce this constraint what this means depends on the kind of constraint. Reduction can produce new bounds and/or new constraints.Reduction is documented in JLS section 18.2
- Specified by:
reducein interfaceConstraint- Parameters:
context- Java8InferenceContext- Returns:
- the result of reducing this constraint
-
reduceInvocation
Returns the additional argument constraints of the invocation, whether or not it has been reduced as part of this inference problem yet. Use it only for an invocation that is part of the problem.- Parameters:
context- the context- Returns:
- the additional argument constraints of the invocation
-