Class Typing
- All Implemented Interfaces:
Constraint,ReductionResult
AbstractType. One of:
Constraint.Kind.TYPE_COMPATIBILITY< S -> T >: A type S is compatible in a loose invocation context with type TConstraint.Kind.SUBTYPE< S <: T >: A reference type S is a subtype of a reference type TConstraint.Kind.CONTAINED< S <= T >: A type argument S is contained by a type argument T.Constraint.Kind.TYPE_EQUALITY< S = T >: A type S is the same as a type T, or a type argument S is the same as type argument T.
-
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 class org.checkerframework.framework.util.typeinference8.constraint.TypeConstraint
parent, source, TFields inherited from interface org.checkerframework.framework.util.typeinference8.constraint.ReductionResult
UNCHECKED_CONVERSION -
Constructor Summary
ConstructorsConstructorDescriptionTyping(String source, AbstractType S, AbstractType t, Constraint.Kind kind) Creates a typing constraint.Typing(Constraint parent, AbstractType S, AbstractType t, Constraint.Kind kind) Creates a typing constraint.Typing(Constraint parent, AbstractType S, AbstractType t, Constraint.Kind kind, boolean covarTypeArg) Creates a typing constraint. -
Method Summary
Modifier and TypeMethodDescriptionvoidApply the given instantiations to any type mentioned in this constraint -- meaning replace any mention of a variable ininstantiationswith its proper type.booleanReturns a set of all inference variables mentioned by this constraint.Returns the input variables of this constraint: the inference variables that must be resolved before this constraint may be reduced.getKind()Returns the kind of constraint."The output variables of [expression] constraints are all inference variables mentioned by the type on the right-hand side of the constraint, T, that are not input variables."getS()Returns one of the abstract types in this constraint.inthashCode()reduce(Java8InferenceContext context) Reduce this constraint what this means depends on the kind of constraint.toString()Methods inherited from class org.checkerframework.framework.util.typeinference8.constraint.TypeConstraint
addAllLazily, constraintHistory, getInputVariablesForExpression, getT
-
Constructor Details
-
Typing
Creates a typing constraint.- Parameters:
parent- the constraint whose reduction created this constraintS- left-hand side typet- right-hand side typekind- the kind of constraint
-
Typing
Creates a typing constraint.- Parameters:
source- a string describing where this constraint came fromS- left-hand side typet- right-hand side typekind- the kind of constraint
-
Typing
public Typing(Constraint parent, AbstractType S, AbstractType t, Constraint.Kind kind, boolean covarTypeArg) Creates a typing constraint.- Parameters:
parent- the constraint whose reduction created this constraintS- left-hand side typet- right-hand side typekind- the kind of constraintcovarTypeArg- true if the constraint is for a covariant type argument
-
-
Method Details
-
getS
Returns one of the abstract types in this constraint.- Returns:
- one of the abstract types in this constraint
-
getKind
Description copied from interface:ConstraintReturns the kind of constraint.- Returns:
- the kind of constraint
-
getInputVariables
Description copied from interface:ConstraintReturns the input variables of this constraint: the inference variables that must be resolved before this constraint may be reduced.For lambda, method reference, and additional-argument constraints, input variables are roughly the inference variables mentioned by the target function type's parameter types. For conditional expression constraints and switch expression constraints, input variables are the union of the input variables of their subexpressions. For all other constraints, no input variables exist.
Defined in JLS section 18.5.2.2. (
Constraint.Kind.ADDITIONAL_ARGconstraints are this implementation's own addition, not a JLS-defined constraint kind, but they need the same ordering treatment: seeAdditionalArgument.)Callers that need to mutate the result should make a defensive copy first.
- Returns:
- the input variables of this constraint
-
getOutputVariables
Description copied from class:TypeConstraint"The output variables of [expression] constraints are all inference variables mentioned by the type on the right-hand side of the constraint, T, that are not input variables."As defined in JLS section 18.5.2.2
Callers that need to mutate the result should make a defensive copy first.
- Specified by:
getOutputVariablesin classTypeConstraint- Returns:
- output variables for this constraint
-
getInferenceVariables
Description copied from class:TypeConstraintReturns a set of all inference variables mentioned by this constraint.The mutability/freshness guarantees are the same as
AbstractType.getInferenceVariables().- Overrides:
getInferenceVariablesin classTypeConstraint- Returns:
- a set of all inference variables mentioned by this constraint
-
applyInstantiations
public void applyInstantiations()Description copied from class:TypeConstraintApply the given instantiations to any type mentioned in this constraint -- meaning replace any mention of a variable ininstantiationswith its proper type.- Overrides:
applyInstantiationsin classTypeConstraint
-
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
- Parameters:
context- Java8InferenceContext- Returns:
- the result of reducing this constraint
-
toString
-
equals
- Overrides:
equalsin classTypeConstraint
-
hashCode
public int hashCode()- Overrides:
hashCodein classTypeConstraint
-