public class SupertypesSolver extends Object
Constructor and Description |
---|
SupertypesSolver() |
Modifier and Type | Method and Description |
---|---|
static AnnotatedTypeMirror |
groundMissingHierarchies(Map.Entry<AnnotatedTypeMirror,AnnotationMirrorSet> typeToHierarchies,
AnnotationMirrorMap<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,AnnotationMirrorSet> types)
Successively calls least upper bound on the elements of types.
|
protected static void |
lubPrimaries(AnnotationMirrorMap<AnnotationMirror> lubOfPrimaries,
AnnotationMirrorMap<AnnotationMirrorSet> subtypeAnnos,
AnnotationMirrorSet 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,
AnnotationMirrorMap<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,AnnotationMirrorSet> 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)
If we failed to infer any annotation for a given hierarchy, either previously from equalities or from the lub, return null.
protected InferredValue.InferredType mergeLubAnnosWithEqualities(TypeVariable target, AnnotationMirrorMap<AnnotationMirror> lubAnnos, ConstraintMap constraintMap, AnnotatedTypeFactory typeFactory)
If we failed to infer any annotation for a given hierarchy, either previously from equalities or from the lub, return null.
protected static void propagatePreviousLubs(TargetConstraints targetRecord, org.checkerframework.framework.util.typeinference.solver.SupertypesSolver.Lubs solution, Map<AnnotatedTypeMirror,AnnotationMirrorSet> subtypesOfTarget)
protected static void lubPrimaries(AnnotationMirrorMap<AnnotationMirror> lubOfPrimaries, AnnotationMirrorMap<AnnotationMirrorSet> subtypeAnnos, AnnotationMirrorSet tops, QualifierHierarchy qualifierHierarchy)
public static AnnotatedTypeMirror groundMissingHierarchies(Map.Entry<AnnotatedTypeMirror,AnnotationMirrorSet> typeToHierarchies, AnnotationMirrorMap<AnnotationMirror> lowerBoundAnnos)
public static AnnotatedTypeMirror leastUpperBound(TypeVariable target, AnnotatedTypeFactory typeFactory, Map<AnnotatedTypeMirror,AnnotationMirrorSet> types)