Class NewScanner
java.lang.Object
com.sun.source.util.TreeScanner<Void,Void>
com.sun.source.util.TreePathScanner<Void,Void>
org.checkerframework.afu.annotator.scanner.CommonScanner
org.checkerframework.afu.annotator.scanner.NewScanner
- All Implemented Interfaces:
TreeVisitor<Void,
Void>
NewScanner scans the source tree and determines the index of a given new, where the i^th index
corresponds to the i^th new, using 0-based indexing.
-
Method Summary
Modifier and TypeMethodDescriptionstatic void
addNewToMethod
(String methodName, Integer offset) static void
static Integer
getMethodNewIndex
(String methodName, Integer offset) static int
indexOfNewTree
(TreePath origpath, Tree tree) Computes the index of the given new tree amongst all new trees inside its method, using 0-based indexing.visitNewArray
(NewArrayTree node, Void p) visitNewClass
(NewClassTree node, Void p) Methods inherited from class org.checkerframework.afu.annotator.scanner.CommonScanner
visitClass
Methods inherited from class com.sun.source.util.TreePathScanner
getCurrentPath, scan, scan
Methods 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, visitMethod, visitMethodInvocation, visitModifiers, visitModule, visitOpens, visitOther, visitPackage, visitParameterizedType, visitParenthesized, visitPatternCaseLabel, visitPrimitiveType, visitProvides, visitRequires, visitReturn, visitStringTemplate, visitSwitch, visitSwitchExpression, visitSynchronized, visitThrow, visitTry, visitTypeCast, visitTypeParameter, visitUnary, visitUnionType, visitUses, visitVariable, visitWhileLoop, visitWildcard, visitYield
-
Method Details
-
indexOfNewTree
Computes the index of the given new tree amongst all new trees inside its method, using 0-based indexing. The tree has to be either a NewClassTree or a NewArrayTree. If the tree is not in a method, then the index is computed- Parameters:
origpath
- the path ending in the given cast treetree
- the cast tree to search for- Returns:
- the index of the given cast tree
-
visitNewClass
- Specified by:
visitNewClass
in interfaceTreeVisitor<Void,
Void> - Overrides:
visitNewClass
in classTreeScanner<Void,
Void>
-
visitNewArray
- Specified by:
visitNewArray
in interfaceTreeVisitor<Void,
Void> - Overrides:
visitNewArray
in classTreeScanner<Void,
Void>
-
debug
-
addNewToMethod
-
getMethodNewIndex
-