Interface QualifierKindHierarchy
-
- All Known Implementing Classes:
DefaultQualifierKindHierarchy
,UnitsAnnotatedTypeFactory.UnitsQualifierKindHierarchy
@AnnotatedFor("nullness") public interface QualifierKindHierarchy
This interface holds information about the subtyping relationships between kinds of qualifiers. A "kind" of qualifier is its annotation class and is represented by theQualifierKind
class. If a type system has more than one hierarchy, information about all hierarchies is stored in this class.The qualifier kind subtyping relationship may be an over-approximation of the qualifier subtyping relationship, for qualifiers that have elements/arguments. In other words, if a qualifier kind is a subtype of another qualifier kind, then qualifiers of those kinds may or may not be subtypes, depending on the values of any elements of the qualifiers. If qualifier kinds are not subtypes, then qualifiers of those kinds are never subtypes.
This interface is used by
NoElementQualifierHierarchy
andElementQualifierHierarchy
(but notMostlyNoElementQualifierHierarchy
) to implement methods that compareAnnotationMirror
s, such asQualifierHierarchy.isSubtypeShallow(AnnotationMirror, TypeMirror, AnnotationMirror, TypeMirror)
.
-
-
Method Summary
All Methods Static Methods Instance Methods Abstract Methods Modifier and Type Method Description java.util.List<? extends QualifierKind>
allQualifierKinds()
Returns a list of allQualifierKind
s sorted in ascending order.static @CanonicalName java.lang.String
annotationClassName(java.lang.Class<? extends java.lang.annotation.Annotation> clazz)
Returns the canonical name ofclazz
.java.util.Set<? extends QualifierKind>
getBottoms()
Returns the qualifier kinds that are the bottom qualifier in their hierarchies.QualifierKind
getQualifierKind(@CanonicalName java.lang.String name)
Returns theQualifierKind
for the given annotation class name.java.util.Set<? extends QualifierKind>
getTops()
Returns the qualifier kinds that are the top qualifier in their hierarchies.@Nullable QualifierKind
greatestLowerBound(QualifierKind q1, QualifierKind q2)
Returns the greatest lower bound ofq1
andq2
, ornull
if the qualifier kinds are not in the same hierarchy.@Nullable QualifierKind
leastUpperBound(QualifierKind q1, QualifierKind q2)
Returns the least upper bound ofq1
andq2
, ornull
if the qualifier kinds are not in the same hierarchy.
-
-
-
Method Detail
-
getTops
java.util.Set<? extends QualifierKind> getTops()
Returns the qualifier kinds that are the top qualifier in their hierarchies.- Returns:
- the qualifier kinds that are the top qualifier in their hierarchies
-
getBottoms
java.util.Set<? extends QualifierKind> getBottoms()
Returns the qualifier kinds that are the bottom qualifier in their hierarchies.- Returns:
- the qualifier kinds that are the bottom qualifier in their hierarchies
-
leastUpperBound
@Nullable QualifierKind leastUpperBound(QualifierKind q1, QualifierKind q2)
Returns the least upper bound ofq1
andq2
, ornull
if the qualifier kinds are not in the same hierarchy. Ignores elements/arguments (as QualifierKind always does).- Parameters:
q1
- a qualifier kindq2
- a qualifier kind- Returns:
- the least upper bound of
q1
andq2
, ornull
if the qualifier kinds are not in the same hierarchy
-
greatestLowerBound
@Nullable QualifierKind greatestLowerBound(QualifierKind q1, QualifierKind q2)
Returns the greatest lower bound ofq1
andq2
, ornull
if the qualifier kinds are not in the same hierarchy. Ignores elements/arguments (as QualifierKind always does).- Parameters:
q1
- a qualifier kindq2
- a qualifier kind- Returns:
- the greatest lower bound of
q1
andq2
, ornull
if the qualifier kinds are not in the same hierarchy
-
allQualifierKinds
java.util.List<? extends QualifierKind> allQualifierKinds()
Returns a list of allQualifierKind
s sorted in ascending order.- Returns:
- a list of all
QualifierKind
s sorted in ascending order
-
getQualifierKind
QualifierKind getQualifierKind(@CanonicalName java.lang.String name)
Returns theQualifierKind
for the given annotation class name. Throws an exception if one does not exist.- Parameters:
name
- canonical name of an annotation class- Returns:
- the
QualifierKind
for the given annotation class name
-
annotationClassName
static @CanonicalName java.lang.String annotationClassName(java.lang.Class<? extends java.lang.annotation.Annotation> clazz)
Returns the canonical name ofclazz
. Throws aTypeSystemError
ifclazz
is anonymous or otherwise does not have a name.- Parameters:
clazz
- annotation class- Returns:
- the canonical name of
clazz
-
-