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 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.
|
protected java.util.Set<java.lang.String> |
typeQualifiers |
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 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 rhs,
javax.lang.model.element.AnnotationMirror lhs)
Most qualifiers have no value fields.
|
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 rhs,
javax.lang.model.element.AnnotationMirror lhs)
Tests whether anno1 is a sub-qualifier of anno2, according to the
type qualifier hierarchy.
|
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.
|
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, findCorrespondingAnnotation, getAnnotationInHierarchy, getWidth, greatestLowerBound, greatestLowerBounds, greatestLowerBounds, greatestLowerBoundsTypeVariable, isSubtype, isSubtype, isValid, leastUpperBound, leastUpperBounds, leastUpperBounds, leastUpperBoundsTypeVariable, updateMappingToMutableSet
protected 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
protected java.util.Set<java.lang.String> typeQualifiers
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.Object
public java.util.Set<? extends javax.lang.model.element.AnnotationMirror> getTopAnnotations()
getTopAnnotations
in class QualifierHierarchy
public javax.lang.model.element.AnnotationMirror getTopAnnotation(javax.lang.model.element.AnnotationMirror start)
QualifierHierarchy
getTopAnnotation
in class QualifierHierarchy
public java.util.Set<? extends javax.lang.model.element.AnnotationMirror> getBottomAnnotations()
getBottomAnnotations
in class QualifierHierarchy
public javax.lang.model.element.AnnotationMirror getBottomAnnotation(javax.lang.model.element.AnnotationMirror start)
QualifierHierarchy
getBottomAnnotation
in class QualifierHierarchy
public javax.lang.model.element.AnnotationMirror getPolymorphicAnnotation(javax.lang.model.element.AnnotationMirror start)
getPolymorphicAnnotation
in class QualifierHierarchy
start
- Any qualifier from the type hierarchy.public boolean isSubtype(java.util.Collection<? extends javax.lang.model.element.AnnotationMirror> rhs, java.util.Collection<? extends javax.lang.model.element.AnnotationMirror> lhs)
QualifierHierarchy
isSubtype
in class QualifierHierarchy
public boolean isSubtypeTypeVariable(java.util.Collection<? extends javax.lang.model.element.AnnotationMirror> rhs, java.util.Collection<? extends javax.lang.model.element.AnnotationMirror> lhs)
QualifierHierarchy
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 QualifierHierarchy
public java.util.Set<? extends javax.lang.model.element.AnnotationMirror> getTypeQualifiers()
QualifierHierarchy
getTypeQualifiers
in class QualifierHierarchy
public javax.lang.model.element.AnnotationMirror leastUpperBound(javax.lang.model.element.AnnotationMirror a1, javax.lang.model.element.AnnotationMirror a2)
QualifierHierarchy
Examples:
leastUpperBound
in class QualifierHierarchy
public javax.lang.model.element.AnnotationMirror leastUpperBoundTypeVariable(javax.lang.model.element.AnnotationMirror a1, javax.lang.model.element.AnnotationMirror a2)
QualifierHierarchy
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).
leastUpperBoundTypeVariable
in class QualifierHierarchy
public javax.lang.model.element.AnnotationMirror greatestLowerBound(javax.lang.model.element.AnnotationMirror a1, javax.lang.model.element.AnnotationMirror a2)
QualifierHierarchy
greatestLowerBound
in class QualifierHierarchy
a1
- First annotationa2
- Second annotationpublic javax.lang.model.element.AnnotationMirror greatestLowerBoundTypeVariable(javax.lang.model.element.AnnotationMirror a1, javax.lang.model.element.AnnotationMirror a2)
QualifierHierarchy
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 QualifierHierarchy
a1
- First annotationa2
- Second annotationpublic boolean isSubtype(javax.lang.model.element.AnnotationMirror rhs, javax.lang.model.element.AnnotationMirror lhs)
@I
.isSubtype
in class QualifierHierarchy
rhs
- The right-hand side, i.e. the sub qualifierlhs
- The left-hand side, i.e. the super qualifierpublic boolean isSubtypeTypeVariable(javax.lang.model.element.AnnotationMirror rhs, javax.lang.model.element.AnnotationMirror lhs)
QualifierHierarchy
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 QualifierHierarchy
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)
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)
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.