Class SourceVisitor<R,P>
java.lang.Object
com.sun.source.util.TreeScanner<R,P>
com.sun.source.util.TreePathScanner<R,P>
org.checkerframework.framework.source.SourceVisitor<R,P>
- All Implemented Interfaces:
TreeVisitor<R,
P>
- Direct Known Subclasses:
BaseTypeVisitor
An AST visitor that provides a variety of compiler utilities and interfaces to facilitate
type-checking.
-
Field Summary
Modifier and TypeFieldDescriptionprotected final Elements
TheElements
helper to use when scanning.protected CompilationUnitTree
The root of the AST that thisSourceVisitor
will scan.protected final Trees
TheTrees
instance to use for scanning.The trees that are annotated with@SuppressWarnings
.protected final Types
TheTypes
helper to use when scanning. -
Constructor Summary
ModifierConstructorDescriptionprotected
SourceVisitor
(SourceChecker checker) Creates aSourceVisitor
to use for scanning a source tree. -
Method Summary
Modifier and TypeMethodDescriptionvoid
setRoot
(CompilationUnitTree root) Set the CompilationUnitTree to be used during any visits.void
Entry point for a type processor: the TreePath leaf is a top-level type tree within root.visitClass
(ClassTree classTree, P p) visitMethod
(MethodTree tree, P p) visitVariable
(VariableTree variableTree, P p) Methods inherited from class com.sun.source.util.TreePathScanner
getCurrentPath, scan
Methods inherited from class com.sun.source.util.TreeScanner
reduce, scan, visitAnnotatedType, visitAnnotation, visitArrayAccess, visitArrayType, visitAssert, visitAssignment, visitBinary, visitBindingPattern, visitBlock, visitBreak, visitCase, visitCatch, visitCompilationUnit, visitCompoundAssignment, visitConditionalExpression, visitContinue, visitDefaultCaseLabel, visitDoWhileLoop, visitEmptyStatement, visitEnhancedForLoop, visitErroneous, visitExports, visitExpressionStatement, visitForLoop, visitGuardedPattern, visitIdentifier, visitIf, visitImport, visitInstanceOf, visitIntersectionType, visitLabeledStatement, visitLambdaExpression, visitLiteral, visitMemberReference, visitMemberSelect, visitMethodInvocation, visitModifiers, visitModule, visitNewArray, visitNewClass, visitOpens, visitOther, visitPackage, visitParameterizedType, visitParenthesized, visitParenthesizedPattern, visitPrimitiveType, visitProvides, visitRequires, visitReturn, visitSwitch, visitSwitchExpression, visitSynchronized, visitThrow, visitTry, visitTypeCast, visitTypeParameter, visitUnary, visitUnionType, visitUses, visitWhileLoop, visitWildcard, visitYield
-
Field Details
-
trees
TheTrees
instance to use for scanning. -
elements
TheElements
helper to use when scanning. -
types
TheTypes
helper to use when scanning. -
root
The root of the AST that thisSourceVisitor
will scan. -
treesWithSuppressWarnings
The trees that are annotated with@SuppressWarnings
.
-
-
Constructor Details
-
SourceVisitor
Creates aSourceVisitor
to use for scanning a source tree.- Parameters:
checker
- the checker to invoke on the input source tree
-
-
Method Details
-
setRoot
Set the CompilationUnitTree to be used during any visits. For any later calls ofcom.sun.source.util.TreePathScanner.scan(TreePath, P)
, the CompilationUnitTree of the TreePath has to be equal toroot
. -
visit
Entry point for a type processor: the TreePath leaf is a top-level type tree within root. -
scan
- Overrides:
scan
in classTreePathScanner<R,
P>
-
visitClass
- Specified by:
visitClass
in interfaceTreeVisitor<R,
P> - Overrides:
visitClass
in classTreeScanner<R,
P>
-
visitVariable
- Specified by:
visitVariable
in interfaceTreeVisitor<R,
P> - Overrides:
visitVariable
in classTreeScanner<R,
P>
-
visitMethod
- Specified by:
visitMethod
in interfaceTreeVisitor<R,
P> - Overrides:
visitMethod
in classTreeScanner<R,
P>
-