public class ConstraintMapBuilder extends Object
Constructor and Description |
---|
ConstraintMapBuilder() |
Modifier and Type | Method and Description |
---|---|
void |
addToPrimaryRelationship(TypeVariable typeVariable,
TUConstraint constraint,
ConstraintMap result,
AnnotationMirrorSet annotationMirrors,
QualifierHierarchy qualifierHierarchy) |
void |
addToTypeRelationship(TypeVariable target,
AnnotatedTypeMirror type,
ConstraintMap result,
TUConstraint constraint,
AnnotationMirrorSet hierarchies) |
ConstraintMap |
build(Set<TypeVariable> targets,
Set<TUConstraint> constraints,
AnnotatedTypeFactory typeFactory)
Let Ti be a the ith target being inferred Let ATV(i) be the annotated type variable that
represents as use of Ti which may or may not have primary annotations.
|
public ConstraintMap build(Set<TypeVariable> targets, Set<TUConstraint> constraints, AnnotatedTypeFactory typeFactory)
We have a set of constraints of the form: ATV(i) <?> ATM
Where <?>
is either a subtype (<:
), supertype (:>
), or equality
relationship (=
).
Regardless of what <?>
is, a constraint will only imply constraints on Ai in a
given hierarchy if ATV(i) does NOT have a primary annotation in that hierarchy. That is:
E.g. Let ATV(i) be @NonNull Ti, the constraints @NonNull Ti = @NonNull @Initialized String does not imply any primary annotation in the Nullness hierarchy for type argument Ai because the Annotated type mirror has a primary annotation in the NUllness hierarchy.
However, it does imply that Ai has a primary annotation of @Initialized since ATV(i) has no primary annotation in the initialization hierarchy.
Note, constraints come in 2 forms:
(@NonNull Ti = @NonNull @Initialized String)
(@NonNull Ti = Tj)
public void addToPrimaryRelationship(TypeVariable typeVariable, TUConstraint constraint, ConstraintMap result, AnnotationMirrorSet annotationMirrors, QualifierHierarchy qualifierHierarchy)
public void addToTypeRelationship(TypeVariable target, AnnotatedTypeMirror type, ConstraintMap result, TUConstraint constraint, AnnotationMirrorSet hierarchies)