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:
com.sun.source.tree.TreeVisitor<R,
P>
- Direct Known Subclasses:
BaseTypeVisitor
public abstract class SourceVisitor<R,P>
extends com.sun.source.util.TreePathScanner<R,P>
An AST visitor that provides a variety of compiler utilities and interfaces to facilitate
type-checking.
-
Field Summary
FieldsModifier and TypeFieldDescriptionprotected final Elements
TheElements
helper to use when scanning.protected com.sun.source.tree.CompilationUnitTree
The root of the AST that thisSourceVisitor
will scan.protected final com.sun.source.util.Trees
TheTrees
instance to use for scanning.final List<com.sun.source.tree.Tree>
The trees that are annotated with@SuppressWarnings
.protected final Types
TheTypes
helper to use when scanning. -
Constructor Summary
ConstructorsModifierConstructorDescriptionprotected
SourceVisitor
(SourceChecker checker) Creates aSourceVisitor
to use for scanning a source tree. -
Method Summary
Modifier and TypeMethodDescriptionvoid
setRoot
(com.sun.source.tree.CompilationUnitTree root) Set the CompilationUnitTree to be used during any visits.void
visit
(com.sun.source.util.TreePath path) Entry point for a type processor: the TreePath leaf is a top-level type tree within root.visitClass
(com.sun.source.tree.ClassTree classTree, P p) visitMethod
(com.sun.source.tree.MethodTree node, P p) visitVariable
(com.sun.source.tree.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
protected final com.sun.source.util.Trees treesTheTrees
instance to use for scanning. -
elements
TheElements
helper to use when scanning. -
types
TheTypes
helper to use when scanning. -
root
protected com.sun.source.tree.CompilationUnitTree rootThe 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
public void setRoot(com.sun.source.tree.CompilationUnitTree root) 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
public void visit(com.sun.source.util.TreePath path) Entry point for a type processor: the TreePath leaf is a top-level type tree within root. -
scan
-
visitClass
-
visitVariable
-
visitMethod
-