public class MultiGraphQualifierHierarchy extends QualifierHierarchy
MultiGraphQualifierHierarchy.MultiGraphFactory.
A QualifierHierarchy that supports multiple separate subtype hierarchies.| 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>> |
supertypesGraph
The declared, direct supertypes for each qualifier, without added
transitive relations.
|
protected Map<AnnotationMirror,Set<AnnotationMirror>> |
supertypesMap
The transitive closure of the supertypesGraph.
|
protected Set<AnnotationMirror> |
tops
The top qualifiers of the individual type hierarchies.
|
protected Set<String> |
typeQualifiers |
| 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 Map<AnnotationMirror,Set<AnnotationMirror>> |
buildFullMap(Map<AnnotationMirror,Set<AnnotationMirror>> supertypes)
Computes the transitive closure of the given map and returns it.
|
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>> fullMap,
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 rhs,
AnnotationMirror lhs)
Most qualifiers have no value fields.
|
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 rhs,
AnnotationMirror lhs)
Tests whether anno1 is a sub-qualifier of anno2, according to the
type qualifier hierarchy.
|
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.
|
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() |
canHaveEmptyAnnotationSet, findCorrespondingAnnotation, getAnnotationInHierarchy, getWidth, greatestLowerBound, greatestLowerBounds, greatestLowerBounds, greatestLowerBoundsTypeVariable, isSubtype, isSubtype, isValid, leastUpperBound, leastUpperBounds, leastUpperBounds, leastUpperBoundsTypeVariable, updateMappingToMutableSetprotected final Map<AnnotationMirror,Set<AnnotationMirror>> supertypesGraph
protected final Map<AnnotationMirror,Set<AnnotationMirror>> supertypesMap
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>> fullMap, 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 hierarchy.public boolean isSubtype(Collection<? extends AnnotationMirror> rhs, Collection<? extends AnnotationMirror> lhs)
QualifierHierarchyisSubtype in class QualifierHierarchypublic boolean isSubtypeTypeVariable(Collection<? extends AnnotationMirror> rhs, Collection<? extends AnnotationMirror> lhs)
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)
QualifierHierarchygreatestLowerBound in class QualifierHierarchya1 - First annotationa2 - Second annotationpublic AnnotationMirror greatestLowerBoundTypeVariable(AnnotationMirror a1, AnnotationMirror a2)
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).
greatestLowerBoundTypeVariable in class QualifierHierarchya1 - First annotationa2 - Second annotationpublic boolean isSubtype(AnnotationMirror rhs, AnnotationMirror lhs)
@I.isSubtype in class QualifierHierarchyrhs - The right-hand side, i.e. the sub qualifierlhs - The left-hand side, i.e. the super qualifierpublic boolean isSubtypeTypeVariable(AnnotationMirror rhs, AnnotationMirror lhs)
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 QualifierHierarchyprotected Set<AnnotationMirror> findTops(Map<AnnotationMirror,Set<AnnotationMirror>> supertypes)
protected Set<AnnotationMirror> findBottoms(Map<AnnotationMirror,Set<AnnotationMirror>> supertypes)
protected Map<AnnotationMirror,Set<AnnotationMirror>> buildFullMap(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)
PolyNull for example):
1. a subtype of the top qualifier (e.g. Nullable)
2. a supertype of all the bottom qualifiers (e.g. NonNull)
Field supertypesMap is not set yet when this method is called - use fullMap instead.protected AnnotationMirror findLub(AnnotationMirror a1, AnnotationMirror a2)
a1 - first annotation mirrora2 - second annotation mirror