public class MultiGraphQualifierHierarchy extends QualifierHierarchy
This class is immutable and can be only created through MultiGraphQualifierHierarchy.MultiGraphFactory.
| Modifier and Type | Class and Description |
|---|---|
static class |
MultiGraphQualifierHierarchy.MultiGraphFactory
Factory used to create an instance of
GraphQualifierHierarchy. |
| Modifier and Type | Field and Description |
|---|---|
protected Set<AnnotationMirror> |
bottoms
The bottom qualifiers of the type hierarchies.
|
protected AnnotationMirror |
polymorphicQualifier
Reference to the special qualifier org.checkerframework.framework.qual.PolymorphicQualifier.
|
protected Map<AnnotationMirror,AnnotationMirror> |
polyQualifiers |
protected Map<AnnotationMirror,Set<AnnotationMirror>> |
supertypesDirect
The declared, direct supertypes for each qualifier, without added transitive relations.
|
protected Map<AnnotationMirror,Set<AnnotationMirror>> |
supertypesTransitive
The transitive closure of the supertypesDirect.
|
protected Set<AnnotationMirror> |
tops
The top qualifiers of the individual type hierarchies.
|
| Constructor and Description |
|---|
MultiGraphQualifierHierarchy(MultiGraphQualifierHierarchy.MultiGraphFactory f) |
MultiGraphQualifierHierarchy(MultiGraphQualifierHierarchy.MultiGraphFactory f,
Object... args) |
| Modifier and Type | Method and Description |
|---|---|
protected void |
addPolyRelations(QualifierHierarchy qualHierarchy,
Map<AnnotationMirror,Set<AnnotationMirror>> fullMap,
Map<AnnotationMirror,AnnotationMirror> polyQualifiers,
Set<AnnotationMirror> tops,
Set<AnnotationMirror> bottoms)
Add the relationships for polymorphic qualifiers.
|
protected Set<AnnotationMirror> |
findBottoms(Map<AnnotationMirror,Set<AnnotationMirror>> supertypes)
Infer the bottoms of the subtype hierarchy.
|
protected AnnotationMirror |
findLub(AnnotationMirror a1,
AnnotationMirror a2)
Finds and returns the Least Upper Bound (LUB) of two annotation mirrors a1 and a2 by
recursively climbing the qualifier hierarchy of a1 until one of them is a subtype of the
other, or returns null if no subtype relationships can be found.
|
protected Set<AnnotationMirror> |
findTops(Map<AnnotationMirror,Set<AnnotationMirror>> supertypes)
Infer the tops of the subtype hierarchy.
|
protected void |
finish(QualifierHierarchy qualHierarchy,
Map<AnnotationMirror,Set<AnnotationMirror>> supertypesTransitive,
Map<AnnotationMirror,AnnotationMirror> polyQualifiers,
Set<AnnotationMirror> tops,
Set<AnnotationMirror> bottoms,
Object... args)
Method to finalize the qualifier hierarchy before it becomes unmodifiable.
|
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.
|
Set<? extends AnnotationMirror> |
getBottomAnnotations() |
AnnotationMirror |
getPolymorphicAnnotation(AnnotationMirror start) |
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.
|
Set<? extends AnnotationMirror> |
getTopAnnotations() |
Set<? extends AnnotationMirror> |
getTypeQualifiers()
Returns all type qualifiers in this type qualifier hierarchy.
|
AnnotationMirror |
greatestLowerBound(AnnotationMirror a1,
AnnotationMirror a2)
Returns the greatest lower bound for the qualifiers a1 and a2.
|
AnnotationMirror |
greatestLowerBoundTypeVariable(AnnotationMirror a1,
AnnotationMirror a2)
Returns the greatest lower bound for the qualifiers a1 and a2.
|
boolean |
isSubtype(AnnotationMirror subAnno,
AnnotationMirror superAnno)
Tests whether rhs is equal to or a sub-qualifier of lhs, according to the type qualifier
hierarchy.
|
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.
|
boolean |
isSubtypeTypeVariable(AnnotationMirror subAnno,
AnnotationMirror superAnno)
Tests whether
subAnno is a sub-qualifier of superAnno, according to the type
qualifier hierarchy. |
boolean |
isSubtypeTypeVariable(Collection<? extends AnnotationMirror> subAnnos,
Collection<? extends AnnotationMirror> superAnnos)
Tests whether there is any annotation in superAnnos that is a super qualifier of some
annotation in subAnnos.
|
AnnotationMirror |
leastUpperBound(AnnotationMirror a1,
AnnotationMirror a2)
Returns the least upper bound for the qualifiers a1 and a2.
|
AnnotationMirror |
leastUpperBoundTypeVariable(AnnotationMirror a1,
AnnotationMirror a2)
Returns the least upper bound for the qualifiers a1 and a2.
|
String |
toString() |
protected Map<AnnotationMirror,Set<AnnotationMirror>> |
transitiveClosure(Map<AnnotationMirror,Set<AnnotationMirror>> supertypes)
Computes the transitive closure of the given map and returns it.
|
canHaveEmptyAnnotationSet, findAnnotationInHierarchy, findAnnotationInSameHierarchy, getWidth, greatestLowerBound, greatestLowerBounds, greatestLowerBounds, greatestLowerBoundsTypeVariable, isSubtype, isSubtype, isValid, leastUpperBound, leastUpperBounds, leastUpperBounds, leastUpperBoundsTypeVariable, numberOfIterationsBeforeWidening, updateMappingToMutableSet, widenedUpperBoundprotected final Map<AnnotationMirror,Set<AnnotationMirror>> supertypesDirect
protected final Map<AnnotationMirror,Set<AnnotationMirror>> supertypesTransitive
protected final Set<AnnotationMirror> tops
protected final Set<AnnotationMirror> bottoms
protected final AnnotationMirror polymorphicQualifier
protected final Map<AnnotationMirror,AnnotationMirror> polyQualifiers
public MultiGraphQualifierHierarchy(MultiGraphQualifierHierarchy.MultiGraphFactory f)
public MultiGraphQualifierHierarchy(MultiGraphQualifierHierarchy.MultiGraphFactory f, Object... args)
protected void finish(QualifierHierarchy qualHierarchy, Map<AnnotationMirror,Set<AnnotationMirror>> supertypesTransitive, Map<AnnotationMirror,AnnotationMirror> polyQualifiers, Set<AnnotationMirror> tops, Set<AnnotationMirror> bottoms, Object... args)
@SideEffectFree public String toString()
public Set<? extends AnnotationMirror> getTopAnnotations()
getTopAnnotations in class QualifierHierarchypublic AnnotationMirror getTopAnnotation(AnnotationMirror start)
QualifierHierarchygetTopAnnotation in class QualifierHierarchypublic Set<? extends AnnotationMirror> getBottomAnnotations()
getBottomAnnotations in class QualifierHierarchypublic AnnotationMirror getBottomAnnotation(AnnotationMirror start)
QualifierHierarchygetBottomAnnotation in class QualifierHierarchypublic AnnotationMirror getPolymorphicAnnotation(AnnotationMirror start)
getPolymorphicAnnotation in class QualifierHierarchystart - any qualifier from the type hierarchynull if there is no
polymorphic qualifier in that hierarchypublic boolean isSubtype(Collection<? extends AnnotationMirror> rhs, Collection<? extends AnnotationMirror> lhs)
QualifierHierarchyisSubtype in class QualifierHierarchypublic boolean isSubtypeTypeVariable(Collection<? extends AnnotationMirror> subAnnos, Collection<? extends AnnotationMirror> superAnnos)
QualifierHierarchyThis 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).
isSubtypeTypeVariable in class QualifierHierarchypublic Set<? extends AnnotationMirror> getTypeQualifiers()
QualifierHierarchygetTypeQualifiers in class QualifierHierarchypublic AnnotationMirror leastUpperBound(AnnotationMirror a1, AnnotationMirror a2)
QualifierHierarchyExamples:
leastUpperBound in class QualifierHierarchypublic AnnotationMirror leastUpperBoundTypeVariable(AnnotationMirror a1, AnnotationMirror a2)
QualifierHierarchyExamples:
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).
leastUpperBoundTypeVariable in class QualifierHierarchypublic AnnotationMirror greatestLowerBound(AnnotationMirror a1, AnnotationMirror a2)
QualifierHierarchyThe two qualifiers have to be from the same qualifier hierarchy. Otherwise, null will be returned.
greatestLowerBound in class QualifierHierarchya1 - first annotationa2 - second annotationpublic AnnotationMirror greatestLowerBoundTypeVariable(AnnotationMirror a1, AnnotationMirror a2)
QualifierHierarchyThe two qualifiers have to be from the same qualifier hierarchy. Otherwise, null will be returned.
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).
greatestLowerBoundTypeVariable in class QualifierHierarchya1 - first annotationa2 - second annotationpublic boolean isSubtype(AnnotationMirror subAnno, AnnotationMirror superAnno)
Most qualifiers have no value fields. However, two annotations with values are subtype of each other only if they have the same values. i.e. I(m) is a subtype of I(n) iff m = n.
When client specifies an annotation, a1, to be a subtype of annotation with values, a2, then a1 is a subtype of all instances of a2 regardless of a2 values.
isSubtype in class QualifierHierarchysubAnno - the sub qualifiersuperAnno - the super qualifierpublic boolean isSubtypeTypeVariable(AnnotationMirror subAnno, AnnotationMirror superAnno)
QualifierHierarchysubAnno is a sub-qualifier of superAnno, according to the type
qualifier hierarchy. This checks only the qualifiers, not the Java type.
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).
isSubtypeTypeVariable in class QualifierHierarchysubAnno is a sub qualifier of superAnnoprotected Set<AnnotationMirror> findTops(Map<AnnotationMirror,Set<AnnotationMirror>> supertypes)
protected Set<AnnotationMirror> findBottoms(Map<AnnotationMirror,Set<AnnotationMirror>> supertypes)
protected Map<AnnotationMirror,Set<AnnotationMirror>> transitiveClosure(Map<AnnotationMirror,Set<AnnotationMirror>> supertypes)
protected void addPolyRelations(QualifierHierarchy qualHierarchy, Map<AnnotationMirror,Set<AnnotationMirror>> fullMap, Map<AnnotationMirror,AnnotationMirror> polyQualifiers, Set<AnnotationMirror> tops, Set<AnnotationMirror> bottoms)
A polymorphic qualifier, such as PolyNull, needs to be:
Nullable)
NonNull)
protected AnnotationMirror findLub(AnnotationMirror a1, AnnotationMirror a2)
a1 - first annotation mirrora2 - second annotation mirror