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 ElementsTheElementshelper to use when scanning.protected com.sun.source.tree.CompilationUnitTreeThe root of the AST that thisSourceVisitorwill scan.protected final com.sun.source.util.TreesTheTreesinstance to use for scanning.final List<com.sun.source.tree.Tree>The trees that are annotated with@SuppressWarnings.protected final TypesTheTypeshelper to use when scanning. -
Constructor Summary
ConstructorsModifierConstructorDescriptionprotectedSourceVisitor(SourceChecker checker) Creates aSourceVisitorto use for scanning a source tree. -
Method Summary
Modifier and TypeMethodDescriptionvoidsetRoot(com.sun.source.tree.CompilationUnitTree root) Set the CompilationUnitTree to be used during any visits.voidvisit(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, scanMethods 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 treesTheTreesinstance to use for scanning. -
elements
TheElementshelper to use when scanning. -
types
TheTypeshelper to use when scanning. -
root
protected com.sun.source.tree.CompilationUnitTree rootThe root of the AST that thisSourceVisitorwill scan. -
treesWithSuppressWarnings
The trees that are annotated with@SuppressWarnings.
-
-
Constructor Details
-
SourceVisitor
Creates aSourceVisitorto 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
-