protected class AccumulationAnnotatedTypeFactory.AccumulationQualifierHierarchy extends MultiGraphQualifierHierarchy
acc() / \ acc(x) acc(y) ... \ / acc(x,y) ... | bottomPredicate subtyping is defined as follows:
Acc(A)
is a subtype of AccPred("A || B")
, because when A is replaced with true
and B is replaced with
false
, the resulting boolean formula evaluates to true.
AccumulationAnnotatedTypeFactory.isPredicateSubtype(String, String)
) is provided to allow more complex
subtyping behavior between predicates. (The "correct" subtyping rule is that P is a
subtype of Q iff P implies Q. That rule would require an SMT solver in the general
case, which is undesirable because it would require an external dependency. A user can
override AccumulationAnnotatedTypeFactory.isPredicateSubtype(String, String)
if they require more precise
subtyping; the check described here is overly conservative (and therefore sound), but
not very precise.)
MultiGraphQualifierHierarchy.MultiGraphFactory
bottoms, polyQualifiers, supertypesDirect, supertypesTransitive, tops
Constructor and Description |
---|
AccumulationQualifierHierarchy(MultiGraphQualifierHierarchy.MultiGraphFactory factory)
Create the qualifier hierarchy.
|
Modifier and Type | Method and Description |
---|---|
AnnotationMirror |
getTopAnnotation(AnnotationMirror start)
Return the top qualifier for the given qualifier, that is, the qualifier that is a supertype
of
qualifier but no further supertypes exist. |
AnnotationMirror |
greatestLowerBound(AnnotationMirror a1,
AnnotationMirror a2)
GLB in this type system is set union of the arguments of the two annotations, unless one
of them is bottom, in which case the result is also bottom.
|
boolean |
isSubtype(AnnotationMirror subAnno,
AnnotationMirror superAnno)
isSubtype in this type system is subset.
|
AnnotationMirror |
leastUpperBound(AnnotationMirror a1,
AnnotationMirror a2)
LUB in this type system is set intersection of the arguments of the two annotations,
unless one of them is bottom, in which case the result is the other annotation.
|
addPolyRelations, findBottoms, findLub, findTops, finish, getBottomAnnotation, getBottomAnnotations, getPolymorphicAnnotation, getTopAnnotations, isPolymorphicQualifier, isSubtype, isValid, toString, transitiveClosure
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
public AccumulationQualifierHierarchy(MultiGraphQualifierHierarchy.MultiGraphFactory factory)
factory
- the factorypublic AnnotationMirror getTopAnnotation(AnnotationMirror start)
QualifierHierarchy
qualifier
but no further supertypes exist.getTopAnnotation
in interface QualifierHierarchy
getTopAnnotation
in class MultiGraphQualifierHierarchy
start
- any qualifier from one of the qualifier hierarchies represented by thisqualifier
's hierarchypublic AnnotationMirror greatestLowerBound(AnnotationMirror a1, AnnotationMirror a2)
greatestLowerBound
in interface QualifierHierarchy
greatestLowerBound
in class MultiGraphQualifierHierarchy
a1
- first qualifiera2
- second qualifierpublic AnnotationMirror leastUpperBound(AnnotationMirror a1, AnnotationMirror a2)
leastUpperBound
in interface QualifierHierarchy
leastUpperBound
in class MultiGraphQualifierHierarchy
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 boolean isSubtype(AnnotationMirror subAnno, AnnotationMirror superAnno)
isSubtype
in interface QualifierHierarchy
isSubtype
in class MultiGraphQualifierHierarchy
subAnno
- the sub qualifiersuperAnno
- the super qualifiersubQualifier
is a subqualifier of, or equal to, superQualifier