Class UpperBoundAnnotatedTypeFactory.UpperBoundQualifierHierarchy
- Enclosing class:
UpperBoundAnnotatedTypeFactory
-
Field Summary
Fields inherited from class org.checkerframework.framework.type.ElementQualifierHierarchy
bottoms, bottomsMap, kindToElementlessQualifier, qualifierKindHierarchy, tops, topsMapFields inherited from class org.checkerframework.framework.type.QualifierHierarchy
atypeFactory -
Method Summary
Modifier and TypeMethodDescriptionReturns the greatest lower bound for the qualifiers qualifier1 and qualifier2.booleanisSubtypeQualifiers(AnnotationMirror subAnno, AnnotationMirror superAnno) Returns true ifsubQualifieris equal to or a sub-qualifier ofsuperQualifier, according to the type qualifier hierarchy, ignoring Java basetypes.Determines the least upper bound of a1 and a2.intReturns 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, isValidMethods inherited from class org.checkerframework.framework.type.QualifierHierarchy
assertSameSize, assertSameSize, canHaveEmptyAnnotationSet, getWidth, greatestLowerBoundQualifiersOnly, greatestLowerBoundShallow, greatestLowerBoundsQualifiersOnly, greatestLowerBoundsQualifiersOnly, greatestLowerBoundsShallow, isSubtypeQualifiersOnly, isSubtypeQualifiersOnly, isSubtypeShallow, isSubtypeShallow, isSubtypeShallow, isSubtypeShallow, isTop, leastUpperBoundQualifiersOnly, leastUpperBoundShallow, leastUpperBoundsQualifiersOnly, leastUpperBoundsQualifiersOnly, leastUpperBoundsShallow, updateMappingToMutableSet
-
Method Details
-
greatestLowerBoundQualifiers
Description copied from class:QualifierHierarchyReturns the greatest lower bound for the qualifiers qualifier1 and qualifier2. Returns null if the qualifiers are not from the same qualifier hierarchy.- Specified by:
greatestLowerBoundQualifiersin classQualifierHierarchy- 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
-
leastUpperBoundQualifiers
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.- Specified by:
leastUpperBoundQualifiersin classQualifierHierarchy- Parameters:
a1- the first qualifier; may not be in the same hierarchy asqualifier2a2- 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 class:QualifierHierarchyIf 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.newQualifieris newest qualifier dataflow computed for some expression andpreviousQualifieris 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.
- Overrides:
widenedUpperBoundin classQualifierHierarchy- Parameters:
newQualifier- new qualifier dataflow computed for some expression; must be in the same hierarchy aspreviousQualifierpreviousQualifier- 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 class:QualifierHierarchyReturns the number of iterations dataflow should perform beforeQualifierHierarchy.widenedUpperBound(AnnotationMirror, AnnotationMirror)is called or -1 if it should never be called.- Overrides:
numberOfIterationsBeforeWideningin classQualifierHierarchy- Returns:
- the number of iterations dataflow should perform before
QualifierHierarchy.widenedUpperBound(AnnotationMirror, AnnotationMirror)is called or -1 if it should never be called.
-
isSubtypeQualifiers
Returns true ifsubQualifieris equal to or a sub-qualifier ofsuperQualifier, according to the type qualifier hierarchy, ignoring Java basetypes.Clients should generally call
QualifierHierarchy.isSubtypeShallow(javax.lang.model.element.AnnotationMirror, javax.lang.model.type.TypeMirror, javax.lang.model.element.AnnotationMirror, javax.lang.model.type.TypeMirror). However, subtypes should generally override this method (if needed).This method behaves the same as
QualifierHierarchy.isSubtypeQualifiersOnly(AnnotationMirror, AnnotationMirror), which calls this method. This method is for clients inside the framework, and it hasprotectedaccess to prevent use by clients outside the framework. This makes it easy to find places where code outside the framework is ignoring Java basetypes -- at calls toQualifierHierarchy.isSubtypeQualifiersOnly(javax.lang.model.element.AnnotationMirror, javax.lang.model.element.AnnotationMirror).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.
- Specified by:
isSubtypeQualifiersin classQualifierHierarchy- Parameters:
subAnno- possible subqualifiersuperAnno- possible superqualifier- Returns:
- true iff
subQualifieris a subqualifier of, or equal to,superQualifier
-