Class PropagationTypeAnnotator
java.lang.Object
org.checkerframework.framework.type.visitor.AnnotatedTypeScanner<Void,Void>
org.checkerframework.framework.type.typeannotator.TypeAnnotator
org.checkerframework.framework.type.typeannotator.PropagationTypeAnnotator
- All Implemented Interfaces:
AnnotatedTypeVisitor<Void,
Void>
PropagationTypeAnnotator
adds qualifiers to types where the qualifier to add should be
transferred from one or more other types.
At the moment, the only function PropagationTypeAnnotator provides, is the propagation of generic type parameter annotations to unannotated wildcards with missing bounds annotations.
-
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
atypeFactory
Fields inherited from class org.checkerframework.framework.type.visitor.AnnotatedTypeScanner
defaultResult, reduceFunction, visitedNodes
-
Constructor Summary
ConstructorDescriptionPropagationTypeAnnotator
(AnnotatedTypeFactory typeFactory) Creates a new PropagationTypeAnnotator. -
Method Summary
Modifier and TypeMethodDescriptionvoid
reset()
Reset the scanner to allow reuse of the same instance.protected Void
scan
(AnnotatedTypeMirror type, Void aVoid) Scantype
by callingtype.accept(this, p)
; this method may be overridden by subclasses.visitDeclared
(AnnotatedTypeMirror.AnnotatedDeclaredType declaredType, Void aVoid) Sometimes the underlying type parameters of AnnotatedWildcardTypes are not available on the wildcards themselves.visitWildcard
(AnnotatedTypeMirror.AnnotatedWildcardType wildcard, Void aVoid) Rather than defaulting the missing bounds of a wildcard, find the bound annotations on the type parameter it replaced.Methods inherited from class org.checkerframework.framework.type.typeannotator.TypeAnnotator
visitExecutable
Methods inherited from class org.checkerframework.framework.type.visitor.AnnotatedTypeScanner
reduce, scan, scanAndReduce, scanAndReduce, visit, visit, visitArray, visitIntersection, visitNoType, visitNull, visitPrimitive, visitTypeVariable, visitUnion
-
Constructor Details
-
PropagationTypeAnnotator
Creates a new PropagationTypeAnnotator.- Parameters:
typeFactory
- the type factory
-
-
Method Details
-
reset
public void reset()Description copied from class:AnnotatedTypeScanner
Reset the scanner to allow reuse of the same instance. Subclasses should override this method to clear their additional state; they must call the super implementation.- Overrides:
reset
in classAnnotatedTypeScanner<Void,
Void>
-
scan
Description copied from class:AnnotatedTypeScanner
Scantype
by callingtype.accept(this, p)
; this method may be overridden by subclasses.- Overrides:
scan
in classAnnotatedTypeScanner<Void,
Void> - Parameters:
type
- type to scanaVoid
- the parameter to use- Returns:
- the result of visiting
type
-
visitDeclared
Sometimes the underlying type parameters of AnnotatedWildcardTypes are not available on the wildcards themselves. Instead, record enclosing class to find the type parameter to use as a backup in visitWildcards.- Specified by:
visitDeclared
in interfaceAnnotatedTypeVisitor<Void,
Void> - Overrides:
visitDeclared
in classAnnotatedTypeScanner<Void,
Void> - Parameters:
declaredType
- type to recordaVoid
- a visitor-specified parameter- Returns:
- a visitor-specified result
-
visitWildcard
Rather than defaulting the missing bounds of a wildcard, find the bound annotations on the type parameter it replaced. Place those annotations on the wildcard.- Specified by:
visitWildcard
in interfaceAnnotatedTypeVisitor<Void,
Void> - Overrides:
visitWildcard
in classAnnotatedTypeScanner<Void,
Void> - Parameters:
wildcard
- type to annotateaVoid
- a visitor-specified parameter- Returns:
- a visitor-specified result
-