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
Fields Modifier and Type Field Description protected javax.lang.model.util.Elements
elements
TheElements
helper to use when scanning.protected com.sun.source.tree.CompilationUnitTree
root
The root of the AST that thisSourceVisitor
will scan.protected com.sun.source.util.Trees
trees
TheTrees
instance to use for scanning.java.util.List<com.sun.source.tree.Tree>
treesWithSuppressWarnings
The trees that are annotated with@SuppressWarnings
.protected javax.lang.model.util.Types
types
TheTypes
helper to use when scanning.
-
Constructor Summary
Constructors Modifier Constructor Description protected
SourceVisitor(SourceChecker checker)
Creates aSourceVisitor
to use for scanning a source tree.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method 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 tree, P p)
R
visitVariable(com.sun.source.tree.VariableTree variableTree, P p)
-
Methods inherited from class com.sun.source.util.TreeScanner
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
-
-
-
-
Field Detail
-
trees
protected final com.sun.source.util.Trees trees
TheTrees
instance to use for scanning.
-
elements
protected final javax.lang.model.util.Elements elements
TheElements
helper to use when scanning.
-
types
protected final javax.lang.model.util.Types types
TheTypes
helper to use when scanning.
-
root
protected com.sun.source.tree.CompilationUnitTree root
The root of the AST that thisSourceVisitor
will scan.
-
treesWithSuppressWarnings
public final java.util.List<com.sun.source.tree.Tree> treesWithSuppressWarnings
The trees that are annotated with@SuppressWarnings
.
-
-
Constructor Detail
-
SourceVisitor
protected SourceVisitor(SourceChecker checker)
Creates aSourceVisitor
to use for scanning a source tree.- Parameters:
checker
- the checker to invoke on the input source tree
-
-
Method Detail
-
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.
-
-