public abstract class QualifierHierarchy
extends java.lang.Object
Constructor and Description |
---|
QualifierHierarchy() |
Modifier and Type | Method and Description |
---|---|
static boolean |
canHaveEmptyAnnotationSet(AnnotatedTypeMirror type)
Returns true if and only if the given type can have empty annotation sets
(and thus the *TypeVariable methods need to be used).
|
javax.lang.model.element.AnnotationMirror |
findCorrespondingAnnotation(javax.lang.model.element.AnnotationMirror aliased,
java.util.Collection<? extends javax.lang.model.element.AnnotationMirror> a) |
javax.lang.model.element.AnnotationMirror |
getAnnotationInHierarchy(java.util.Collection<? extends javax.lang.model.element.AnnotationMirror> annos,
javax.lang.model.element.AnnotationMirror top)
Returns the annotation from the hierarchy identified by its 'top' annotation
from a set of annotations, using this QualifierHierarchy for subtype tests.
|
abstract javax.lang.model.element.AnnotationMirror |
getBottomAnnotation(javax.lang.model.element.AnnotationMirror start)
Return the bottom for the given qualifier, that is, the qualifier that is a
subtype of start but no further subtypes exist.
|
abstract java.util.Set<? extends javax.lang.model.element.AnnotationMirror> |
getBottomAnnotations() |
abstract javax.lang.model.element.AnnotationMirror |
getPolymorphicAnnotation(javax.lang.model.element.AnnotationMirror start) |
abstract javax.lang.model.element.AnnotationMirror |
getTopAnnotation(javax.lang.model.element.AnnotationMirror start)
Return the top qualifier for the given qualifier, that is, the qualifier
that is a supertype of start but no further supertypes exist.
|
abstract java.util.Set<? extends javax.lang.model.element.AnnotationMirror> |
getTopAnnotations() |
abstract java.util.Set<? extends javax.lang.model.element.AnnotationMirror> |
getTypeQualifiers()
Returns all type qualifiers in this type qualifier hierarchy.
|
int |
getWidth()
Returns the width of this hierarchy, i.e.
|
javax.lang.model.element.AnnotationMirror |
greatestLowerBound(AnnotatedTypeMirror type1,
AnnotatedTypeMirror type2,
javax.lang.model.element.AnnotationMirror a1,
javax.lang.model.element.AnnotationMirror a2)
Returns the greatest lower bound for the qualifiers a1 and a2.
|
abstract javax.lang.model.element.AnnotationMirror |
greatestLowerBound(javax.lang.model.element.AnnotationMirror a1,
javax.lang.model.element.AnnotationMirror a2)
Returns the greatest lower bound for the qualifiers a1 and a2.
|
java.util.Set<? extends javax.lang.model.element.AnnotationMirror> |
greatestLowerBounds(AnnotatedTypeMirror type1,
AnnotatedTypeMirror type2,
java.util.Collection<? extends javax.lang.model.element.AnnotationMirror> annos1,
java.util.Collection<javax.lang.model.element.AnnotationMirror> annos2)
Returns the type qualifiers that are the greatest lower bound of
the qualifiers in annos1 and annos2.
|
java.util.Set<? extends javax.lang.model.element.AnnotationMirror> |
greatestLowerBounds(java.util.Collection<? extends javax.lang.model.element.AnnotationMirror> annos1,
java.util.Collection<? extends javax.lang.model.element.AnnotationMirror> annos2)
Returns the type qualifiers that are the greatest lower bound of
the qualifiers in annos1 and annos2.
|
java.util.Set<? extends javax.lang.model.element.AnnotationMirror> |
greatestLowerBoundsTypeVariable(java.util.Collection<? extends javax.lang.model.element.AnnotationMirror> annos1,
java.util.Collection<? extends javax.lang.model.element.AnnotationMirror> annos2)
Returns the type qualifiers that are the greatest lower bound of
the qualifiers in annos1 and annos2.
|
abstract javax.lang.model.element.AnnotationMirror |
greatestLowerBoundTypeVariable(javax.lang.model.element.AnnotationMirror a1,
javax.lang.model.element.AnnotationMirror a2)
Returns the greatest lower bound for the qualifiers a1 and a2.
|
boolean |
isSubtype(AnnotatedTypeMirror type1,
AnnotatedTypeMirror type2,
javax.lang.model.element.AnnotationMirror anno1,
javax.lang.model.element.AnnotationMirror anno2)
Tests whether anno1 is a sub-qualifier of anno2, according to the
type qualifier hierarchy.
|
boolean |
isSubtype(AnnotatedTypeMirror type1,
AnnotatedTypeMirror type2,
java.util.Collection<? extends javax.lang.model.element.AnnotationMirror> rhs,
java.util.Collection<javax.lang.model.element.AnnotationMirror> lhs)
Tests whether there is any annotation in lhs that is a super qualifier of
some annotation in rhs.
|
abstract boolean |
isSubtype(javax.lang.model.element.AnnotationMirror rhs,
javax.lang.model.element.AnnotationMirror lhs)
Tests whether anno1 is a sub-qualifier of anno2, according to the
type qualifier hierarchy.
|
abstract boolean |
isSubtype(java.util.Collection<? extends javax.lang.model.element.AnnotationMirror> rhs,
java.util.Collection<? extends javax.lang.model.element.AnnotationMirror> lhs)
Tests whether there is any annotation in lhs that is a super qualifier
of some annotation in rhs.
|
abstract boolean |
isSubtypeTypeVariable(javax.lang.model.element.AnnotationMirror anno1,
javax.lang.model.element.AnnotationMirror anno2)
Tests whether anno1 is a sub-qualifier of anno2, according to the
type qualifier hierarchy.
|
abstract boolean |
isSubtypeTypeVariable(java.util.Collection<? extends javax.lang.model.element.AnnotationMirror> rhs,
java.util.Collection<? extends javax.lang.model.element.AnnotationMirror> lhs)
Tests whether there is any annotation in lhs that is a super qualifier
of some annotation in rhs.
|
boolean |
isValid()
Determine whether the instance is valid.
|
javax.lang.model.element.AnnotationMirror |
leastUpperBound(AnnotatedTypeMirror type1,
AnnotatedTypeMirror type2,
javax.lang.model.element.AnnotationMirror a1,
javax.lang.model.element.AnnotationMirror a2)
Returns the least upper bound for the qualifiers a1 and a2.
|
abstract javax.lang.model.element.AnnotationMirror |
leastUpperBound(javax.lang.model.element.AnnotationMirror a1,
javax.lang.model.element.AnnotationMirror a2)
Returns the least upper bound for the qualifiers a1 and a2.
|
java.util.Set<? extends javax.lang.model.element.AnnotationMirror> |
leastUpperBounds(AnnotatedTypeMirror type1,
AnnotatedTypeMirror type2,
java.util.Collection<? extends javax.lang.model.element.AnnotationMirror> annos1,
java.util.Collection<javax.lang.model.element.AnnotationMirror> annos2)
Returns the type qualifiers that are the least upper bound of
the qualifiers in annos1 and annos2.
|
java.util.Set<? extends javax.lang.model.element.AnnotationMirror> |
leastUpperBounds(java.util.Collection<? extends javax.lang.model.element.AnnotationMirror> annos1,
java.util.Collection<? extends javax.lang.model.element.AnnotationMirror> annos2)
Returns the type qualifiers that are the least upper bound of
the qualifiers in annos1 and annos2.
|
java.util.Set<? extends javax.lang.model.element.AnnotationMirror> |
leastUpperBoundsTypeVariable(java.util.Collection<? extends javax.lang.model.element.AnnotationMirror> annos1,
java.util.Collection<? extends javax.lang.model.element.AnnotationMirror> annos2)
Returns the type qualifiers that are the least upper bound of
the qualifiers in annos1 and annos2.
|
abstract javax.lang.model.element.AnnotationMirror |
leastUpperBoundTypeVariable(javax.lang.model.element.AnnotationMirror a1,
javax.lang.model.element.AnnotationMirror a2)
Returns the least upper bound for the qualifiers a1 and a2.
|
<T> boolean |
updateMappingToMutableSet(java.util.Map<T,java.util.Set<javax.lang.model.element.AnnotationMirror>> map,
T key,
javax.lang.model.element.AnnotationMirror newQual)
Update a mapping from some key to a set of AnnotationMirrors.
|
public boolean isValid()
public int getWidth()
public abstract java.util.Set<? extends javax.lang.model.element.AnnotationMirror> getTopAnnotations()
public abstract javax.lang.model.element.AnnotationMirror getTopAnnotation(javax.lang.model.element.AnnotationMirror start)
public abstract javax.lang.model.element.AnnotationMirror getBottomAnnotation(javax.lang.model.element.AnnotationMirror start)
public abstract java.util.Set<? extends javax.lang.model.element.AnnotationMirror> getBottomAnnotations()
public abstract javax.lang.model.element.AnnotationMirror getPolymorphicAnnotation(javax.lang.model.element.AnnotationMirror start)
start
- Any qualifier from the type hierarchy.public abstract java.util.Set<? extends javax.lang.model.element.AnnotationMirror> getTypeQualifiers()
public abstract boolean isSubtype(javax.lang.model.element.AnnotationMirror rhs, javax.lang.model.element.AnnotationMirror lhs)
public abstract boolean isSubtype(java.util.Collection<? extends javax.lang.model.element.AnnotationMirror> rhs, java.util.Collection<? extends javax.lang.model.element.AnnotationMirror> lhs)
public abstract javax.lang.model.element.AnnotationMirror leastUpperBound(javax.lang.model.element.AnnotationMirror a1, javax.lang.model.element.AnnotationMirror a2)
Examples:
public abstract javax.lang.model.element.AnnotationMirror greatestLowerBound(javax.lang.model.element.AnnotationMirror a1, javax.lang.model.element.AnnotationMirror a2)
a1
- First annotationa2
- Second annotationpublic java.util.Set<? extends javax.lang.model.element.AnnotationMirror> leastUpperBounds(java.util.Collection<? extends javax.lang.model.element.AnnotationMirror> annos1, java.util.Collection<? extends javax.lang.model.element.AnnotationMirror> annos2)
This is necessary for determining the type of a conditional expression (?:), where the type of the expression is the least upper bound of the true and false clauses.
public java.util.Set<? extends javax.lang.model.element.AnnotationMirror> greatestLowerBounds(java.util.Collection<? extends javax.lang.model.element.AnnotationMirror> annos1, java.util.Collection<? extends javax.lang.model.element.AnnotationMirror> annos2)
annos1
- First collection of qualifiersannos2
- Second collection of qualifierspublic abstract boolean isSubtypeTypeVariable(javax.lang.model.element.AnnotationMirror anno1, javax.lang.model.element.AnnotationMirror anno2)
This method works even if the underlying Java type is a type variable. In that case, a 'null' AnnnotationMirror and the empty set represent a meaningful value (namely, no annotation).
public abstract boolean isSubtypeTypeVariable(java.util.Collection<? extends javax.lang.model.element.AnnotationMirror> rhs, java.util.Collection<? extends javax.lang.model.element.AnnotationMirror> lhs)
This method works even if the underlying Java type is a type variable. In that case, a 'null' AnnnotationMirror and the empty set represent a meaningful value (namely, no annotation).
public abstract javax.lang.model.element.AnnotationMirror leastUpperBoundTypeVariable(javax.lang.model.element.AnnotationMirror a1, javax.lang.model.element.AnnotationMirror a2)
Examples:
This method works even if the underlying Java type is a type variable. In that case, a 'null' AnnnotationMirror and the empty set represent a meaningful value (namely, no annotation).
public abstract javax.lang.model.element.AnnotationMirror greatestLowerBoundTypeVariable(javax.lang.model.element.AnnotationMirror a1, javax.lang.model.element.AnnotationMirror a2)
This method works even if the underlying Java type is a type variable. In that case, a 'null' AnnnotationMirror and the empty set represent a meaningful value (namely, no annotation).
a1
- First annotationa2
- Second annotationpublic java.util.Set<? extends javax.lang.model.element.AnnotationMirror> leastUpperBoundsTypeVariable(java.util.Collection<? extends javax.lang.model.element.AnnotationMirror> annos1, java.util.Collection<? extends javax.lang.model.element.AnnotationMirror> annos2)
This is necessary for determining the type of a conditional expression (?:), where the type of the expression is the least upper bound of the true and false clauses.
This method works even if the underlying Java type is a type variable. In that case, a 'null' AnnnotationMirror and the empty set represent a meaningful value (namely, no annotation).
public java.util.Set<? extends javax.lang.model.element.AnnotationMirror> greatestLowerBoundsTypeVariable(java.util.Collection<? extends javax.lang.model.element.AnnotationMirror> annos1, java.util.Collection<? extends javax.lang.model.element.AnnotationMirror> annos2)
This method works even if the underlying Java type is a type variable. In that case, a 'null' AnnnotationMirror and the empty set represent a meaningful value (namely, no annotation).
annos1
- First collection of qualifiersannos2
- Second collection of qualifierspublic static boolean canHaveEmptyAnnotationSet(AnnotatedTypeMirror type)
public boolean isSubtype(AnnotatedTypeMirror type1, AnnotatedTypeMirror type2, javax.lang.model.element.AnnotationMirror anno1, javax.lang.model.element.AnnotationMirror anno2)
This method takes an annotated type to decide if the type variable version of the method should be invoked, or if the normal version is sufficient (which provides more strict checks).
public boolean isSubtype(AnnotatedTypeMirror type1, AnnotatedTypeMirror type2, java.util.Collection<? extends javax.lang.model.element.AnnotationMirror> rhs, java.util.Collection<javax.lang.model.element.AnnotationMirror> lhs)
This method takes an annotated type to decide if the type variable version of the method should be invoked, or if the normal version is sufficient (which provides more strict checks).
public javax.lang.model.element.AnnotationMirror leastUpperBound(AnnotatedTypeMirror type1, AnnotatedTypeMirror type2, javax.lang.model.element.AnnotationMirror a1, javax.lang.model.element.AnnotationMirror a2)
Examples:
This method takes an annotated type to decide if the type variable version of the method should be invoked, or if the normal version is sufficient (which provides more strict checks).
public javax.lang.model.element.AnnotationMirror greatestLowerBound(AnnotatedTypeMirror type1, AnnotatedTypeMirror type2, javax.lang.model.element.AnnotationMirror a1, javax.lang.model.element.AnnotationMirror a2)
This method takes an annotated type to decide if the type variable version of the method should be invoked, or if the normal version is sufficient (which provides more strict checks).
a1
- First annotationa2
- Second annotationpublic java.util.Set<? extends javax.lang.model.element.AnnotationMirror> leastUpperBounds(AnnotatedTypeMirror type1, AnnotatedTypeMirror type2, java.util.Collection<? extends javax.lang.model.element.AnnotationMirror> annos1, java.util.Collection<javax.lang.model.element.AnnotationMirror> annos2)
This is necessary for determining the type of a conditional expression (?:), where the type of the expression is the least upper bound of the true and false clauses.
This method takes an annotated type to decide if the type variable version of the method should be invoked, or if the normal version is sufficient (which provides more strict checks).
public java.util.Set<? extends javax.lang.model.element.AnnotationMirror> greatestLowerBounds(AnnotatedTypeMirror type1, AnnotatedTypeMirror type2, java.util.Collection<? extends javax.lang.model.element.AnnotationMirror> annos1, java.util.Collection<javax.lang.model.element.AnnotationMirror> annos2)
This method takes an annotated type to decide if the type variable version of the method should be invoked, or if the normal version is sufficient (which provides more strict checks).
annos1
- First collection of qualifiersannos2
- Second collection of qualifierspublic javax.lang.model.element.AnnotationMirror findCorrespondingAnnotation(javax.lang.model.element.AnnotationMirror aliased, java.util.Collection<? extends javax.lang.model.element.AnnotationMirror> a)
public javax.lang.model.element.AnnotationMirror getAnnotationInHierarchy(java.util.Collection<? extends javax.lang.model.element.AnnotationMirror> annos, javax.lang.model.element.AnnotationMirror top)
annos
- The set of annotations.top
- The top annotation of the hierarchy to consider.public <T> boolean updateMappingToMutableSet(java.util.Map<T,java.util.Set<javax.lang.model.element.AnnotationMirror>> map, T key, javax.lang.model.element.AnnotationMirror newQual)
map
- The mapping to modify.key
- The key to update.newQual
- The value to add.