Class ViewpointTestQualifierHierarchy
QualifierHierarchy for the Viewpoint Test Checker.-
Field Summary
Fields inherited from class org.checkerframework.framework.type.NoElementQualifierHierarchy
bottoms, elementToQualifierKind, kindToAnnotationMirror, qualifierKindHierarchy, qualifiers, topsFields inherited from class org.checkerframework.framework.type.QualifierHierarchy
atypeFactory -
Constructor Summary
ConstructorsConstructorDescriptionViewpointTestQualifierHierarchy(Collection<Class<? extends Annotation>> qualifierClasses, Elements elements, GenericAnnotatedTypeFactory<?, ?, ?, ?> atypeFactory) Creates a ViewpointTestQualifierHierarchy from the given classes. -
Method Summary
Modifier and TypeMethodDescriptionbooleanisSubtypeQualifiers(AnnotationMirror subAnno, AnnotationMirror superAnno) Returns true ifsubQualifieris equal to or a sub-qualifier ofsuperQualifier, according to the type qualifier hierarchy, ignoring Java basetypes.Methods inherited from class org.checkerframework.framework.type.NoElementQualifierHierarchy
createAnnotationMirrors, createBottoms, createElementToQualifierKindMap, createQualifierKindHierarchy, createTops, findAnnotationInHierarchy, findAnnotationInSameHierarchy, getBottomAnnotation, getBottomAnnotations, getPolymorphicAnnotation, getQualifierKind, getTopAnnotation, getTopAnnotations, greatestLowerBoundQualifiers, isPolymorphicQualifier, leastUpperBoundQualifiersMethods inherited from class org.checkerframework.framework.type.QualifierHierarchy
assertSameSize, assertSameSize, canHaveEmptyAnnotationSet, getParametricQualifier, getPolymorphicAnnotations, getWidth, greatestLowerBoundQualifiersOnly, greatestLowerBoundShallow, greatestLowerBoundsQualifiersOnly, greatestLowerBoundsQualifiersOnly, greatestLowerBoundsShallow, isBottom, isParametricQualifier, isSubtypeQualifiersOnly, isSubtypeQualifiersOnly, isSubtypeShallow, isSubtypeShallow, isSubtypeShallow, isSubtypeShallow, isTop, isValid, leastUpperBoundQualifiersOnly, leastUpperBoundShallow, leastUpperBoundsQualifiersOnly, leastUpperBoundsQualifiersOnly, leastUpperBoundsShallow, numberOfIterationsBeforeWidening, updateMappingToMutableSet, widenedUpperBound
-
Constructor Details
-
ViewpointTestQualifierHierarchy
public ViewpointTestQualifierHierarchy(Collection<Class<? extends Annotation>> qualifierClasses, Elements elements, GenericAnnotatedTypeFactory<?, ?, ?, ?> atypeFactory) Creates a ViewpointTestQualifierHierarchy from the given classes.- Parameters:
qualifierClasses- classes of annotations that are the qualifierselements- element utilsatypeFactory- the associated type factory
-
-
Method Details
-
isSubtypeQualifiers
Description copied from class:QualifierHierarchyReturns 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).An override must stay consistent with
QualifierHierarchy.leastUpperBoundQualifiers(javax.lang.model.element.AnnotationMirror, javax.lang.model.element.AnnotationMirror)andQualifierHierarchy.greatestLowerBoundQualifiers(javax.lang.model.element.AnnotationMirror, javax.lang.model.element.AnnotationMirror): for any two qualifiersaandbin the same hierarchy,leastUpperBoundQualifiers(a, b)must be a supertype of bothaandbunder this method and a subtype of every other common supertype of the two (i.e., the least such supertype, not merely some upper bound);greatestLowerBoundQualifiers(a, b)must be a subtype of both and a supertype of every other common subtype of the two (i.e., the greatest such subtype). This matters even for a qualifier hierarchy whose true subtyping relation is not fully expressible as a static, declarative lattice (for example, one that depends on a checker option such as a strict/lenient mode): if this method special-cases such a situation butQualifierHierarchy.leastUpperBoundQualifiers(javax.lang.model.element.AnnotationMirror, javax.lang.model.element.AnnotationMirror)/QualifierHierarchy.greatestLowerBoundQualifiers(javax.lang.model.element.AnnotationMirror, javax.lang.model.element.AnnotationMirror)do not, a caller that combines qualifiers with one and later checks the result with the other -- asAnnotatedTypeFactory.combineIntersectionBoundAnnotationsInHierarchy(javax.lang.model.element.AnnotationMirror, javax.lang.model.element.AnnotationMirror, org.checkerframework.framework.type.QualifierHierarchy)does when overridden to return a greatest lower bound -- can derive a summary that this method would not itself have accepted, producing a spurious type error where none existed before the summary was combined.- Overrides:
isSubtypeQualifiersin classNoElementQualifierHierarchy- Parameters:
subAnno- possible subqualifiersuperAnno- possible superqualifier- Returns:
- true iff
subQualifieris a subqualifier of, or equal to,superQualifier
-