@AnnotatedFor(value="nullness") public abstract class MostlyNoElementQualifierHierarchy extends ElementQualifierHierarchy
QualifierHierarchy where qualifiers may be
represented by annotations with elements, but most of the qualifiers do not have elements. In
contrast to ElementQualifierHierarchy, this class
partially implements isSubtype(AnnotationMirror, AnnotationMirror), leastUpperBound(AnnotationMirror, AnnotationMirror), and greatestLowerBound(AnnotationMirror, AnnotationMirror) and calls *WithElements when the result
cannot be computed from the meta-annotations SubtypeOf.
Subclasses must implement the following methods when annotations have elements:
isSubtypeWithElements(AnnotationMirror, QualifierKind, AnnotationMirror,
QualifierKind)
leastUpperBoundWithElements(AnnotationMirror, QualifierKind, AnnotationMirror,
QualifierKind,QualifierKind)
greatestLowerBoundWithElements(AnnotationMirror, QualifierKind, AnnotationMirror,
QualifierKind,QualifierKind)
MostlyNoElementQualifierHierarchy uses a QualifierKindHierarchy to model the
relationships between qualifiers. Subclasses can override ElementQualifierHierarchy.createQualifierKindHierarchy(Collection) to return a subclass of QualifierKindHierarchy.
bottoms, bottomsMap, kindToElementlessQualifier, qualifierKindHierarchy, tops, topsMap| Modifier | Constructor and Description |
|---|---|
protected |
MostlyNoElementQualifierHierarchy(Collection<Class<? extends Annotation>> qualifierClasses,
Elements elements)
Creates a MostlyNoElementQualifierHierarchy from the given classes.
|
| Modifier and Type | Method and Description |
|---|---|
@Nullable AnnotationMirror |
greatestLowerBound(AnnotationMirror a1,
AnnotationMirror a2)
Returns the greatest lower bound for the qualifiers qualifier1 and qualifier2.
|
protected abstract AnnotationMirror |
greatestLowerBoundWithElements(AnnotationMirror a1,
QualifierKind qualifierKind1,
AnnotationMirror a2,
QualifierKind qualifierKind2,
QualifierKind glbKind)
Returns the greatest lower bound of
a1 and a2 in cases where the glb of qualifierKind1 and qualifierKind2 is a qualifier kind that has elements. |
boolean |
isSubtype(AnnotationMirror subAnno,
AnnotationMirror superAnno)
Tests whether
subQualifier is equal to or a sub-qualifier of superQualifier,
according to the type qualifier hierarchy. |
protected abstract boolean |
isSubtypeWithElements(AnnotationMirror subAnno,
QualifierKind subKind,
AnnotationMirror superAnno,
QualifierKind superKind)
Returns true if
subAnno is a subtype of superAnno. |
@Nullable AnnotationMirror |
leastUpperBound(AnnotationMirror a1,
AnnotationMirror a2)
Returns the least upper bound (LUB) of the qualifiers
qualifier1 and qualifier2. |
protected abstract AnnotationMirror |
leastUpperBoundWithElements(AnnotationMirror a1,
QualifierKind qualifierKind1,
AnnotationMirror a2,
QualifierKind qualifierKind2,
QualifierKind lubKind)
Returns the least upper bound of
a1 and a2 in cases where the lub of qualifierKind1 and qualifierKind2 is a qualifier kind that has elements. |
createBottomsMap, createElementlessQualifierMap, createQualifierKindHierarchy, createTopsMap, findAnnotationInHierarchy, findAnnotationInSameHierarchy, getBottomAnnotation, getBottomAnnotations, getPolymorphicAnnotation, getQualifierKind, getQualifierKind, getTopAnnotation, getTopAnnotations, isPolymorphicQualifier, isValidclone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitassertSameSize, assertSameSize, canHaveEmptyAnnotationSet, getWidth, greatestLowerBound, greatestLowerBounds, greatestLowerBounds, greatestLowerBoundsTypeVariable, greatestLowerBoundTypeVariable, isSubtype, isSubtype, isSubtype, isSubtypeTypeVariable, isSubtypeTypeVariable, leastUpperBound, leastUpperBounds, leastUpperBounds, leastUpperBoundsTypeVariable, leastUpperBoundTypeVariable, numberOfIterationsBeforeWidening, updateMappingToMutableSet, widenedUpperBoundprotected MostlyNoElementQualifierHierarchy(Collection<Class<? extends Annotation>> qualifierClasses, Elements elements)
qualifierClasses - classes of annotations that are the qualifiers for this hierarchyelements - element utilspublic final boolean isSubtype(AnnotationMirror subAnno, AnnotationMirror superAnno)
QualifierHierarchysubQualifier is equal to or a sub-qualifier of superQualifier,
according to the type qualifier hierarchy.subAnno - possible subqualifier of superQualifiersuperAnno - possible superqualifier of subQualifiersubQualifier is a subqualifier of, or equal to, superQualifierprotected abstract boolean isSubtypeWithElements(AnnotationMirror subAnno, QualifierKind subKind, AnnotationMirror superAnno, QualifierKind superKind)
subAnno is a subtype of superAnno. Both subAnno and
superAnno are annotations with elements. subKind is a sub qualifier kind of
superKind.subAnno - possible subtype annotation; has elementssubKind - QualifierKind of subAnnosuperAnno - possible super annotation; has elementssuperKind - QualifierKind of superAnnosubAnno is a subtype of superAnnopublic final @Nullable AnnotationMirror leastUpperBound(AnnotationMirror a1, AnnotationMirror a2)
QualifierHierarchyqualifier1 and qualifier2. Returns null if the qualifiers are not from the same qualifier hierarchy.
Examples:
a1 - the first qualifier; may not be in the same hierarchy as qualifier2a2 - the second qualifier; may not be in the same hierarchy as qualifier1null if the qualifiers are from
different hierarchiesprotected abstract AnnotationMirror leastUpperBoundWithElements(AnnotationMirror a1, QualifierKind qualifierKind1, AnnotationMirror a2, QualifierKind qualifierKind2, QualifierKind lubKind)
a1 and a2 in cases where the lub of qualifierKind1 and qualifierKind2 is a qualifier kind that has elements. If the lub of
qualifierKind1 and qualifierKind2 does not have elements, then leastUpperBound(AnnotationMirror, AnnotationMirror) returns the correct AnnotationMirror without calling this method.a1 - first annotationqualifierKind1 - QualifierKind for a1a2 - second annotationqualifierKind2 - QualifierKind for a2lubKind - the kind of the lub of qualifierKind1 and qualifierKind2a1 and a2public final @Nullable AnnotationMirror greatestLowerBound(AnnotationMirror a1, AnnotationMirror a2)
QualifierHierarchya1 - first qualifiera2 - second qualifierprotected abstract AnnotationMirror greatestLowerBoundWithElements(AnnotationMirror a1, QualifierKind qualifierKind1, AnnotationMirror a2, QualifierKind qualifierKind2, QualifierKind glbKind)
a1 and a2 in cases where the glb of qualifierKind1 and qualifierKind2 is a qualifier kind that has elements. If the glb of
qualifierKind1 and qualifierKind2 does not have elements, then greatestLowerBound(AnnotationMirror, AnnotationMirror) returns the correct AnnotationMirror without calling this method.a1 - first annotationqualifierKind1 - QualifierKind for a1a2 - second annotationqualifierKind2 - QualifierKind for a2a1 and a2