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 java.util.Set<javax.lang.model.element.AnnotationMirror> |
bottoms
The bottom qualifiers of the type hierarchies.
|
protected javax.lang.model.element.AnnotationMirror |
polymorphicQualifier
Reference to the special qualifier org.checkerframework.framework.qual.PolymorphicQualifier.
|
protected java.util.Map<javax.lang.model.element.AnnotationMirror,javax.lang.model.element.AnnotationMirror> |
polyQualifiers |
protected java.util.Map<javax.lang.model.element.AnnotationMirror,java.util.Set<javax.lang.model.element.AnnotationMirror>> |
supertypesGraph
The declared, direct supertypes for each qualifier, without added transitive relations.
|
protected java.util.Map<javax.lang.model.element.AnnotationMirror,java.util.Set<javax.lang.model.element.AnnotationMirror>> |
supertypesMap
The transitive closure of the supertypesGraph.
|
protected java.util.Set<javax.lang.model.element.AnnotationMirror> |
tops
The top qualifiers of the individual type hierarchies.
|
| Constructor and Description |
|---|
MultiGraphQualifierHierarchy(MultiGraphQualifierHierarchy.MultiGraphFactory f) |
MultiGraphQualifierHierarchy(MultiGraphQualifierHierarchy.MultiGraphFactory f,
java.lang.Object... args) |
| Modifier and Type | Method and Description |
|---|---|
protected void |
addPolyRelations(QualifierHierarchy qualHierarchy,
java.util.Map<javax.lang.model.element.AnnotationMirror,java.util.Set<javax.lang.model.element.AnnotationMirror>> fullMap,
java.util.Map<javax.lang.model.element.AnnotationMirror,javax.lang.model.element.AnnotationMirror> polyQualifiers,
java.util.Set<javax.lang.model.element.AnnotationMirror> tops,
java.util.Set<javax.lang.model.element.AnnotationMirror> bottoms)
Add the relationships for polymorphic qualifiers.
|
protected java.util.Map<javax.lang.model.element.AnnotationMirror,java.util.Set<javax.lang.model.element.AnnotationMirror>> |
buildFullMap(java.util.Map<javax.lang.model.element.AnnotationMirror,java.util.Set<javax.lang.model.element.AnnotationMirror>> supertypes)
Computes the transitive closure of the given map and returns it.
|
protected java.util.Set<javax.lang.model.element.AnnotationMirror> |
findBottoms(java.util.Map<javax.lang.model.element.AnnotationMirror,java.util.Set<javax.lang.model.element.AnnotationMirror>> supertypes)
Infer the bottoms of the subtype hierarchy.
|
protected javax.lang.model.element.AnnotationMirror |
findLub(javax.lang.model.element.AnnotationMirror a1,
javax.lang.model.element.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 java.util.Set<javax.lang.model.element.AnnotationMirror> |
findTops(java.util.Map<javax.lang.model.element.AnnotationMirror,java.util.Set<javax.lang.model.element.AnnotationMirror>> supertypes)
Infer the tops of the subtype hierarchy.
|
protected void |
finish(QualifierHierarchy qualHierarchy,
java.util.Map<javax.lang.model.element.AnnotationMirror,java.util.Set<javax.lang.model.element.AnnotationMirror>> fullMap,
java.util.Map<javax.lang.model.element.AnnotationMirror,javax.lang.model.element.AnnotationMirror> polyQualifiers,
java.util.Set<javax.lang.model.element.AnnotationMirror> tops,
java.util.Set<javax.lang.model.element.AnnotationMirror> bottoms,
java.lang.Object... args)
Method to finalize the qualifier hierarchy before it becomes unmodifiable.
|
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.
|
java.util.Set<? extends javax.lang.model.element.AnnotationMirror> |
getBottomAnnotations() |
javax.lang.model.element.AnnotationMirror |
getPolymorphicAnnotation(javax.lang.model.element.AnnotationMirror start) |
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.
|
java.util.Set<? extends javax.lang.model.element.AnnotationMirror> |
getTopAnnotations() |
java.util.Set<? extends javax.lang.model.element.AnnotationMirror> |
getTypeQualifiers()
Returns all type qualifiers in this type qualifier hierarchy.
|
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.
|
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(javax.lang.model.element.AnnotationMirror subAnno,
javax.lang.model.element.AnnotationMirror superAnno)
Tests whether rhs is equal to or a sub-qualifier of lhs, according to the type qualifier
hierarchy.
|
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.
|
boolean |
isSubtypeTypeVariable(javax.lang.model.element.AnnotationMirror subAnno,
javax.lang.model.element.AnnotationMirror superAnno)
Tests whether
subAnno is a sub-qualifier of superAnno, according to the type
qualifier hierarchy. |
boolean |
isSubtypeTypeVariable(java.util.Collection<? extends javax.lang.model.element.AnnotationMirror> subAnnos,
java.util.Collection<? extends javax.lang.model.element.AnnotationMirror> superAnnos)
Tests whether there is any annotation in superAnnos that is a super qualifier of some
annotation in subAnnos.
|
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.
|
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.
|
java.lang.String |
toString() |
canHaveEmptyAnnotationSet, findAnnotationInHierarchy, findAnnotationInSameHierarchy, getWidth, greatestLowerBound, greatestLowerBounds, greatestLowerBounds, greatestLowerBoundsTypeVariable, isSubtype, isSubtype, isValid, leastUpperBound, leastUpperBounds, leastUpperBounds, leastUpperBoundsTypeVariable, numberOfIterationsBeforeWidening, replacePolyAll, updateMappingToMutableSet, widenedUpperBoundprotected final java.util.Map<javax.lang.model.element.AnnotationMirror,java.util.Set<javax.lang.model.element.AnnotationMirror>> supertypesGraph
protected final java.util.Map<javax.lang.model.element.AnnotationMirror,java.util.Set<javax.lang.model.element.AnnotationMirror>> supertypesMap
protected final java.util.Set<javax.lang.model.element.AnnotationMirror> tops
protected final java.util.Set<javax.lang.model.element.AnnotationMirror> bottoms
protected final javax.lang.model.element.AnnotationMirror polymorphicQualifier
protected final java.util.Map<javax.lang.model.element.AnnotationMirror,javax.lang.model.element.AnnotationMirror> polyQualifiers
public MultiGraphQualifierHierarchy(MultiGraphQualifierHierarchy.MultiGraphFactory f)
public MultiGraphQualifierHierarchy(MultiGraphQualifierHierarchy.MultiGraphFactory f, java.lang.Object... args)
protected void finish(QualifierHierarchy qualHierarchy, java.util.Map<javax.lang.model.element.AnnotationMirror,java.util.Set<javax.lang.model.element.AnnotationMirror>> fullMap, java.util.Map<javax.lang.model.element.AnnotationMirror,javax.lang.model.element.AnnotationMirror> polyQualifiers, java.util.Set<javax.lang.model.element.AnnotationMirror> tops, java.util.Set<javax.lang.model.element.AnnotationMirror> bottoms, java.lang.Object... args)
@SideEffectFree public java.lang.String toString()
toString in class java.lang.Objectpublic java.util.Set<? extends javax.lang.model.element.AnnotationMirror> getTopAnnotations()
getTopAnnotations in class QualifierHierarchypublic javax.lang.model.element.AnnotationMirror getTopAnnotation(javax.lang.model.element.AnnotationMirror start)
QualifierHierarchygetTopAnnotation in class QualifierHierarchypublic java.util.Set<? extends javax.lang.model.element.AnnotationMirror> getBottomAnnotations()
getBottomAnnotations in class QualifierHierarchypublic javax.lang.model.element.AnnotationMirror getBottomAnnotation(javax.lang.model.element.AnnotationMirror start)
QualifierHierarchygetBottomAnnotation in class QualifierHierarchypublic javax.lang.model.element.AnnotationMirror getPolymorphicAnnotation(javax.lang.model.element.AnnotationMirror start)
getPolymorphicAnnotation in class QualifierHierarchystart - any qualifier from the type hierarchypublic boolean isSubtype(java.util.Collection<? extends javax.lang.model.element.AnnotationMirror> rhs,
java.util.Collection<? extends javax.lang.model.element.AnnotationMirror> lhs)
QualifierHierarchyisSubtype in class QualifierHierarchypublic boolean isSubtypeTypeVariable(java.util.Collection<? extends javax.lang.model.element.AnnotationMirror> subAnnos,
java.util.Collection<? extends javax.lang.model.element.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 java.util.Set<? extends javax.lang.model.element.AnnotationMirror> getTypeQualifiers()
QualifierHierarchygetTypeQualifiers in class QualifierHierarchypublic javax.lang.model.element.AnnotationMirror leastUpperBound(javax.lang.model.element.AnnotationMirror a1,
javax.lang.model.element.AnnotationMirror a2)
QualifierHierarchyExamples:
leastUpperBound in class QualifierHierarchypublic javax.lang.model.element.AnnotationMirror leastUpperBoundTypeVariable(javax.lang.model.element.AnnotationMirror a1,
javax.lang.model.element.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 javax.lang.model.element.AnnotationMirror greatestLowerBound(javax.lang.model.element.AnnotationMirror a1,
javax.lang.model.element.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 javax.lang.model.element.AnnotationMirror greatestLowerBoundTypeVariable(javax.lang.model.element.AnnotationMirror a1,
javax.lang.model.element.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(javax.lang.model.element.AnnotationMirror subAnno,
javax.lang.model.element.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(javax.lang.model.element.AnnotationMirror subAnno,
javax.lang.model.element.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 java.util.Set<javax.lang.model.element.AnnotationMirror> findTops(java.util.Map<javax.lang.model.element.AnnotationMirror,java.util.Set<javax.lang.model.element.AnnotationMirror>> supertypes)
protected java.util.Set<javax.lang.model.element.AnnotationMirror> findBottoms(java.util.Map<javax.lang.model.element.AnnotationMirror,java.util.Set<javax.lang.model.element.AnnotationMirror>> supertypes)
protected java.util.Map<javax.lang.model.element.AnnotationMirror,java.util.Set<javax.lang.model.element.AnnotationMirror>> buildFullMap(java.util.Map<javax.lang.model.element.AnnotationMirror,java.util.Set<javax.lang.model.element.AnnotationMirror>> supertypes)
protected void addPolyRelations(QualifierHierarchy qualHierarchy, java.util.Map<javax.lang.model.element.AnnotationMirror,java.util.Set<javax.lang.model.element.AnnotationMirror>> fullMap, java.util.Map<javax.lang.model.element.AnnotationMirror,javax.lang.model.element.AnnotationMirror> polyQualifiers, java.util.Set<javax.lang.model.element.AnnotationMirror> tops, java.util.Set<javax.lang.model.element.AnnotationMirror> bottoms)
A polymorphic qualifier, such as PolyNull, needs to be:
Nullable)
NonNull)
protected javax.lang.model.element.AnnotationMirror findLub(javax.lang.model.element.AnnotationMirror a1,
javax.lang.model.element.AnnotationMirror a2)
a1 - first annotation mirrora2 - second annotation mirror