Class DefaultForTypeAnnotator
java.lang.Object
org.checkerframework.framework.type.visitor.AnnotatedTypeScanner<Void,Void>
org.checkerframework.framework.type.typeannotator.TypeAnnotator
org.checkerframework.framework.type.typeannotator.DefaultForTypeAnnotator
- All Implemented Interfaces:
AnnotatedTypeVisitor<Void,Void>
Adds annotations to a type based on the use of a type. This class applies annotations specified
by
DefaultFor; it is designed to be used in a ListTypeAnnotator constructed in
GenericAnnotatedTypeFactory.createTypeAnnotator() ()}
DefaultForTypeAnnotator traverses types deeply.
This class takes care of two of the attributes of DefaultFor; the others are handled
in QualifierDefaults.
- See Also:
-
Nested Class Summary
Nested classes/interfaces inherited from class org.checkerframework.framework.type.visitor.AnnotatedTypeScanner
AnnotatedTypeScanner.Reduce<R> -
Field Summary
Fields inherited from class org.checkerframework.framework.type.typeannotator.TypeAnnotator
atypeFactoryFields inherited from class org.checkerframework.framework.type.visitor.AnnotatedTypeScanner
defaultResult, reduceFunction, visitedNodes -
Constructor Summary
ConstructorsConstructorDescriptionDefaultForTypeAnnotator(AnnotatedTypeFactory typeFactory) Creates aDefaultForTypeAnnotatorfrom the given checker, using that checker to determine the annotations that are in the type hierarchy. -
Method Summary
Modifier and TypeMethodDescriptionvoidaddAtmClass(Class<? extends AnnotatedTypeMirror> typeClass, AnnotationMirror theQual) Add default qualifier,theQual, for the givenAnnotatedTypeMirrorclass.Adds standard rules.voidaddTypeKind(TypeKind typeKind, AnnotationMirror theQual) Add default qualifier,theQual, for the given TypeKind.voidaddTypes(Class<?> clazz, AnnotationMirror theQual) Add default qualifier,theQual, for the given type.voiddefaultTypeFromName(AnnotatedTypeMirror type, String name) Apply defaults based on a variable name to a type.protected Voidscan(AnnotatedTypeMirror type, Void p) Scantypeby callingtype.accept(this, p); this method may be overridden by subclasses.Visits an executable type.Methods inherited from class org.checkerframework.framework.type.visitor.AnnotatedTypeScanner
reduce, reset, scan, scanAndReduce, scanAndReduce, visit, visit, visitArray, visitDeclared, visitIntersection, visitNoType, visitNull, visitPrimitive, visitTypeVariable, visitUnion, visitWildcard
-
Constructor Details
-
DefaultForTypeAnnotator
Creates aDefaultForTypeAnnotatorfrom the given checker, using that checker to determine the annotations that are in the type hierarchy.
-
-
Method Details
-
addTypeKind
Add default qualifier,theQual, for the given TypeKind. -
addAtmClass
Add default qualifier,theQual, for the givenAnnotatedTypeMirrorclass. -
addTypes
Add default qualifier,theQual, for the given type. -
scan
Description copied from class:AnnotatedTypeScannerScantypeby callingtype.accept(this, p); this method may be overridden by subclasses.- Overrides:
scanin classAnnotatedTypeScanner<Void,Void> - Parameters:
type- type to scanp- the parameter to use- Returns:
- the result of visiting
type
-
addStandardDefaults
Adds standard rules. Currently, sets Void to bottom if no other qualifier is set for Void. Also, seeLiteralTreeAnnotator.addStandardLiteralQualifiers().- Returns:
- this
-
defaultTypeFromName
Apply defaults based on a variable name to a type.- Parameters:
type- a type to apply defaults toname- the name of the variable that has typetype, or the name of the method whose return type istype
-
visitExecutable
Description copied from class:TypeAnnotatorVisits an executable type.If this method adds annotations to the type of method parameters, then
GenericAnnotatedTypeFactory.addComputedTypeAnnotations(Element, AnnotatedTypeMirror)should be overridden and the same annotations added to the type of elements with kindElementKind.PARAMETER. Likewise for return types.- Specified by:
visitExecutablein interfaceAnnotatedTypeVisitor<Void,Void> - Overrides:
visitExecutablein classTypeAnnotator- Parameters:
type- the type to visitaVoid- a visitor-specified parameter- Returns:
- a visitor-specified result
-