public class SupertypesSolver extends Object
Constructor and Description |
---|
SupertypesSolver() |
Modifier and Type | Method and Description |
---|---|
static AnnotatedTypeMirror |
groundMissingHierarchies(Map.Entry<AnnotatedTypeMirror,Set<AnnotationMirror>> typeToHierarchies,
Map<AnnotationMirror,AnnotationMirror> lowerBoundAnnos)
For each type in typeToHierarchies,
if that type does not have a corresponding annotation for a given hierarchy
replace it with the corresponding value in lowerBoundAnnos
|
static AnnotatedTypeMirror |
leastUpperBound(TypeVariable target,
AnnotatedTypeFactory typeFactory,
Map<AnnotatedTypeMirror,Set<AnnotationMirror>> types)
Successively calls least upper bound on the elements of types.
|
protected static void |
lubPrimaries(Map<AnnotationMirror,AnnotationMirror> lubOfPrimaries,
Map<AnnotationMirror,Set<AnnotationMirror>> subtypeAnnos,
Set<? extends AnnotationMirror> tops,
QualifierHierarchy qualifierHierarchy)
For each qualifier hierarchy in tops,
take the lub of the annos in subtypeAnnos that correspond to that hierarchy
place the lub in lubOfPrimaries
|
protected InferredValue.InferredType |
mergeLubAnnosWithEqualities(TypeVariable target,
Map<AnnotationMirror,AnnotationMirror> lubAnnos,
ConstraintMap constraintMap,
AnnotatedTypeFactory typeFactory)
We previously found a type that is equal to target but not in all hierarchies.
|
protected InferredValue.InferredType |
mergeLubTypeWithEqualities(TypeVariable target,
AnnotatedTypeMirror lub,
ConstraintMap constraintMap,
AnnotatedTypeFactory typeFactory)
We previously found a type that is equal to target but not in all hierarchies.
|
protected static void |
propagatePreviousLubs(TargetConstraints targetRecord,
org.checkerframework.framework.util.typeinference.solver.SupertypesSolver.Lubs solution,
Map<AnnotatedTypeMirror,Set<AnnotationMirror>> subtypesOfTarget)
If the target corresponding to targetRecord must be a supertype of another target for which
we have already determined a lub, add that target's lub to this list.
|
InferenceResult |
solveFromSupertypes(Set<TypeVariable> remainingTargets,
ConstraintMap constraintMap,
AnnotatedTypeFactory typeFactory)
Infers type arguments using supertype constraints.
|
public InferenceResult solveFromSupertypes(Set<TypeVariable> remainingTargets, ConstraintMap constraintMap, AnnotatedTypeFactory typeFactory)
remainingTargets
- targets for which we still need to infer a valueconstraintMap
- the set of constraints for all targetstarget -> inferred type
), note this class always infers concrete types
and will not infer that the target is equivalent to another targetprotected InferredValue.InferredType mergeLubTypeWithEqualities(TypeVariable target, AnnotatedTypeMirror lub, ConstraintMap constraintMap, AnnotatedTypeFactory typeFactory)
protected InferredValue.InferredType mergeLubAnnosWithEqualities(TypeVariable target, Map<AnnotationMirror,AnnotationMirror> lubAnnos, ConstraintMap constraintMap, AnnotatedTypeFactory typeFactory)
protected static void propagatePreviousLubs(TargetConstraints targetRecord, org.checkerframework.framework.util.typeinference.solver.SupertypesSolver.Lubs solution, Map<AnnotatedTypeMirror,Set<AnnotationMirror>> subtypesOfTarget)
protected static void lubPrimaries(Map<AnnotationMirror,AnnotationMirror> lubOfPrimaries, Map<AnnotationMirror,Set<AnnotationMirror>> subtypeAnnos, Set<? extends AnnotationMirror> tops, QualifierHierarchy qualifierHierarchy)
public static AnnotatedTypeMirror groundMissingHierarchies(Map.Entry<AnnotatedTypeMirror,Set<AnnotationMirror>> typeToHierarchies, Map<AnnotationMirror,AnnotationMirror> lowerBoundAnnos)
public static AnnotatedTypeMirror leastUpperBound(TypeVariable target, AnnotatedTypeFactory typeFactory, Map<AnnotatedTypeMirror,Set<AnnotationMirror>> types)