Class SimpleAnnotatedTypeScanner<R,P>
java.lang.Object
org.checkerframework.framework.type.visitor.AnnotatedTypeScanner<R,P>
org.checkerframework.framework.type.visitor.SimpleAnnotatedTypeScanner<R,P>
- Type Parameters:
R- the return type of this visitor's methods. Use Void for visitors that do not need to return results.P- the type of the additional parameter to this visitor's methods. Use Void for visitors that do not need an additional parameter.
- All Implemented Interfaces:
AnnotatedTypeVisitor<R,P>
- Direct Known Subclasses:
DependentTypesHelper.ErrorAnnoReplacer,HashcodeAtmVisitor
An
AnnotatedTypeScanner that scans an AnnotatedTypeMirror and performs some
defaultAction on each type. The defaultAction can be passed to the constructor SimpleAnnotatedTypeScanner(DefaultAction) or this class can be extended and defaultAction can be overridden.
If the default action does not return a result, then R should be Void. If the
default action returns a result, then specify a AnnotatedTypeScanner.reduce(R, R) function.
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic interfaceRepresents an action to perform on every type.Nested classes/interfaces inherited from class org.checkerframework.framework.type.visitor.AnnotatedTypeScanner
AnnotatedTypeScanner.Reduce<R> -
Field Summary
FieldsModifier and TypeFieldDescriptionprotected final SimpleAnnotatedTypeScanner.DefaultAction<R, P> The action to perform on every type.Fields inherited from class org.checkerframework.framework.type.visitor.AnnotatedTypeScanner
defaultResult, reduceFunction, visitedNodes -
Constructor Summary
ConstructorsModifierConstructorDescriptionprotectedCreates a scanner without specifying the default action.protectedSimpleAnnotatedTypeScanner(AnnotatedTypeScanner.Reduce<R> reduce, R defaultResult) Creates a scanner without specifying the default action.SimpleAnnotatedTypeScanner(SimpleAnnotatedTypeScanner.DefaultAction<R, P> defaultAction) Creates a scanner that performsdefaultActionon every type.SimpleAnnotatedTypeScanner(SimpleAnnotatedTypeScanner.DefaultAction<R, P> defaultAction, AnnotatedTypeScanner.Reduce<R> reduce, R defaultResult) Creates a scanner that performsdefaultActionon every type and usereduceto combine the results. -
Method Summary
Modifier and TypeMethodDescriptionprotected RdefaultAction(AnnotatedTypeMirror type, P p) Called by default for any visit method that is not overridden.final RVisits an array type.final RVisits a declared type.final RVisits an executable type.final RVisits NoType type.final RVisits anulltype.final RVisits a primitive type.final RVisits a type variable.final RVisits a wildcard type.Methods inherited from class org.checkerframework.framework.type.visitor.AnnotatedTypeScanner
reduce, reset, scan, scan, scanAndReduce, scanAndReduce, visit, visit, visitIntersection, visitUnion
-
Field Details
-
defaultAction
The action to perform on every type.
-
-
Constructor Details
-
SimpleAnnotatedTypeScanner
Creates a scanner that performsdefaultActionon every type.Use this constructor if the type of result of the default action is
Void.- Parameters:
defaultAction- action to perform on every type
-
SimpleAnnotatedTypeScanner
public SimpleAnnotatedTypeScanner(SimpleAnnotatedTypeScanner.DefaultAction<R, P> defaultAction, AnnotatedTypeScanner.Reduce<R> reduce, R defaultResult) Creates a scanner that performsdefaultActionon every type and usereduceto combine the results.Use this constructor if the default action returns a result.
- Parameters:
defaultAction- action to perform on every typereduce- function used to combine resultsdefaultResult- result to use by default
-
SimpleAnnotatedTypeScanner
protected SimpleAnnotatedTypeScanner()Creates a scanner without specifying the default action. Subclasses may only use this constructor if they also overridedefaultAction(AnnotatedTypeMirror, Object). -
SimpleAnnotatedTypeScanner
Creates a scanner without specifying the default action. Subclasses may only use this constructor if they also overridedefaultAction(AnnotatedTypeMirror, Object).- Parameters:
reduce- function used to combine resultsdefaultResult- result to use by default
-
-
Method Details
-
defaultAction
Called by default for any visit method that is not overridden.- Parameters:
type- the type to visitp- a visitor-specified parameter- Returns:
- a visitor-specified result
-
visitDeclared
Visits a declared type.- Specified by:
visitDeclaredin interfaceAnnotatedTypeVisitor<R,P> - Overrides:
visitDeclaredin classAnnotatedTypeScanner<R,P> - Parameters:
type- the type to visitp- a visitor-specified parameter- Returns:
- a visitor-specified result
-
visitExecutable
Visits an executable type.- Specified by:
visitExecutablein interfaceAnnotatedTypeVisitor<R,P> - Overrides:
visitExecutablein classAnnotatedTypeScanner<R,P> - Parameters:
type- the type to visitp- a visitor-specified parameter- Returns:
- a visitor-specified result
-
visitArray
Visits an array type.- Specified by:
visitArrayin interfaceAnnotatedTypeVisitor<R,P> - Overrides:
visitArrayin classAnnotatedTypeScanner<R,P> - Parameters:
type- the type to visitp- a visitor-specified parameter- Returns:
- a visitor-specified result
-
visitTypeVariable
Visits a type variable.- Specified by:
visitTypeVariablein interfaceAnnotatedTypeVisitor<R,P> - Overrides:
visitTypeVariablein classAnnotatedTypeScanner<R,P> - Parameters:
type- the type to visitp- a visitor-specified parameter- Returns:
- a visitor-specified result
-
visitPrimitive
Visits a primitive type.- Specified by:
visitPrimitivein interfaceAnnotatedTypeVisitor<R,P> - Overrides:
visitPrimitivein classAnnotatedTypeScanner<R,P> - Parameters:
type- the type to visitp- a visitor-specified parameter- Returns:
- a visitor-specified result
-
visitNoType
Visits NoType type.- Specified by:
visitNoTypein interfaceAnnotatedTypeVisitor<R,P> - Overrides:
visitNoTypein classAnnotatedTypeScanner<R,P> - Parameters:
type- the type to visitp- a visitor-specified parameter- Returns:
- a visitor-specified result
-
visitNull
Visits anulltype.- Specified by:
visitNullin interfaceAnnotatedTypeVisitor<R,P> - Overrides:
visitNullin classAnnotatedTypeScanner<R,P> - Parameters:
type- the type to visitp- a visitor-specified parameter- Returns:
- a visitor-specified result
-
visitWildcard
Visits a wildcard type.- Specified by:
visitWildcardin interfaceAnnotatedTypeVisitor<R,P> - Overrides:
visitWildcardin classAnnotatedTypeScanner<R,P> - Parameters:
type- the type to visitp- a visitor-specified parameter- Returns:
- a visitor-specified result
-