Class UpperBoundAnnotatedTypeFactory.UpperBoundQualifierHierarchy
java.lang.Object
org.checkerframework.framework.type.ElementQualifierHierarchy
org.checkerframework.checker.index.upperbound.UpperBoundAnnotatedTypeFactory.UpperBoundQualifierHierarchy
- All Implemented Interfaces:
QualifierHierarchy
- Enclosing class:
- UpperBoundAnnotatedTypeFactory
protected final class UpperBoundAnnotatedTypeFactory.UpperBoundQualifierHierarchy
extends ElementQualifierHierarchy
The qualifier hierarchy for the upperbound type system.
-
Field Summary
Fields inherited from class org.checkerframework.framework.type.ElementQualifierHierarchy
bottoms, bottomsMap, kindToElementlessQualifier, qualifierKindHierarchy, tops, topsMap
-
Method Summary
Modifier and TypeMethodDescriptionReturns the greatest lower bound for the qualifiers qualifier1 and qualifier2.boolean
isSubtype
(AnnotationMirror subAnno, AnnotationMirror superAnno) Computes subtyping as per the subtyping in the qualifier hierarchy structure unless both annotations have the same class.Determines the least upper bound of a1 and a2.int
Returns the number of iterations dataflow should perform beforeQualifierHierarchy.widenedUpperBound(AnnotationMirror, AnnotationMirror)
is called or -1 if it should never be called.widenedUpperBound
(AnnotationMirror newQualifier, AnnotationMirror previousQualifier) If the qualifier hierarchy has an infinite ascending chain, then the dataflow analysis might never reach a fixed point.Methods inherited from class org.checkerframework.framework.type.ElementQualifierHierarchy
createBottomsMap, createElementlessQualifierMap, createQualifierKindHierarchy, createTopsMap, findAnnotationInHierarchy, findAnnotationInSameHierarchy, getBottomAnnotation, getBottomAnnotations, getPolymorphicAnnotation, getQualifierKind, getQualifierKind, getTopAnnotation, getTopAnnotations, isPolymorphicQualifier, isValid
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
Methods inherited from interface org.checkerframework.framework.type.QualifierHierarchy
getWidth, greatestLowerBounds, isSubtype, leastUpperBounds, updateMappingToMutableSet
-
Method Details
-
greatestLowerBound
Description copied from interface:QualifierHierarchy
Returns the greatest lower bound for the qualifiers qualifier1 and qualifier2. Returns null if the qualifiers are not from the same qualifier hierarchy.- Parameters:
a1
- first qualifiera2
- second qualifier- Returns:
- greatest lower bound of the two annotations or null if the two annotations are not from the same hierarchy
-
leastUpperBound
Determines the least upper bound of a1 and a2. If a1 and a2 are both the same type of Value annotation, then the LUB is the result of taking the intersection of values from both a1 and a2.- Parameters:
a1
- the first qualifier; may not be in the same hierarchy asqualifier2
a2
- the second qualifier; may not be in the same hierarchy asqualifier1
- Returns:
- the least upper bound of a1 and a2
-
widenedUpperBound
public AnnotationMirror widenedUpperBound(AnnotationMirror newQualifier, AnnotationMirror previousQualifier) Description copied from interface:QualifierHierarchy
If the qualifier hierarchy has an infinite ascending chain, then the dataflow analysis might never reach a fixed point. To prevent this, implement this method such that it returns an upper bound for the two qualifiers that is a strict super type of the least upper bound. If this method is implemented, also overrideQualifierHierarchy.numberOfIterationsBeforeWidening()
to return a positive number.newQualifier
is newest qualifier dataflow computed for some expression andpreviousQualifier
is the qualifier dataflow computed on the last iteration.If the qualifier hierarchy has no infinite ascending chain, returns the least upper bound of the two annotations.
- Parameters:
newQualifier
- new qualifier dataflow computed for some expression; must be in the same hierarchy aspreviousQualifier
previousQualifier
- the previous qualifier dataflow computed on the last iteration; must be in the same hierarchy aspreviousQualifier
- Returns:
- an upper bound that is higher than the least upper bound of newQualifier and previousQualifier (or the lub if the qualifier hierarchy does not require this)
-
numberOfIterationsBeforeWidening
public int numberOfIterationsBeforeWidening()Description copied from interface:QualifierHierarchy
Returns the number of iterations dataflow should perform beforeQualifierHierarchy.widenedUpperBound(AnnotationMirror, AnnotationMirror)
is called or -1 if it should never be called.- Returns:
- the number of iterations dataflow should perform before
QualifierHierarchy.widenedUpperBound(AnnotationMirror, AnnotationMirror)
is called or -1 if it should never be called.
-
isSubtype
Computes subtyping as per the subtyping in the qualifier hierarchy structure unless both annotations have the same class. In this case, rhs is a subtype of lhs iff rhs contains every element of lhs.- Parameters:
subAnno
- possible subqualifier ofsuperQualifier
superAnno
- possible superqualifier ofsubQualifier
- Returns:
- true if rhs is a subtype of lhs, false otherwise
-