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
FieldsModifier and TypeFieldDescriptionprotected final ElementsTheElementshelper to use when scanning.protected CompilationUnitTreeThe root of the AST that thisSourceVisitorwill scan.protected final TreesTheTreesinstance to use for scanning.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(CompilationUnitTree newRoot) Set the CompilationUnitTree to be used during any visits.voidEntry 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, scanMethods inherited from class com.sun.source.util.TreeScanner
reduce, scan, visitAnnotatedType, visitAnnotation, visitAnyPattern, visitArrayAccess, visitArrayType, visitAssert, visitAssignment, visitBinary, visitBindingPattern, visitBlock, visitBreak, visitCase, visitCatch, visitCompilationUnit, visitCompoundAssignment, visitConditionalExpression, visitConstantCaseLabel, visitContinue, visitDeconstructionPattern, visitDefaultCaseLabel, 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, visitPatternCaseLabel, visitPrimitiveType, visitProvides, visitRequires, visitReturn, visitStringTemplate, visitSwitch, visitSwitchExpression, visitSynchronized, visitThrow, visitTry, visitTypeCast, visitTypeParameter, visitUnary, visitUnionType, visitUses, visitWhileLoop, visitWildcard, visitYield
-
Field Details
-
trees
TheTreesinstance to use for scanning. -
elements
TheElementshelper to use when scanning. -
types
TheTypeshelper to use when scanning. -
root
The 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
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.- Parameters:
newRoot- the new compilation unit
-
visit
Entry point for a type processor: the TreePath leaf is a top-level type tree within root. -
scan
- Overrides:
scanin classTreePathScanner<R,P>
-
visitClass
- Specified by:
visitClassin interfaceTreeVisitor<R,P> - Overrides:
visitClassin classTreeScanner<R,P>
-
visitVariable
- Specified by:
visitVariablein interfaceTreeVisitor<R,P> - Overrides:
visitVariablein classTreeScanner<R,P>
-
visitMethod
- Specified by:
visitMethodin interfaceTreeVisitor<R,P> - Overrides:
visitMethodin classTreeScanner<R,P>
-