Class SubtypesSolver
java.lang.Object
org.checkerframework.framework.util.typeinference.solver.SubtypesSolver
Infers type arguments by using the Greatest Lower Bound computation on the subtype relationships
in a constraint map.
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionglbSubtypes
(Set<TypeVariable> remainingTargets, ConstraintMap constraints, AnnotatedTypeFactory typeFactory) protected static void
propagatePreviousGlbs
(TargetConstraints.Subtypes targetSubtypes, InferenceResult solution, Map<AnnotatedTypeMirror, AnnotationMirrorSet> subtypesOfTarget) /** If the target corresponding to targetRecord must be a subtype of another target for which we have already determined a GLB, add that target's GLB to the list of subtypes to be GLBed for this target.solveFromSubtypes
(Set<TypeVariable> remainingTargets, ConstraintMap constraints, AnnotatedTypeFactory typeFactory) Infers type arguments using subtype constraints.
-
Constructor Details
-
SubtypesSolver
public SubtypesSolver()
-
-
Method Details
-
solveFromSubtypes
public InferenceResult solveFromSubtypes(Set<TypeVariable> remainingTargets, ConstraintMap constraints, AnnotatedTypeFactory typeFactory) Infers type arguments using subtype constraints.- Parameters:
remainingTargets
- targets for which we still need to infer a valueconstraints
- the set of constraints for all targets- Returns:
- a mapping from target to inferred type. Note this class always infers concrete types and will not infer that the target is equivalent to another target.
-
glbSubtypes
public InferenceResult glbSubtypes(Set<TypeVariable> remainingTargets, ConstraintMap constraints, AnnotatedTypeFactory typeFactory) -
propagatePreviousGlbs
protected static void propagatePreviousGlbs(TargetConstraints.Subtypes targetSubtypes, InferenceResult solution, Map<AnnotatedTypeMirror, AnnotationMirrorSet> subtypesOfTarget) /** If the target corresponding to targetRecord must be a subtype of another target for which we have already determined a GLB, add that target's GLB to the list of subtypes to be GLBed for this target.
-