public abstract class SourceVisitor<R,P>
extends com.sun.source.util.TreePathScanner<R,P>
Modifier and Type | Field and Description |
---|---|
protected javax.lang.model.util.Elements |
elements
The
Elements helper to use when scanning. |
protected com.sun.source.tree.CompilationUnitTree |
root
The root of the AST that this
SourceVisitor will scan. |
protected com.sun.source.util.Trees |
trees
The
Trees instance to use for scanning. |
java.util.List<com.sun.source.tree.Tree> |
treesWithSuppressWarnings
A set of trees that are annotated with
@SuppressWarnings . |
protected javax.lang.model.util.Types |
types
The
Types helper to use when scanning. |
Constructor and Description |
---|
SourceVisitor(SourceChecker checker)
Creates a
SourceVisitor to use for scanning a source tree. |
Modifier and Type | Method and Description |
---|---|
R |
scan(com.sun.source.tree.Tree tree,
P p) |
void |
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.
|
R |
visitClass(com.sun.source.tree.ClassTree classTree,
P p) |
R |
visitMethod(com.sun.source.tree.MethodTree node,
P p) |
R |
visitVariable(com.sun.source.tree.VariableTree variableTree,
P p) |
reduce, scan, visitAnnotatedType, visitAnnotation, visitArrayAccess, visitArrayType, visitAssert, visitAssignment, visitBinary, visitBlock, visitBreak, visitCase, visitCatch, visitCompilationUnit, visitCompoundAssignment, visitConditionalExpression, visitContinue, visitDoWhileLoop, visitEmptyStatement, visitEnhancedForLoop, visitErroneous, visitExports, visitExpressionStatement, visitForLoop, visitIdentifier, visitIf, visitImport, visitInstanceOf, visitIntersectionType, visitLabeledStatement, visitLambdaExpression, visitLiteral, visitMemberReference, visitMemberSelect, visitMethodInvocation, visitModifiers, visitModule, visitNewArray, visitNewClass, visitOpens, visitOther, visitPackage, visitParameterizedType, visitParenthesized, visitPrimitiveType, visitProvides, visitRequires, visitReturn, visitSwitch, visitSynchronized, visitThrow, visitTry, visitTypeCast, visitTypeParameter, visitUnary, visitUnionType, visitUses, visitWhileLoop, visitWildcard
protected final com.sun.source.util.Trees trees
Trees
instance to use for scanning.protected final javax.lang.model.util.Elements elements
Elements
helper to use when scanning.protected final javax.lang.model.util.Types types
Types
helper to use when scanning.protected com.sun.source.tree.CompilationUnitTree root
SourceVisitor
will scan.public final java.util.List<com.sun.source.tree.Tree> treesWithSuppressWarnings
@SuppressWarnings
.public SourceVisitor(SourceChecker checker)
SourceVisitor
to use for scanning a source tree.checker
- the checker to invoke on the input source treepublic void setRoot(com.sun.source.tree.CompilationUnitTree root)
com.sun.source.util.TreePathScanner.scan(TreePath, P)
, the CompilationUnitTree of the
TreePath has to be equal to root
.public void visit(com.sun.source.util.TreePath path)