Class ConstraintMapBuilder
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionvoid
addToPrimaryRelationship
(TypeVariable typeVariable, TUConstraint constraint, ConstraintMap result, AnnotationMirrorSet annotationMirrors, QualifierHierarchy qualHierarchy) void
addToTypeRelationship
(TypeVariable target, AnnotatedTypeMirror type, ConstraintMap result, TUConstraint constraint, AnnotationMirrorSet hierarchies) 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.
-
Constructor Details
-
ConstraintMapBuilder
public ConstraintMapBuilder()
-
-
Method Details
-
build
public 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. Let ATM be an annotated type mirror that may or may not be target Tx, or have a component target Tx Let Ai be the type argument we are trying to infer for TiWe 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:
- between a target and a concrete AnnotatedTypeMirror. E.g., As seen above
(@NonNull Ti = @NonNull @Initialized String)
- between two targets E.g.,
(@NonNull Ti = Tj)
- between a target and a concrete AnnotatedTypeMirror. E.g., As seen above
-
addToPrimaryRelationship
public void addToPrimaryRelationship(TypeVariable typeVariable, TUConstraint constraint, ConstraintMap result, AnnotationMirrorSet annotationMirrors, QualifierHierarchy qualHierarchy) -
addToTypeRelationship
public void addToTypeRelationship(TypeVariable target, AnnotatedTypeMirror type, ConstraintMap result, TUConstraint constraint, AnnotationMirrorSet hierarchies)
-