Class DefaultQualifierForUseTypeAnnotator
java.lang.Object
org.checkerframework.framework.type.visitor.AnnotatedTypeScanner<Void,Void>
org.checkerframework.framework.type.typeannotator.TypeAnnotator
org.checkerframework.framework.type.typeannotator.DefaultQualifierForUseTypeAnnotator
- All Implemented Interfaces:
AnnotatedTypeVisitor<Void,
Void>
Implements support for
DefaultQualifierForUse
and NoDefaultQualifierForUse
. Adds
default annotations on types that have no annotation.-
Nested Class Summary
Nested classes/interfaces inherited from class org.checkerframework.framework.type.visitor.AnnotatedTypeScanner
AnnotatedTypeScanner.Reduce<R>
-
Field Summary
Modifier and TypeFieldDescriptionprotected final Map<Element,
AnnotationMirrorSet> Cache of elements to the set of annotations that should be applied to unannotated uses of the element.Fields inherited from class org.checkerframework.framework.type.typeannotator.TypeAnnotator
atypeFactory
Fields inherited from class org.checkerframework.framework.type.visitor.AnnotatedTypeScanner
defaultResult, reduceFunction, visitedNodes
-
Constructor Summary
ConstructorDescriptionDefaultQualifierForUseTypeAnnotator
(AnnotatedTypeFactory typeFactory) Creates an DefaultQualifierForUseTypeAnnotator fortypeFactory
. -
Method Summary
Modifier and TypeMethodDescriptionvoid
Clears all caches.protected AnnotationMirrorSet
getDefaultAnnosForUses
(Element element) Returns the set of qualifiers that should be applied to unannotated uses of the given elementprotected AnnotationMirrorSet
getDefaultQualifierForUses
(Element element) Return the default qualifiers for uses ofelement
as specified by aDefaultQualifierForUse
annotation.protected AnnotationMirrorSet
getExplicitAnnos
(Element element) Return the annotations explicitly written on the element.protected AnnotationMirrorSet
getHierarchiesNoDefault
(Element element) Returns top annotations in hierarchies for which no default for use qualifier should be added.protected final AnnotationMirrorSet
supportedAnnosFromAnnotationMirror
(List<@CanonicalName Name> annoClassNames) Returns the set of qualifiers supported by this type system from the value element ofannotationMirror
.visitDeclared
(AnnotatedTypeMirror.AnnotatedDeclaredType type, Void aVoid) Visits a declared type.Methods inherited from class org.checkerframework.framework.type.typeannotator.TypeAnnotator
visitExecutable
Methods inherited from class org.checkerframework.framework.type.visitor.AnnotatedTypeScanner
reduce, reset, scan, scan, scanAndReduce, scanAndReduce, visit, visit, visitArray, visitIntersection, visitNoType, visitNull, visitPrimitive, visitTypeVariable, visitUnion, visitWildcard
-
Field Details
-
elementToDefaults
Cache of elements to the set of annotations that should be applied to unannotated uses of the element.
-
-
Constructor Details
-
DefaultQualifierForUseTypeAnnotator
Creates an DefaultQualifierForUseTypeAnnotator fortypeFactory
.- Parameters:
typeFactory
- the type factory
-
-
Method Details
-
visitDeclared
Description copied from interface:AnnotatedTypeVisitor
Visits a declared type.- Specified by:
visitDeclared
in interfaceAnnotatedTypeVisitor<Void,
Void> - Overrides:
visitDeclared
in classAnnotatedTypeScanner<Void,
Void> - Parameters:
type
- the type to visitaVoid
- a visitor-specified parameter- Returns:
- a visitor-specified result
-
clearCache
public void clearCache()Clears all caches. -
getDefaultAnnosForUses
Returns the set of qualifiers that should be applied to unannotated uses of the given element- Parameters:
element
- the element for which to determine default qualifiers- Returns:
- the set of qualifiers that should be applied to unannotated uses of
element
-
getExplicitAnnos
Return the annotations explicitly written on the element.- Parameters:
element
- an element- Returns:
- the annotations explicitly written on the element
-
getDefaultQualifierForUses
Return the default qualifiers for uses ofelement
as specified by aDefaultQualifierForUse
annotation.Subclasses may override to use an annotation other than
DefaultQualifierForUse
.- Parameters:
element
- an element- Returns:
- the default qualifiers for uses of
element
-
getHierarchiesNoDefault
Returns top annotations in hierarchies for which no default for use qualifier should be added.- Parameters:
element
- an element- Returns:
- top annotations in hierarchies for which no default for use qualifier should be added
-
supportedAnnosFromAnnotationMirror
protected final AnnotationMirrorSet supportedAnnosFromAnnotationMirror(List<@CanonicalName Name> annoClassNames) Returns the set of qualifiers supported by this type system from the value element ofannotationMirror
.- Parameters:
annoClassNames
- a list of annotation class names- Returns:
- the set of qualifiers supported by this type system from the value element of
annotationMirror
-