ElementQualifierHierarchy
, MostlyNoElementQualifierHierarchy
, or
NoElementQualifierHierarchy
instead. This class will be removed in a future release.
Here are instructions on how to convert from a subclass of MultiGraphQualifierHierarchy to the new implementations:
If the subclass implements isSubtype and calls super when annotations do not have
elements, then use the following instructions to convert to MostlyNoElementQualifierHierarchy
.
extends MultiGraphQualifierHierarchy
to extends
MostlyNoElementQualifierHierarchy
.
If the subclass implements isSubtype and does not call super in that implementation, then
use the following instructions to convert to a subclass of ElementQualifierHierarchy
.
extends MultiGraphQualifierHierarchy
to extends
ElementQualifierHierarchy
.
leastUpperBound(AnnotationMirror, AnnotationMirror)
and greatestLowerBound(AnnotationMirror, AnnotationMirror)
if missing. (In the past, it
was very easy to forget to implement these, now they are abstract methods.)
MultiGraphQualifierHierarchy
or GraphQualifierHierarchy
, you may do so by adding the following to AnnotatedTypeFactory.
(It's better to convert to one of the new classes because MultiGraphQualifierHierarchy and
GraphQualifierHierarchy are buggy and no longer supported.)
If any qualifier has an annotation element without a default value, you will need to convert to one of the new subclasses. If you do not, then MultiGraphQualifierHierarchy will throw an exception with a message like "AnnotationBuilder.fromName: no value for element value() of checkers.inference.qual.VarAnnot".
@Override
@SuppressWarnings("deprecation")
public QualifierHierarchy createQualifierHierarchy() { return org.checkerframework.framework.util.MultiGraphQualifierHierarchy .createMultiGraphQualifierHierarchy(this); }
@Override
@SuppressWarnings("deprecation")
public QualifierHierarchy createQualifierHierarchyWithMultiGraphFactory( org.checkerframework.framework.util.MultiGraphQualifierHierarchy.MultiGraphFactory factory) { return new YourSubclassQualifierHierarchy(factory); }
@Deprecated public class MultiGraphQualifierHierarchy extends Object implements QualifierHierarchy
This class is immutable and can be only created through MultiGraphQualifierHierarchy.MultiGraphFactory
.
Modifier and Type | Class and Description |
---|---|
static class |
MultiGraphQualifierHierarchy.MultiGraphFactory
Deprecated.
Use
ElementQualifierHierarchy instead. |
Modifier and Type | Field and Description |
---|---|
protected Set<AnnotationMirror> |
bottoms
Deprecated.
The bottom qualifiers of the type hierarchies.
|
protected Map<AnnotationMirror,AnnotationMirror> |
polyQualifiers
Deprecated.
|
protected Map<AnnotationMirror,Set<AnnotationMirror>> |
supertypesDirect
Deprecated.
The declared, direct supertypes for each qualifier, without added transitive relations.
|
protected Map<AnnotationMirror,Set<AnnotationMirror>> |
supertypesTransitive
Deprecated.
The transitive closure of the supertypesDirect.
|
protected Set<AnnotationMirror> |
tops
Deprecated.
The top qualifiers of the individual type hierarchies.
|
Constructor and Description |
---|
MultiGraphQualifierHierarchy(MultiGraphQualifierHierarchy.MultiGraphFactory f)
Deprecated.
|
MultiGraphQualifierHierarchy(MultiGraphQualifierHierarchy.MultiGraphFactory f,
Object... args)
Deprecated.
|
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)
Deprecated.
Add the relationships for polymorphic qualifiers.
|
static QualifierHierarchy |
createMultiGraphQualifierHierarchy(AnnotatedTypeFactory annotatedTypeFactory)
Deprecated.
Use
ElementQualifierHierarchy instead. |
protected Set<AnnotationMirror> |
findBottoms(Map<AnnotationMirror,Set<AnnotationMirror>> supertypes)
Deprecated.
Infer the bottoms of the subtype hierarchy.
|
protected AnnotationMirror |
findLub(AnnotationMirror a1,
AnnotationMirror a2)
Deprecated.
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)
Deprecated.
Infer the tops of the subtype hierarchy.
|
protected void |
finish(QualifierHierarchy qualHierarchy,
Map<AnnotationMirror,Set<AnnotationMirror>> supertypesTransitive,
Map<AnnotationMirror,AnnotationMirror> polyQualifiers,
Set<AnnotationMirror> tops,
Set<AnnotationMirror> bottoms,
Object... args)
Deprecated.
Method to finalize the qualifier hierarchy before it becomes unmodifiable.
|
AnnotationMirror |
getBottomAnnotation(AnnotationMirror start)
Deprecated.
Return the bottom for the given qualifier, that is, the qualifier that is a subtype of
qualifier but no further subtypes exist. |
Set<? extends AnnotationMirror> |
getBottomAnnotations()
Deprecated.
Returns the bottom type qualifiers in the hierarchy.
|
AnnotationMirror |
getPolymorphicAnnotation(AnnotationMirror start)
Deprecated.
Returns the polymorphic qualifier for the hierarchy containing
qualifier , or null if there is no polymorphic qualifier in that hierarchy. |
AnnotationMirror |
getTopAnnotation(AnnotationMirror start)
Deprecated.
Return the top qualifier for the given qualifier, that is, the qualifier that is a supertype of
qualifier but no further supertypes exist. |
Set<? extends AnnotationMirror> |
getTopAnnotations()
Deprecated.
Returns the top (ultimate super) type qualifiers in the type system.
|
AnnotationMirror |
greatestLowerBound(AnnotationMirror a1,
AnnotationMirror a2)
Deprecated.
Returns the greatest lower bound for the qualifiers qualifier1 and qualifier2.
|
boolean |
isPolymorphicQualifier(AnnotationMirror qual)
Deprecated.
Returns
true if the qualifier is a polymorphic qualifier; otherwise, returns false . |
boolean |
isSubtype(AnnotationMirror subAnno,
AnnotationMirror superAnno)
Deprecated.
Tests whether
subQualifier is equal to or a sub-qualifier of superQualifier ,
according to the type qualifier hierarchy. |
boolean |
isSubtype(Collection<? extends AnnotationMirror> rhs,
Collection<? extends AnnotationMirror> lhs)
Deprecated.
Tests whether all qualifiers in
subQualifiers are a subqualifier or equal to the
qualifier in the same hierarchy in superQualifiers . |
boolean |
isValid()
Deprecated.
Determine whether this is valid.
|
AnnotationMirror |
leastUpperBound(AnnotationMirror a1,
AnnotationMirror a2)
Deprecated.
Returns the least upper bound (LUB) of the qualifiers
qualifier1 and qualifier2 . |
String |
toString()
Deprecated.
|
protected Map<AnnotationMirror,Set<AnnotationMirror>> |
transitiveClosure(Map<AnnotationMirror,Set<AnnotationMirror>> supertypes)
Deprecated.
Computes the transitive closure of the given map and returns it.
|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
assertSameSize, assertSameSize, canHaveEmptyAnnotationSet, findAnnotationInHierarchy, findAnnotationInSameHierarchy, getWidth, greatestLowerBound, greatestLowerBounds, greatestLowerBounds, greatestLowerBoundsTypeVariable, greatestLowerBoundTypeVariable, isSubtype, isSubtype, isSubtypeTypeVariable, isSubtypeTypeVariable, leastUpperBound, leastUpperBounds, leastUpperBounds, leastUpperBoundsTypeVariable, leastUpperBoundTypeVariable, numberOfIterationsBeforeWidening, updateMappingToMutableSet, widenedUpperBound
protected final Map<AnnotationMirror,Set<AnnotationMirror>> supertypesDirect
protected final Map<AnnotationMirror,Set<AnnotationMirror>> supertypesTransitive
protected final Set<AnnotationMirror> tops
protected final Set<AnnotationMirror> bottoms
protected final Map<AnnotationMirror,AnnotationMirror> polyQualifiers
public MultiGraphQualifierHierarchy(MultiGraphQualifierHierarchy.MultiGraphFactory f)
public MultiGraphQualifierHierarchy(MultiGraphQualifierHierarchy.MultiGraphFactory f, Object... args)
@Deprecated public static QualifierHierarchy createMultiGraphQualifierHierarchy(AnnotatedTypeFactory annotatedTypeFactory)
ElementQualifierHierarchy
instead.MultiGraphQualifierHierarchy
annotatedTypeFactory
- annotated type factorypublic boolean isValid()
QualifierHierarchy
isValid
in interface QualifierHierarchy
protected void finish(QualifierHierarchy qualHierarchy, Map<AnnotationMirror,Set<AnnotationMirror>> supertypesTransitive, Map<AnnotationMirror,AnnotationMirror> polyQualifiers, Set<AnnotationMirror> tops, Set<AnnotationMirror> bottoms, Object... args)
@SideEffectFree public String toString()
public Set<? extends AnnotationMirror> getTopAnnotations()
QualifierHierarchy
QualifierHierarchy.getWidth()
.getTopAnnotations
in interface QualifierHierarchy
public AnnotationMirror getTopAnnotation(AnnotationMirror start)
QualifierHierarchy
qualifier
but no further supertypes exist.getTopAnnotation
in interface QualifierHierarchy
start
- any qualifier from one of the qualifier hierarchies represented by thisqualifier
's hierarchypublic Set<? extends AnnotationMirror> getBottomAnnotations()
QualifierHierarchy
QualifierHierarchy.getWidth()
.getBottomAnnotations
in interface QualifierHierarchy
public AnnotationMirror getBottomAnnotation(AnnotationMirror start)
QualifierHierarchy
qualifier
but no further subtypes exist.getBottomAnnotation
in interface QualifierHierarchy
start
- any qualifier from one of the qualifier hierarchies represented by thisqualifier
's hierarchypublic AnnotationMirror getPolymorphicAnnotation(AnnotationMirror start)
QualifierHierarchy
qualifier
, or null
if there is no polymorphic qualifier in that hierarchy.getPolymorphicAnnotation
in interface QualifierHierarchy
start
- any qualifier from one of the qualifier hierarchies represented by thisqualifier
, or null
if there is no polymorphic qualifier in that hierarchypublic boolean isSubtype(Collection<? extends AnnotationMirror> rhs, Collection<? extends AnnotationMirror> lhs)
QualifierHierarchy
subQualifiers
are a subqualifier or equal to the
qualifier in the same hierarchy in superQualifiers
.isSubtype
in interface QualifierHierarchy
rhs
- set of qualifiers; exactly one per hierarchylhs
- set of qualifiers; exactly one per hierarchysubQualifiers
are a subqualifier or equal to the
qualifier in the same hierarchy in superQualifiers
public AnnotationMirror leastUpperBound(AnnotationMirror a1, AnnotationMirror a2)
QualifierHierarchy
qualifier1
and qualifier2
. Returns null
if the qualifiers are not from the same qualifier hierarchy.
Examples:
leastUpperBound
in interface QualifierHierarchy
a1
- the first qualifier; may not be in the same hierarchy as qualifier2
a2
- the second qualifier; may not be in the same hierarchy as qualifier1
null
if the qualifiers are from
different hierarchiespublic AnnotationMirror greatestLowerBound(AnnotationMirror a1, AnnotationMirror a2)
QualifierHierarchy
greatestLowerBound
in interface QualifierHierarchy
a1
- first qualifiera2
- second qualifierpublic boolean isSubtype(AnnotationMirror subAnno, AnnotationMirror superAnno)
subQualifier
is equal to or a sub-qualifier of superQualifier
,
according to the type qualifier hierarchy.
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 interface QualifierHierarchy
subAnno
- the sub qualifiersuperAnno
- the super qualifiersubQualifier
is a subqualifier of, or equal to, superQualifier
protected Set<AnnotationMirror> findTops(Map<AnnotationMirror,Set<AnnotationMirror>> supertypes)
protected Set<AnnotationMirror> findBottoms(Map<AnnotationMirror,Set<AnnotationMirror>> supertypes)
protected Map<AnnotationMirror,Set<AnnotationMirror>> transitiveClosure(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)
A polymorphic qualifier, such as PolyNull
, needs to be:
Nullable
)
NonNull
)
protected AnnotationMirror findLub(AnnotationMirror a1, AnnotationMirror a2)
a1
- first annotation mirrora2
- second annotation mirrorpublic boolean isPolymorphicQualifier(AnnotationMirror qual)
QualifierHierarchy
true
if the qualifier is a polymorphic qualifier; otherwise, returns false
.isPolymorphicQualifier
in interface QualifierHierarchy
qual
- qualifiertrue
if the qualifier is a polymorphic qualifier; otherwise, returns false
.