public abstract class QualifierHierarchy extends 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).
|
AnnotationMirror |
findCorrespondingAnnotation(AnnotationMirror aliased,
Collection<? extends AnnotationMirror> a) |
AnnotationMirror |
getAnnotationInHierarchy(Collection<? extends AnnotationMirror> annos,
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 AnnotationMirror |
getBottomAnnotation(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 Set<? extends AnnotationMirror> |
getBottomAnnotations() |
abstract AnnotationMirror |
getPolymorphicAnnotation(AnnotationMirror start) |
abstract AnnotationMirror |
getTopAnnotation(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 Set<? extends AnnotationMirror> |
getTopAnnotations() |
abstract Set<? extends AnnotationMirror> |
getTypeQualifiers()
Returns all type qualifiers in this type qualifier hierarchy.
|
int |
getWidth()
Returns the width of this hierarchy, i.e.
|
AnnotationMirror |
greatestLowerBound(AnnotatedTypeMirror type1,
AnnotatedTypeMirror type2,
AnnotationMirror a1,
AnnotationMirror a2)
Returns the greatest lower bound for the qualifiers a1 and a2.
|
abstract AnnotationMirror |
greatestLowerBound(AnnotationMirror a1,
AnnotationMirror a2)
Returns the greatest lower bound for the qualifiers a1 and a2.
|
Set<? extends AnnotationMirror> |
greatestLowerBounds(AnnotatedTypeMirror type1,
AnnotatedTypeMirror type2,
Collection<? extends AnnotationMirror> annos1,
Collection<AnnotationMirror> annos2)
Returns the type qualifiers that are the greatest lower bound of
the qualifiers in annos1 and annos2.
|
Set<? extends AnnotationMirror> |
greatestLowerBounds(Collection<? extends AnnotationMirror> annos1,
Collection<? extends AnnotationMirror> annos2)
Returns the greatest lower bound of two types.
|
Set<? extends AnnotationMirror> |
greatestLowerBoundsTypeVariable(Collection<? extends AnnotationMirror> annos1,
Collection<? extends AnnotationMirror> annos2)
Returns the type qualifiers that are the greatest lower bound of
the qualifiers in annos1 and annos2.
|
abstract AnnotationMirror |
greatestLowerBoundTypeVariable(AnnotationMirror a1,
AnnotationMirror a2)
Returns the greatest lower bound for the qualifiers a1 and a2.
|
boolean |
isSubtype(AnnotatedTypeMirror type1,
AnnotatedTypeMirror type2,
AnnotationMirror anno1,
AnnotationMirror anno2)
Tests whether anno1 is a sub-qualifier of anno2, according to the
type qualifier hierarchy.
|
boolean |
isSubtype(AnnotatedTypeMirror type1,
AnnotatedTypeMirror type2,
Collection<? extends AnnotationMirror> rhs,
Collection<AnnotationMirror> lhs)
Tests whether there is any annotation in lhs that is a super qualifier of
some annotation in rhs.
|
abstract boolean |
isSubtype(AnnotationMirror rhs,
AnnotationMirror lhs)
Tests whether rhs is a sub-qualifier of lhs, according to the type
qualifier hierarchy.
|
abstract boolean |
isSubtype(Collection<? extends AnnotationMirror> rhs,
Collection<? extends AnnotationMirror> lhs)
Tests whether there is any annotation in lhs that is a super qualifier
of some annotation in rhs.
|
abstract boolean |
isSubtypeTypeVariable(AnnotationMirror anno1,
AnnotationMirror anno2)
Tests whether anno1 is a sub-qualifier of anno2, according to the
type qualifier hierarchy.
|
abstract boolean |
isSubtypeTypeVariable(Collection<? extends AnnotationMirror> rhs,
Collection<? extends 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.
|
AnnotationMirror |
leastUpperBound(AnnotatedTypeMirror type1,
AnnotatedTypeMirror type2,
AnnotationMirror a1,
AnnotationMirror a2)
Returns the least upper bound for the qualifiers a1 and a2.
|
abstract AnnotationMirror |
leastUpperBound(AnnotationMirror a1,
AnnotationMirror a2)
Returns the least upper bound for the qualifiers a1 and a2.
|
Set<? extends AnnotationMirror> |
leastUpperBounds(AnnotatedTypeMirror type1,
AnnotatedTypeMirror type2,
Collection<? extends AnnotationMirror> annos1,
Collection<AnnotationMirror> annos2)
Returns the type qualifiers that are the least upper bound of
the qualifiers in annos1 and annos2.
|
Set<? extends AnnotationMirror> |
leastUpperBounds(Collection<? extends AnnotationMirror> annos1,
Collection<? extends AnnotationMirror> annos2)
Returns the least upper bound of two types.
|
Set<? extends AnnotationMirror> |
leastUpperBoundsTypeVariable(Collection<? extends AnnotationMirror> annos1,
Collection<? extends AnnotationMirror> annos2)
Returns the type qualifiers that are the least upper bound of
the qualifiers in annos1 and annos2.
|
abstract AnnotationMirror |
leastUpperBoundTypeVariable(AnnotationMirror a1,
AnnotationMirror a2)
Returns the least upper bound for the qualifiers a1 and a2.
|
<T> boolean |
updateMappingToMutableSet(Map<T,Set<AnnotationMirror>> map,
T key,
AnnotationMirror newQual)
Update a mapping from some key to a set of AnnotationMirrors.
|
public boolean isValid()
public int getWidth()
public abstract Set<? extends AnnotationMirror> getTopAnnotations()
public abstract AnnotationMirror getTopAnnotation(AnnotationMirror start)
public abstract AnnotationMirror getBottomAnnotation(AnnotationMirror start)
public abstract Set<? extends AnnotationMirror> getBottomAnnotations()
public abstract AnnotationMirror getPolymorphicAnnotation(AnnotationMirror start)
start
- any qualifier from the type hierarchypublic abstract Set<? extends AnnotationMirror> getTypeQualifiers()
public abstract boolean isSubtype(AnnotationMirror rhs, AnnotationMirror lhs)
public abstract boolean isSubtype(Collection<? extends AnnotationMirror> rhs, Collection<? extends AnnotationMirror> lhs)
public abstract AnnotationMirror leastUpperBound(AnnotationMirror a1, AnnotationMirror a2)
Examples:
public abstract AnnotationMirror greatestLowerBound(AnnotationMirror a1, AnnotationMirror a2)
a1
- first annotationa2
- second annotationpublic Set<? extends AnnotationMirror> leastUpperBounds(Collection<? extends AnnotationMirror> annos1, Collection<? extends AnnotationMirror> annos2)
Annos1 and annos2 must have the same size, and each annotation in them must be from a different type hierarchy.
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.
annos1
- first collection of qualifiersannos2
- second collection of qualifierspublic Set<? extends AnnotationMirror> greatestLowerBounds(Collection<? extends AnnotationMirror> annos1, Collection<? extends AnnotationMirror> annos2)
Annos1 and annos2 must have the same size, and each annotation in them must be from a different type hierarchy.
annos1
- first collection of qualifiersannos2
- second collection of qualifierspublic abstract boolean isSubtypeTypeVariable(AnnotationMirror anno1, 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(Collection<? extends AnnotationMirror> rhs, Collection<? extends 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 AnnotationMirror leastUpperBoundTypeVariable(AnnotationMirror a1, 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 AnnotationMirror greatestLowerBoundTypeVariable(AnnotationMirror a1, 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 Set<? extends AnnotationMirror> leastUpperBoundsTypeVariable(Collection<? extends AnnotationMirror> annos1, Collection<? extends 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 Set<? extends AnnotationMirror> greatestLowerBoundsTypeVariable(Collection<? extends AnnotationMirror> annos1, Collection<? extends 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, AnnotationMirror anno1, 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, Collection<? extends AnnotationMirror> rhs, Collection<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 AnnotationMirror leastUpperBound(AnnotatedTypeMirror type1, AnnotatedTypeMirror type2, AnnotationMirror a1, 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 AnnotationMirror greatestLowerBound(AnnotatedTypeMirror type1, AnnotatedTypeMirror type2, AnnotationMirror a1, 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 Set<? extends AnnotationMirror> leastUpperBounds(AnnotatedTypeMirror type1, AnnotatedTypeMirror type2, Collection<? extends AnnotationMirror> annos1, Collection<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 Set<? extends AnnotationMirror> greatestLowerBounds(AnnotatedTypeMirror type1, AnnotatedTypeMirror type2, Collection<? extends AnnotationMirror> annos1, Collection<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 AnnotationMirror findCorrespondingAnnotation(AnnotationMirror aliased, Collection<? extends AnnotationMirror> a)
public AnnotationMirror getAnnotationInHierarchy(Collection<? extends AnnotationMirror> annos, AnnotationMirror top)
annos
- The set of annotations.top
- The top annotation of the hierarchy to consider.public <T> boolean updateMappingToMutableSet(Map<T,Set<AnnotationMirror>> map, T key, AnnotationMirror newQual)
map
- the mapping to modifykey
- the key to updatenewQual
- the value to add