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 Elements |
elements
Element utilities to use.
|
protected AnnotationMirror |
polymorphicQualifier
Reference to the special qualifier checkers.quals.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.
|
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 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<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<AnnotationMirror> |
getTopAnnotations() |
Set<Name> |
getTypeQualifiers()
Returns the names of 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.
|
boolean |
isSubtype(AnnotationMirror anno1,
AnnotationMirror anno2)
Most qualifiers have no value fields.
|
boolean |
isSubtype(Collection<AnnotationMirror> rhs,
Collection<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.
|
String |
toString() |
findCorrespondingAnnotation, greatestLowerBounds, leastUpperBounds
protected final Map<AnnotationMirror,Set<AnnotationMirror>> supertypesGraph
protected final Map<AnnotationMirror,Set<AnnotationMirror>> supertypesMap
protected final Elements elements
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)
public Set<AnnotationMirror> getTopAnnotations()
getTopAnnotations
in class QualifierHierarchy
public AnnotationMirror getTopAnnotation(AnnotationMirror start)
QualifierHierarchy
getTopAnnotation
in class QualifierHierarchy
public AnnotationMirror getBottomAnnotation(AnnotationMirror start)
QualifierHierarchy
getBottomAnnotation
in class QualifierHierarchy
public Set<AnnotationMirror> getBottomAnnotations()
getBottomAnnotations
in class QualifierHierarchy
public AnnotationMirror getPolymorphicAnnotation(AnnotationMirror start)
getPolymorphicAnnotation
in class QualifierHierarchy
start
- Any qualifier from the type hierarchy.public boolean isSubtype(Collection<AnnotationMirror> rhs, Collection<AnnotationMirror> lhs)
QualifierHierarchy
isSubtype
in class QualifierHierarchy
public Set<Name> getTypeQualifiers()
QualifierHierarchy
BaseTypeChecker.getSupportedTypeQualifiers()
?getTypeQualifiers
in class QualifierHierarchy
public AnnotationMirror leastUpperBound(AnnotationMirror a1, AnnotationMirror a2)
QualifierHierarchy
leastUpperBound
in class QualifierHierarchy
public AnnotationMirror greatestLowerBound(AnnotationMirror a1, AnnotationMirror a2)
QualifierHierarchy
greatestLowerBound
in class QualifierHierarchy
a1
- First annotationa2
- Second annotationpublic boolean isSubtype(AnnotationMirror anno1, AnnotationMirror anno2)
@I
.isSubtype
in class QualifierHierarchy
protected 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.