Class PropagationTypeAnnotator
- java.lang.Object
-
- org.checkerframework.framework.type.visitor.AnnotatedTypeScanner<java.lang.Void,java.lang.Void>
-
- org.checkerframework.framework.type.typeannotator.TypeAnnotator
-
- org.checkerframework.framework.type.typeannotator.PropagationTypeAnnotator
-
- All Implemented Interfaces:
AnnotatedTypeVisitor<java.lang.Void,java.lang.Void>
public class PropagationTypeAnnotator extends TypeAnnotator
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
Constructors Constructor Description PropagationTypeAnnotator(AnnotatedTypeFactory typeFactory)
Creates a new PropagationTypeAnnotator.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
reset()
Reset the scanner to allow reuse of the same instance.protected java.lang.Void
scan(AnnotatedTypeMirror type, java.lang.Void aVoid)
Scantype
by callingtype.accept(this, p)
; this method may be overridden by subclasses.java.lang.Void
visitDeclared(AnnotatedTypeMirror.AnnotatedDeclaredType declaredType, java.lang.Void aVoid)
Sometimes the underlying type parameters of AnnotatedWildcardTypes are not available on the wildcards themselves.java.lang.Void
visitWildcard(AnnotatedTypeMirror.AnnotatedWildcardType wildcard, java.lang.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 Detail
-
PropagationTypeAnnotator
public PropagationTypeAnnotator(AnnotatedTypeFactory typeFactory)
Creates a new PropagationTypeAnnotator.- Parameters:
typeFactory
- the type factory
-
-
Method Detail
-
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<java.lang.Void,java.lang.Void>
-
scan
protected java.lang.Void scan(AnnotatedTypeMirror type, java.lang.Void aVoid)
Description copied from class:AnnotatedTypeScanner
Scantype
by callingtype.accept(this, p)
; this method may be overridden by subclasses.- Overrides:
scan
in classAnnotatedTypeScanner<java.lang.Void,java.lang.Void>
- Parameters:
type
- type to scanaVoid
- the parameter to use- Returns:
- the result of visiting
type
-
visitDeclared
public java.lang.Void visitDeclared(AnnotatedTypeMirror.AnnotatedDeclaredType declaredType, java.lang.Void aVoid)
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<java.lang.Void,java.lang.Void>
- Overrides:
visitDeclared
in classAnnotatedTypeScanner<java.lang.Void,java.lang.Void>
- Parameters:
declaredType
- type to recordaVoid
- a visitor-specified parameter- Returns:
- a visitor-specified result
-
visitWildcard
public java.lang.Void visitWildcard(AnnotatedTypeMirror.AnnotatedWildcardType wildcard, java.lang.Void aVoid)
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<java.lang.Void,java.lang.Void>
- Overrides:
visitWildcard
in classAnnotatedTypeScanner<java.lang.Void,java.lang.Void>
- Parameters:
wildcard
- type to annotateaVoid
- a visitor-specified parameter- Returns:
- a visitor-specified result
-
-