Class EqualitiesSolver
- java.lang.Object
-
- org.checkerframework.framework.util.typeinference.solver.EqualitiesSolver
-
public class EqualitiesSolver extends java.lang.Object
EqualitiesSolver infers type arguments for targets using the equality constraints in ConstraintMap. When a type is inferred, it rewrites the remaining equality/supertype constraints
-
-
Constructor Summary
Constructors Constructor Description EqualitiesSolver()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description @Nullable InferredValue.InferredTarget
findEqualTarget(TargetConstraints.Equalities equalities, AnnotationMirrorSet tops)
Attempt to find a target which is equal to this target.InferredValue
mergeConstraints(javax.lang.model.type.TypeVariable target, TargetConstraints.Equalities equalities, InferenceResult solution, ConstraintMap constraintMap, AnnotatedTypeFactory typeFactory)
InferenceResult
solveEqualities(java.util.Set<javax.lang.model.type.TypeVariable> targets, ConstraintMap constraintMap, AnnotatedTypeFactory typeFactory)
For each target, if there is one or more equality constraints involving concrete types that lets us infer a primary annotation in all qualifier hierarchies then infer a concrete type argument.boolean
updateTargetsWithPartiallyInferredType(TargetConstraints.Equalities equalities, ConstraintMap constraintMap, AnnotatedTypeFactory typeFactory)
-
-
-
Method Detail
-
solveEqualities
public InferenceResult solveEqualities(java.util.Set<javax.lang.model.type.TypeVariable> targets, ConstraintMap constraintMap, AnnotatedTypeFactory typeFactory)
For each target, if there is one or more equality constraints involving concrete types that lets us infer a primary annotation in all qualifier hierarchies then infer a concrete type argument. else if there is one or more equality constraints involving other targets that lets us infer a primary annotation in all qualifier hierarchies then infer that type argument is the other type argumentif we have inferred either a concrete type or another target as type argument rewrite all of the constraints for the current target to instead use the inferred type/target
We do this iteratively until NO new inferred type argument is found
- Parameters:
targets
- the list of type parameters for which we are inferring type argumentsconstraintMap
- the set of constraints over the set of targets- Returns:
- a Map from target to (inferred type or target)
-
mergeConstraints
public InferredValue mergeConstraints(javax.lang.model.type.TypeVariable target, TargetConstraints.Equalities equalities, InferenceResult solution, ConstraintMap constraintMap, AnnotatedTypeFactory typeFactory)
-
updateTargetsWithPartiallyInferredType
public boolean updateTargetsWithPartiallyInferredType(TargetConstraints.Equalities equalities, ConstraintMap constraintMap, AnnotatedTypeFactory typeFactory)
-
findEqualTarget
public @Nullable InferredValue.InferredTarget findEqualTarget(TargetConstraints.Equalities equalities, AnnotationMirrorSet tops)
Attempt to find a target which is equal to this target.- Returns:
- a target equal to this target in all hierarchies, or null
-
-