public class MultiGraphQualifierHierarchy extends @Nullable 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<@Nullable AnnotationMirror> |
bottoms
The bottom qualifiers of the type hierarchies.
|
protected Map<@Nullable AnnotationMirror,@Nullable AnnotationMirror> |
polyQualifiers |
protected Map<@Nullable AnnotationMirror,Set<@Nullable AnnotationMirror>> |
supertypesGraph
The declared, direct supertypes for each qualifier, without added
transitive relations.
|
protected Map<@Nullable AnnotationMirror,Set<@Nullable AnnotationMirror>> |
supertypesMap
The transitive closure of the supertypesGraph.
|
protected Set<@Nullable AnnotationMirror> |
tops
The top qualifiers of the individual type hierarchies.
|
checker
Modifier | Constructor and Description |
---|---|
protected |
MultiGraphQualifierHierarchy(MultiGraphQualifierHierarchy.MultiGraphFactory f) |
protected |
MultiGraphQualifierHierarchy(MultiGraphQualifierHierarchy h) |
Modifier and Type | Method and Description |
---|---|
protected static void |
addPolyRelations(SourceChecker checker,
AnnotationUtils annoFactory,
@Nullable QualifierHierarchy qualHierarchy,
Map<@Nullable AnnotationMirror,Set<@Nullable AnnotationMirror>> fullMap,
Map<@Nullable AnnotationMirror,@Nullable AnnotationMirror> polyQualifiers,
Set<@Nullable AnnotationMirror> tops,
Set<@Nullable AnnotationMirror> bottoms)
Add the relationships for polymorphic qualifiers.
|
protected static Map<@Nullable AnnotationMirror,Set<@Nullable AnnotationMirror>> |
buildFullMap(Map<@Nullable AnnotationMirror,Set<@Nullable AnnotationMirror>> supertypes)
Computes the transitive closure of the given map and returns it.
|
protected static Set<@Nullable AnnotationMirror> |
findBottoms(Map<@Nullable AnnotationMirror,Set<@Nullable AnnotationMirror>> supertypes)
Infer the bottoms of the subtype hierarchy.
|
protected static Set<@Nullable AnnotationMirror> |
findTops(Map<@Nullable AnnotationMirror,Set<@Nullable AnnotationMirror>> supertypes)
Infer the tops of the subtype hierarchy.
|
@Nullable AnnotationMirror |
getBottomAnnotation(@Nullable 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<@Nullable AnnotationMirror> |
getBottomAnnotations() |
@Nullable AnnotationMirror |
getTopAnnotation(@Nullable 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<@Nullable AnnotationMirror> |
getTopAnnotations() |
Set<@Nullable Name> |
getTypeQualifiers()
Returns the names of all type qualifiers in this type qualifier
hierarchy.
|
@Nullable AnnotationMirror |
greatestLowerBound(@Nullable AnnotationMirror a1,
@Nullable AnnotationMirror a2)
Returns the greatest lower bound for the qualifiers a1 and a2.
|
boolean |
isSubtype(@Nullable AnnotationMirror anno1,
@Nullable AnnotationMirror anno2)
Most qualifiers have no value fields.
|
boolean |
isSubtype(Collection<@Nullable AnnotationMirror> rhs,
Collection<@Nullable AnnotationMirror> lhs)
Tests whether there is any annotation in lhs that is a super qualifier
of some annotation in rhs.
|
@Nullable AnnotationMirror |
leastUpperBound(@Nullable AnnotationMirror a1,
@Nullable AnnotationMirror a2)
Returns the least upper bound for the qualifiers a1 and a2.
|
@ReadOnly String |
toString() |
greatestLowerBounds, leastUpperBounds
protected final Map<@Nullable AnnotationMirror,Set<@Nullable AnnotationMirror>> supertypesGraph
protected final Map<@Nullable AnnotationMirror,Set<@Nullable AnnotationMirror>> supertypesMap
protected final Set<@Nullable AnnotationMirror> tops
protected final Set<@Nullable AnnotationMirror> bottoms
protected final Map<@Nullable AnnotationMirror,@Nullable AnnotationMirror> polyQualifiers
protected MultiGraphQualifierHierarchy(MultiGraphQualifierHierarchy.MultiGraphFactory f)
protected MultiGraphQualifierHierarchy(MultiGraphQualifierHierarchy h)
public Set<@Nullable AnnotationMirror> getTopAnnotations()
getTopAnnotations
in class @Nullable QualifierHierarchy
public @Nullable AnnotationMirror getTopAnnotation(@Nullable AnnotationMirror start)
QualifierHierarchy
getTopAnnotation
in class @Nullable QualifierHierarchy
public @Nullable AnnotationMirror getBottomAnnotation(@Nullable AnnotationMirror start)
QualifierHierarchy
getBottomAnnotation
in class @Nullable QualifierHierarchy
public Set<@Nullable AnnotationMirror> getBottomAnnotations()
getBottomAnnotations
in class @Nullable QualifierHierarchy
public boolean isSubtype(Collection<@Nullable AnnotationMirror> rhs, Collection<@Nullable AnnotationMirror> lhs)
QualifierHierarchy
isSubtype
in class @Nullable QualifierHierarchy
public Set<@Nullable Name> getTypeQualifiers()
QualifierHierarchy
BaseTypeChecker.getSupportedTypeQualifiers()
?getTypeQualifiers
in class @Nullable QualifierHierarchy
public @Nullable AnnotationMirror leastUpperBound(@Nullable AnnotationMirror a1, @Nullable AnnotationMirror a2)
QualifierHierarchy
leastUpperBound
in class @Nullable QualifierHierarchy
public @Nullable AnnotationMirror greatestLowerBound(@Nullable AnnotationMirror a1, @Nullable AnnotationMirror a2)
QualifierHierarchy
greatestLowerBound
in class @Nullable QualifierHierarchy
a1
- First annotationa2
- Second annotationpublic boolean isSubtype(@Nullable AnnotationMirror anno1, @Nullable AnnotationMirror anno2)
@I
.isSubtype
in class @Nullable QualifierHierarchy
protected static Set<@Nullable AnnotationMirror> findTops(Map<@Nullable AnnotationMirror,Set<@Nullable AnnotationMirror>> supertypes)
protected static Set<@Nullable AnnotationMirror> findBottoms(Map<@Nullable AnnotationMirror,Set<@Nullable AnnotationMirror>> supertypes)
protected static Map<@Nullable AnnotationMirror,Set<@Nullable AnnotationMirror>> buildFullMap(Map<@Nullable AnnotationMirror,Set<@Nullable AnnotationMirror>> supertypes)
protected static void addPolyRelations(SourceChecker checker, AnnotationUtils annoFactory, @Nullable QualifierHierarchy qualHierarchy, Map<@Nullable AnnotationMirror,Set<@Nullable AnnotationMirror>> fullMap, Map<@Nullable AnnotationMirror,@Nullable AnnotationMirror> polyQualifiers, Set<@Nullable AnnotationMirror> tops, Set<@Nullable 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.