Class DoubleAnnotatedTypeScanner<R>
java.lang.Object
org.checkerframework.framework.type.visitor.AnnotatedTypeScanner<R,AnnotatedTypeMirror>
org.checkerframework.framework.type.visitor.DoubleAnnotatedTypeScanner<R>
- Type Parameters:
R- the result of scanning the twoAnnotatedTypeMirrors
- All Implemented Interfaces:
AnnotatedTypeVisitor<R,AnnotatedTypeMirror>
- Direct Known Subclasses:
AnnotatedTypeCombiner,AnnotatedTypeReplacer,DependentTypesHelper.ViewpointAdaptedCopier
public abstract class DoubleAnnotatedTypeScanner<R>
extends AnnotatedTypeScanner<R,AnnotatedTypeMirror>
An
AnnotatedTypeScanner that scans two AnnotatedTypeMirrors simultaneously and
performs defaultAction(AnnotatedTypeMirror, AnnotatedTypeMirror) on the pair. Both
AnnotatedTypeMirrors must have the same structure, or a subclass must arrange not to continue
recursing past the point at which their structure diverges.
If the default action does not return a result, then R should be Void and
DoubleAnnotatedTypeScanner() should be used to construct the scanner. If the default
action returns a result, then specify a AnnotatedTypeScanner.reduce(R, R) function and use
DoubleAnnotatedTypeScanner(Reduce, Object).
- 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.visitor.AnnotatedTypeScanner
defaultResult, reduceFunction, visitedNodes -
Constructor Summary
ConstructorsModifierConstructorDescriptionprotectedConstructs an AnnotatedTypeScanner where the reduce function returns the first result if it is nonnull; otherwise the second result is returned.protectedDoubleAnnotatedTypeScanner(AnnotatedTypeScanner.Reduce<R> reduce, R defaultResult) Creates a scanner with the givenreducefunction anddefaultResult. -
Method Summary
Modifier and TypeMethodDescriptionprotected abstract RCalled by default for any visit method that is not overridden.protected Rscan(Iterable<? extends AnnotatedTypeMirror> types1, Iterable<? extends AnnotatedTypeMirror> types2) Scanstypes1andtypes2.protected Rscan(AnnotatedTypeMirror type, AnnotatedTypeMirror p) Scantypeby callingtype.accept(this, p); this method may be overridden by subclasses.protected RscanAndReduce(Iterable<? extends AnnotatedTypeMirror> types, Iterable<? extends AnnotatedTypeMirror> p, R r) Runscan(java.lang.Iterable<? extends org.checkerframework.framework.type.AnnotatedTypeMirror>, java.lang.Iterable<? extends org.checkerframework.framework.type.AnnotatedTypeMirror>)on types and p, then runAnnotatedTypeScanner.reduce(R, R)on the result (plus r) to return a single element.protected final RscanAndReduce(Iterable<? extends AnnotatedTypeMirror> types, AnnotatedTypeMirror p, R r) final RVisits an array type.final RVisits a declared type.final RVisits an executable type.Visits an intersection type.Visits a type variable.Visits an union type.Visits a wildcard type.Methods inherited from class org.checkerframework.framework.type.visitor.AnnotatedTypeScanner
reduce, reset, scan, scanAndReduce, visit, visit, visitNoType, visitNull, visitPrimitive
-
Constructor Details
-
DoubleAnnotatedTypeScanner
protected DoubleAnnotatedTypeScanner()Constructs an AnnotatedTypeScanner where the reduce function returns the first result if it is nonnull; otherwise the second result is returned. The default result isnull. -
DoubleAnnotatedTypeScanner
Creates a scanner with the givenreducefunction anddefaultResult.- Parameters:
reduce- function used to combine the results of scandefaultResult- 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
-
scan
protected R scan(Iterable<? extends AnnotatedTypeMirror> types1, Iterable<? extends AnnotatedTypeMirror> types2) - Parameters:
types1- typestypes2- types- Returns:
- the result of scanning and reducing all the types in
types1andtypes2orAnnotatedTypeScanner.defaultResultif they are empty
-
scanAndReduce
protected R scanAndReduce(Iterable<? extends AnnotatedTypeMirror> types, Iterable<? extends AnnotatedTypeMirror> p, R r) Runscan(java.lang.Iterable<? extends org.checkerframework.framework.type.AnnotatedTypeMirror>, java.lang.Iterable<? extends org.checkerframework.framework.type.AnnotatedTypeMirror>)on types and p, then runAnnotatedTypeScanner.reduce(R, R)on the result (plus r) to return a single element. -
scanAndReduce
protected final R scanAndReduce(Iterable<? extends AnnotatedTypeMirror> types, AnnotatedTypeMirror p, R r) - Overrides:
scanAndReducein classAnnotatedTypeScanner<R,AnnotatedTypeMirror>
-
scan
Description copied from class:AnnotatedTypeScannerScantypeby callingtype.accept(this, p); this method may be overridden by subclasses.- Overrides:
scanin classAnnotatedTypeScanner<R,AnnotatedTypeMirror> - Parameters:
type- type to scanp- the parameter to use- Returns:
- the result of visiting
type
-
visitDeclared
Description copied from interface:AnnotatedTypeVisitorVisits a declared type.- Specified by:
visitDeclaredin interfaceAnnotatedTypeVisitor<R,AnnotatedTypeMirror> - Overrides:
visitDeclaredin classAnnotatedTypeScanner<R,AnnotatedTypeMirror> - Parameters:
type- the type to visitp- a visitor-specified parameter- Returns:
- a visitor-specified result
-
visitArray
Description copied from interface:AnnotatedTypeVisitorVisits an array type.- Specified by:
visitArrayin interfaceAnnotatedTypeVisitor<R,AnnotatedTypeMirror> - Overrides:
visitArrayin classAnnotatedTypeScanner<R,AnnotatedTypeMirror> - Parameters:
type- the type to visitp- a visitor-specified parameter- Returns:
- a visitor-specified result
-
visitExecutable
public final R visitExecutable(AnnotatedTypeMirror.AnnotatedExecutableType type, AnnotatedTypeMirror p) Description copied from interface:AnnotatedTypeVisitorVisits an executable type.- Specified by:
visitExecutablein interfaceAnnotatedTypeVisitor<R,AnnotatedTypeMirror> - Overrides:
visitExecutablein classAnnotatedTypeScanner<R,AnnotatedTypeMirror> - Parameters:
type- the type to visitp- a visitor-specified parameter- Returns:
- a visitor-specified result
-
visitTypeVariable
Description copied from interface:AnnotatedTypeVisitorVisits a type variable.- Specified by:
visitTypeVariablein interfaceAnnotatedTypeVisitor<R,AnnotatedTypeMirror> - Overrides:
visitTypeVariablein classAnnotatedTypeScanner<R,AnnotatedTypeMirror> - Parameters:
type- the type to visitp- a visitor-specified parameter- Returns:
- a visitor-specified result
-
visitWildcard
Description copied from interface:AnnotatedTypeVisitorVisits a wildcard type.- Specified by:
visitWildcardin interfaceAnnotatedTypeVisitor<R,AnnotatedTypeMirror> - Overrides:
visitWildcardin classAnnotatedTypeScanner<R,AnnotatedTypeMirror> - Parameters:
type- the type to visitp- a visitor-specified parameter- Returns:
- a visitor-specified result
-
visitIntersection
public R visitIntersection(AnnotatedTypeMirror.AnnotatedIntersectionType type, AnnotatedTypeMirror p) Description copied from interface:AnnotatedTypeVisitorVisits an intersection type.- Specified by:
visitIntersectionin interfaceAnnotatedTypeVisitor<R,AnnotatedTypeMirror> - Overrides:
visitIntersectionin classAnnotatedTypeScanner<R,AnnotatedTypeMirror> - Parameters:
type- the type to visitp- a visitor-specified parameter- Returns:
- a visitor-specified result
-
visitUnion
Description copied from interface:AnnotatedTypeVisitorVisits an union type.- Specified by:
visitUnionin interfaceAnnotatedTypeVisitor<R,AnnotatedTypeMirror> - Overrides:
visitUnionin classAnnotatedTypeScanner<R,AnnotatedTypeMirror> - Parameters:
type- the type to visitp- a visitor-specified parameter- Returns:
- a visitor-specified result
-