Class DoubleJavacVisitor
- All Implemented Interfaces:
TreeVisitor<Void,Tree>
.ajava file).
The entry point is scan(Tree, Tree). Given two corresponding trees, scan
performs basic structural checks and then calls Tree.accept(com.sun.source.tree.TreeVisitor<R, D>, D) on the first tree to dispatch
to the appropriate visitXyz method. The visitXyz methods in this base class drive
paired recursion explicitly by calling scan(Tree, Tree) and scanList(List, List) on corresponding child trees.
To use this class, extend it and override defaultAction(Tree, Tree) to perform work
for each matched pair of trees. Subclasses may also override specific visitXyz methods to
customize behavior, but do not need to override root methods such as visitCompilationUnit
or visitClass unless they want to change traversal.
WARNING: This class intentionally does not behave like TreeScanner. Although it subclasses SimpleTreeVisitor, recursion is
not automatic. To recurse, the visitXyz methods in this class and any subclass
must explicitly call scan(com.sun.source.tree.Tree, com.sun.source.tree.Tree) or scanList(java.util.List<? extends com.sun.source.tree.Tree>, java.util.List<? extends com.sun.source.tree.Tree>). This makes recursion explicit and keeps
all paired-tree structural checks in scan(Tree, Tree) rather than duplicating them in
every visitXyz method.
This base visitor does not compare or traverse annotation lists, since annotations may
legitimately differ between a Java file and its corresponding .ajava file. Subclasses may
change that behavior.
-
Field Summary
Fields inherited from class com.sun.source.util.SimpleTreeVisitor
DEFAULT_VALUE -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprotected final voidassertSameKind(@Nullable Tree tree1, @Nullable Tree tree2) Both trees must have the sameTree.Kind.protected final voidassertSameLength(@Nullable List<?> list1, @Nullable List<?> list2) The two list arguments must have the same length.protected abstract VoiddefaultAction(Tree tree1, Tree tree2) Default action performed on each pair of nodes from matching ASTs.final voidTraverses two corresponding trees together by dispatching to the appropriatevisitXyzmethod.final voidTraverses two lists of trees in lockstep by scanning corresponding elements.visitAnnotatedType(AnnotatedTypeTree atree1, Tree tree2) Visits an annotated type and scans its underlying type.visitAnnotation(AnnotationTree atree1, Tree tree2) Visits an annotation and scans its annotation type and arguments.protected voidvisitAnnotationList(List<? extends AnnotationTree> annotations1, List<? extends AnnotationTree> annotations2) Visits two corresponding annotation lists.visitArrayAccess(ArrayAccessTree atree1, Tree tree2) Visits an array access expression and scans its array expression and index.visitArrayType(ArrayTypeTree atree1, Tree tree2) Visits an array type and scans the component type.visitAssert(AssertTree atree1, Tree tree2) Visits an assert statement and scans its condition and detail expression.visitAssignment(AssignmentTree atree1, Tree tree2) Visits an assignment expression and scans its variable and expression.visitBinary(BinaryTree btree1, Tree tree2) Visits a binary expression and scans its left and right operands.visitBindingPattern(BindingPatternTree tree1, Tree tree2) Visits a binding pattern (JDK 16+) and scans its variable.visitBlock(BlockTree btree1, Tree tree2) Visits a block and scans its statements.visitBreak(BreakTree btree1, Tree tree2) Visits a break statement.Visits a case clause and scans its labels, guard expression (JDK 21+), body (rule-case, JDK 12+), and statements (statement-case).visitCatch(CatchTree ctree1, Tree tree2) Visits a catch clause and scans its parameter and block.visitClass(ClassTree ctree1, Tree tree2) Visits a class-like declaration and scans its modifiers, type parameters, superclass, interfaces, permits clause, and members.visitCompilationUnit(CompilationUnitTree ctree1, Tree tree2) Visits a compilation unit (which represents a Java file) and scans its module, package, imports, and top-level type declarations.visitCompoundAssignment(CompoundAssignmentTree ctree1, Tree tree2) Visits a compound assignment expression and scans its variable and expression.visitConditionalExpression(ConditionalExpressionTree ctree1, Tree tree2) Visits a conditional (ternary) expression and scans its condition, true expression, and false expression.visitContinue(ContinueTree ctree1, Tree tree2) Visits a continue statement.visitDoWhileLoop(DoWhileLoopTree dtree1, Tree tree2) Visits a do-while loop and scans its statement and condition.visitEmptyStatement(EmptyStatementTree etree1, Tree tree2) Visits an empty statement (a lone semicolon).visitEnhancedForLoop(EnhancedForLoopTree etree1, Tree tree2) Visits an enhanced for loop and scans its variable, expression, and statement.visitErroneous(ErroneousTree etree1, Tree tree2) Visits an erroneous tree and scans its error trees.visitExports(ExportsTree etree1, Tree tree2) Visits an exports directive and scans its package name and module names.visitExpressionStatement(ExpressionStatementTree etree1, Tree tree2) Visits an expression statement and scans its expression.visitForLoop(ForLoopTree ftree1, Tree tree2) Visits a for loop and scans its initializers, condition, update expressions, and statement.visitIdentifier(IdentifierTree itree1, Tree tree2) Visits an identifier.Visits an if statement and scans its condition, then statement, and else statement.visitImport(ImportTree itree1, Tree tree2) Visits an import declaration and scans its qualified identifier.visitInstanceOf(InstanceOfTree itree1, Tree tree2) Visits an instanceof expression and scans its expression, type, and pattern (JDK 16+).visitIntersectionType(IntersectionTypeTree itree1, Tree tree2) Visits an intersection type and scans its bounds.visitLabeledStatement(LabeledStatementTree ltree1, Tree tree2) Visits a labeled statement and scans its statement.visitLambdaExpression(LambdaExpressionTree ltree1, Tree tree2) Visits a lambda expression and scans its parameters and body.visitLiteral(LiteralTree ltree1, Tree tree2) Visits a literal.visitMemberReference(MemberReferenceTree mtree1, Tree tree2) Visits a member reference (method reference) and scans its qualifier expression and type arguments.visitMemberSelect(MemberSelectTree mtree1, Tree tree2) Visits a member select expression and scans the receiver expression.visitMethod(MethodTree mtree1, Tree tree2) Visits a method or constructor declaration and scans modifiers, type parameters, return type, receiver parameter, formal parameters, throws clause, default value, and body.visitMethodInvocation(MethodInvocationTree mtree1, Tree tree2) Visits a method invocation and scans its type arguments, method select, and arguments.visitModifiers(ModifiersTree mtree1, Tree tree2) Visits a modifiers node.visitModule(ModuleTree mtree1, Tree tree2) Visits a module declaration and scans its name and directives.visitNewArray(NewArrayTree ntree1, Tree tree2) Visits a new array expression and scans its type, dimensions, and initializers.visitNewClass(NewClassTree ntree1, Tree tree2) Visits a new class expression and scans its enclosing expression, type arguments, identifier, arguments, and class body.visitOpens(OpensTree otree1, Tree tree2) Visits an opens directive and scans its package name and module names.visitOther(Tree tree1, Tree tree2) Visits an unknown tree kind.visitPackage(PackageTree ptree1, Tree tree2) Visits a package declaration and scans its annotations and name.visitParameterizedType(ParameterizedTypeTree ptree1, Tree tree2) Visits a parameterized type and scans the base type and type arguments.visitParenthesized(ParenthesizedTree ptree1, Tree tree2) Visits a parenthesized expression and scans its inner expression.visitPrimitiveType(PrimitiveTypeTree ptree1, Tree tree2) Visits a primitive type.visitProvides(ProvidesTree ptree1, Tree tree2) Visits a provides directive and scans its service name and implementation names.visitRequires(RequiresTree rtree1, Tree tree2) Visits a requires directive and scans its module name.visitReturn(ReturnTree rtree1, Tree tree2) Visits a return statement and scans its expression, if present.visitSwitch(SwitchTree stree1, Tree tree2) Visits a switch statement and scans its expression and cases.visitSwitchExpression(SwitchExpressionTree tree1, Tree tree2) Visits a switch expression (JDK 12+) and scans its expression and cases.visitSynchronized(SynchronizedTree stree1, Tree tree2) Visits a synchronized statement and scans its expression and block.visitThrow(ThrowTree ttree1, Tree tree2) Visits a throw statement and scans its thrown expression.Visits a try statement and scans its resources, try block, catch clauses, and finally block.visitTypeCast(TypeCastTree ttree1, Tree tree2) Visits a type cast expression and scans its target type and expression.visitTypeParameter(TypeParameterTree ttree1, Tree tree2) Visits a type parameter and scans its bounds.visitUnary(UnaryTree utree1, Tree tree2) Visits a unary expression and scans its operand.visitUnionType(UnionTypeTree utree1, Tree tree2) Visits a union type (multi-catch) and scans its type alternatives.Visits a uses directive and scans its service name.visitVariable(VariableTree vtree1, Tree tree2) Visits a variable declaration (field, local, parameter) and scans its modifiers, type, and initializer.visitWhileLoop(WhileLoopTree wtree1, Tree tree2) Visits a while loop and scans its condition and statement.visitWildcard(WildcardTree wtree1, Tree tree2) Visits a wildcard type and scans its bound (extends or super), if present.visitYield(YieldTree tree1, Tree tree2) Visits a yield expression (JDK 13+) and scans its value.Methods inherited from class com.sun.source.util.SimpleTreeVisitor
visit, visit, visitAnyPattern, visitConstantCaseLabel, visitDeconstructionPattern, visitDefaultCaseLabel, visitPatternCaseLabel, visitStringTemplate
-
Constructor Details
-
DoubleJavacVisitor
protected DoubleJavacVisitor()Create a DoubleJavacVisitor.
-
-
Method Details
-
defaultAction
Default action performed on each pair of nodes from matching ASTs.This method is called by each
visitXyzmethod in this class before scanning child trees. It does not itself recurse; recursion is driven by thevisitXyzmethods.- Overrides:
defaultActionin classSimpleTreeVisitor<Void,Tree> - Parameters:
tree1- the first tree in the matched pairtree2- the second tree in the matched pair- Returns:
- null
-
visitAnnotationList
protected void visitAnnotationList(List<? extends AnnotationTree> annotations1, List<? extends AnnotationTree> annotations2) Visits two corresponding annotation lists. This base implementation does nothing because annotations may legitimately differ between a Java file and its corresponding.ajavafile. Subclasses may override this method to process annotations.- Parameters:
annotations1- annotation list from the first ASTannotations2- annotation list from the second AST
-
assertSameKind
@EnsuresNonNull({"#1","#2"}) protected final void assertSameKind(@Nullable Tree tree1, @Nullable Tree tree2) Both trees must have the sameTree.Kind.- Parameters:
tree1- the first tree to scan, or nulltree2- the second tree to scan, or null
-
assertSameLength
@EnsuresNonNull({"#1","#2"}) protected final void assertSameLength(@Nullable List<?> list1, @Nullable List<?> list2) The two list arguments must have the same length.- Parameters:
list1- the first list of treeslist2- the second list of trees
-
scan
Traverses two corresponding trees together by dispatching to the appropriatevisitXyzmethod.Both trees must be null, or both trees must have the same
Tree.Kind.- Parameters:
tree1- the first tree to scan, or nulltree2- the second tree to scan, or null
-
scanList
public final void scanList(@Nullable List<? extends Tree> list1, @Nullable List<? extends Tree> list2) Traverses two lists of trees in lockstep by scanning corresponding elements. For each pair of corresponding elements, this method invokesscan(Tree, Tree).The two list arguments must have the same length. Corresponding elements of
list1andlist2must have the same AST structure.- Parameters:
list1- the first list of treeslist2- the second list of trees
-
visitYield
Visits a yield expression (JDK 13+) and scans its value.- Specified by:
visitYieldin interfaceTreeVisitor<Void,Tree> - Overrides:
visitYieldin classSimpleTreeVisitor<Void,Tree> - Parameters:
tree1- yield tree from the first ASTtree2- yield tree from the second AST- Returns:
- null
-
visitSwitchExpression
Visits a switch expression (JDK 12+) and scans its expression and cases.- Specified by:
visitSwitchExpressionin interfaceTreeVisitor<Void,Tree> - Overrides:
visitSwitchExpressionin classSimpleTreeVisitor<Void,Tree> - Parameters:
tree1- switch expression tree from the first ASTtree2- switch expression tree from the second AST- Returns:
- null
-
visitBindingPattern
Visits a binding pattern (JDK 16+) and scans its variable.- Specified by:
visitBindingPatternin interfaceTreeVisitor<Void,Tree> - Overrides:
visitBindingPatternin classSimpleTreeVisitor<Void,Tree> - Parameters:
tree1- binding pattern tree from the first ASTtree2- binding pattern tree from the second AST- Returns:
- null
-
visitCompilationUnit
Visits a compilation unit (which represents a Java file) and scans its module, package, imports, and top-level type declarations.- Specified by:
visitCompilationUnitin interfaceTreeVisitor<Void,Tree> - Overrides:
visitCompilationUnitin classSimpleTreeVisitor<Void,Tree> - Parameters:
ctree1- compilation unit tree from the first ASTtree2- compilation unit tree from the second AST- Returns:
- null
-
visitPackage
Visits a package declaration and scans its annotations and name.- Specified by:
visitPackagein interfaceTreeVisitor<Void,Tree> - Overrides:
visitPackagein classSimpleTreeVisitor<Void,Tree> - Parameters:
ptree1- package tree from the first ASTtree2- package tree from the second AST- Returns:
- null
-
visitImport
Visits an import declaration and scans its qualified identifier.- Specified by:
visitImportin interfaceTreeVisitor<Void,Tree> - Overrides:
visitImportin classSimpleTreeVisitor<Void,Tree> - Parameters:
itree1- import tree from the first ASTtree2- import tree from the second AST- Returns:
- null
-
visitClass
Visits a class-like declaration and scans its modifiers, type parameters, superclass, interfaces, permits clause, and members. For records, record components appear in the members list and are therefore included.- Specified by:
visitClassin interfaceTreeVisitor<Void,Tree> - Overrides:
visitClassin classSimpleTreeVisitor<Void,Tree> - Parameters:
ctree1- class tree from the first ASTtree2- class tree from the second AST- Returns:
- null
-
visitMethod
Visits a method or constructor declaration and scans modifiers, type parameters, return type, receiver parameter, formal parameters, throws clause, default value, and body.- Specified by:
visitMethodin interfaceTreeVisitor<Void,Tree> - Overrides:
visitMethodin classSimpleTreeVisitor<Void,Tree> - Parameters:
mtree1- method tree from the first ASTtree2- method tree from the second AST- Returns:
- null
-
visitVariable
Visits a variable declaration (field, local, parameter) and scans its modifiers, type, and initializer.- Specified by:
visitVariablein interfaceTreeVisitor<Void,Tree> - Overrides:
visitVariablein classSimpleTreeVisitor<Void,Tree> - Parameters:
vtree1- variable tree from the first ASTtree2- variable tree from the second AST- Returns:
- null
-
visitEmptyStatement
Visits an empty statement (a lone semicolon).- Specified by:
visitEmptyStatementin interfaceTreeVisitor<Void,Tree> - Overrides:
visitEmptyStatementin classSimpleTreeVisitor<Void,Tree> - Parameters:
etree1- empty statement tree from the first ASTtree2- empty statement tree from the second AST- Returns:
- null
-
visitBlock
Visits a block and scans its statements.- Specified by:
visitBlockin interfaceTreeVisitor<Void,Tree> - Overrides:
visitBlockin classSimpleTreeVisitor<Void,Tree> - Parameters:
btree1- block tree from the first ASTtree2- block tree from the second AST- Returns:
- null
-
visitDoWhileLoop
Visits a do-while loop and scans its statement and condition.- Specified by:
visitDoWhileLoopin interfaceTreeVisitor<Void,Tree> - Overrides:
visitDoWhileLoopin classSimpleTreeVisitor<Void,Tree> - Parameters:
dtree1- do-while loop tree from the first ASTtree2- do-while loop tree from the second AST- Returns:
- null
-
visitWhileLoop
Visits a while loop and scans its condition and statement.- Specified by:
visitWhileLoopin interfaceTreeVisitor<Void,Tree> - Overrides:
visitWhileLoopin classSimpleTreeVisitor<Void,Tree> - Parameters:
wtree1- while loop tree from the first ASTtree2- while loop tree from the second AST- Returns:
- null
-
visitForLoop
Visits a for loop and scans its initializers, condition, update expressions, and statement.- Specified by:
visitForLoopin interfaceTreeVisitor<Void,Tree> - Overrides:
visitForLoopin classSimpleTreeVisitor<Void,Tree> - Parameters:
ftree1- for loop tree from the first ASTtree2- for loop tree from the second AST- Returns:
- null
-
visitEnhancedForLoop
Visits an enhanced for loop and scans its variable, expression, and statement.- Specified by:
visitEnhancedForLoopin interfaceTreeVisitor<Void,Tree> - Overrides:
visitEnhancedForLoopin classSimpleTreeVisitor<Void,Tree> - Parameters:
etree1- enhanced for loop tree from the first ASTtree2- enhanced for loop tree from the second AST- Returns:
- null
-
visitLabeledStatement
Visits a labeled statement and scans its statement.- Specified by:
visitLabeledStatementin interfaceTreeVisitor<Void,Tree> - Overrides:
visitLabeledStatementin classSimpleTreeVisitor<Void,Tree> - Parameters:
ltree1- labeled statement tree from the first ASTtree2- labeled statement tree from the second AST- Returns:
- null
-
visitSwitch
Visits a switch statement and scans its expression and cases.- Specified by:
visitSwitchin interfaceTreeVisitor<Void,Tree> - Overrides:
visitSwitchin classSimpleTreeVisitor<Void,Tree> - Parameters:
stree1- switch tree from the first ASTtree2- switch tree from the second AST- Returns:
- null
-
visitCase
Visits a case clause and scans its labels, guard expression (JDK 21+), body (rule-case, JDK 12+), and statements (statement-case). UsesTreeUtilsAfterJava17.CaseUtilsto handle JDK 12+ and 21+ API differences. For a given case, exactly one ofbodyorstatementswill be non-null;scanList(java.util.List<? extends com.sun.source.tree.Tree>, java.util.List<? extends com.sun.source.tree.Tree>)handles null.- Specified by:
visitCasein interfaceTreeVisitor<Void,Tree> - Overrides:
visitCasein classSimpleTreeVisitor<Void,Tree> - Parameters:
ctree1- case tree from the first ASTtree2- case tree from the second AST- Returns:
- null
-
visitSynchronized
Visits a synchronized statement and scans its expression and block.- Specified by:
visitSynchronizedin interfaceTreeVisitor<Void,Tree> - Overrides:
visitSynchronizedin classSimpleTreeVisitor<Void,Tree> - Parameters:
stree1- synchronized tree from the first ASTtree2- synchronized tree from the second AST- Returns:
- null
-
visitTry
Visits a try statement and scans its resources, try block, catch clauses, and finally block.- Specified by:
visitTryin interfaceTreeVisitor<Void,Tree> - Overrides:
visitTryin classSimpleTreeVisitor<Void,Tree> - Parameters:
ttree1- try tree from the first ASTtree2- try tree from the second AST- Returns:
- null
-
visitCatch
Visits a catch clause and scans its parameter and block.- Specified by:
visitCatchin interfaceTreeVisitor<Void,Tree> - Overrides:
visitCatchin classSimpleTreeVisitor<Void,Tree> - Parameters:
ctree1- catch tree from the first ASTtree2- catch tree from the second AST- Returns:
- null
-
visitConditionalExpression
Visits a conditional (ternary) expression and scans its condition, true expression, and false expression.- Specified by:
visitConditionalExpressionin interfaceTreeVisitor<Void,Tree> - Overrides:
visitConditionalExpressionin classSimpleTreeVisitor<Void,Tree> - Parameters:
ctree1- conditional expression tree from the first ASTtree2- conditional expression tree from the second AST- Returns:
- null
-
visitIf
Visits an if statement and scans its condition, then statement, and else statement.- Specified by:
visitIfin interfaceTreeVisitor<Void,Tree> - Overrides:
visitIfin classSimpleTreeVisitor<Void,Tree> - Parameters:
itree1- if tree from the first ASTtree2- if tree from the second AST- Returns:
- null
-
visitExpressionStatement
Visits an expression statement and scans its expression.- Specified by:
visitExpressionStatementin interfaceTreeVisitor<Void,Tree> - Overrides:
visitExpressionStatementin classSimpleTreeVisitor<Void,Tree> - Parameters:
etree1- expression statement from the first ASTtree2- expression statement from the second AST- Returns:
- null
-
visitBreak
Visits a break statement.- Specified by:
visitBreakin interfaceTreeVisitor<Void,Tree> - Overrides:
visitBreakin classSimpleTreeVisitor<Void,Tree> - Parameters:
btree1- break tree from the first ASTtree2- break tree from the second AST- Returns:
- null
-
visitContinue
Visits a continue statement.- Specified by:
visitContinuein interfaceTreeVisitor<Void,Tree> - Overrides:
visitContinuein classSimpleTreeVisitor<Void,Tree> - Parameters:
ctree1- continue tree from the first ASTtree2- continue tree from the second AST- Returns:
- null
-
visitReturn
Visits a return statement and scans its expression, if present.- Specified by:
visitReturnin interfaceTreeVisitor<Void,Tree> - Overrides:
visitReturnin classSimpleTreeVisitor<Void,Tree> - Parameters:
rtree1- return tree from the first ASTtree2- return tree from the second AST- Returns:
- null
-
visitThrow
Visits a throw statement and scans its thrown expression.- Specified by:
visitThrowin interfaceTreeVisitor<Void,Tree> - Overrides:
visitThrowin classSimpleTreeVisitor<Void,Tree> - Parameters:
ttree1- throw tree from the first ASTtree2- throw tree from the second AST- Returns:
- null
-
visitAssert
Visits an assert statement and scans its condition and detail expression.- Specified by:
visitAssertin interfaceTreeVisitor<Void,Tree> - Overrides:
visitAssertin classSimpleTreeVisitor<Void,Tree> - Parameters:
atree1- assert tree from the first ASTtree2- assert tree from the second AST- Returns:
- null
-
visitMethodInvocation
Visits a method invocation and scans its type arguments, method select, and arguments.- Specified by:
visitMethodInvocationin interfaceTreeVisitor<Void,Tree> - Overrides:
visitMethodInvocationin classSimpleTreeVisitor<Void,Tree> - Parameters:
mtree1- method invocation tree from the first ASTtree2- method invocation tree from the second AST- Returns:
- null
-
visitNewClass
Visits a new class expression and scans its enclosing expression, type arguments, identifier, arguments, and class body.- Specified by:
visitNewClassin interfaceTreeVisitor<Void,Tree> - Overrides:
visitNewClassin classSimpleTreeVisitor<Void,Tree> - Parameters:
ntree1- new class tree from the first ASTtree2- new class tree from the second AST- Returns:
- null
-
visitNewArray
Visits a new array expression and scans its type, dimensions, and initializers.- Specified by:
visitNewArrayin interfaceTreeVisitor<Void,Tree> - Overrides:
visitNewArrayin classSimpleTreeVisitor<Void,Tree> - Parameters:
ntree1- new array tree from the first ASTtree2- new array tree from the second AST- Returns:
- null
-
visitLambdaExpression
Visits a lambda expression and scans its parameters and body.- Specified by:
visitLambdaExpressionin interfaceTreeVisitor<Void,Tree> - Overrides:
visitLambdaExpressionin classSimpleTreeVisitor<Void,Tree> - Parameters:
ltree1- lambda expression tree from the first ASTtree2- lambda expression tree from the second AST- Returns:
- null
-
visitParenthesized
Visits a parenthesized expression and scans its inner expression.- Specified by:
visitParenthesizedin interfaceTreeVisitor<Void,Tree> - Overrides:
visitParenthesizedin classSimpleTreeVisitor<Void,Tree> - Parameters:
ptree1- parenthesized tree from the first ASTtree2- parenthesized tree from the second AST- Returns:
- null
-
visitAssignment
Visits an assignment expression and scans its variable and expression.- Specified by:
visitAssignmentin interfaceTreeVisitor<Void,Tree> - Overrides:
visitAssignmentin classSimpleTreeVisitor<Void,Tree> - Parameters:
atree1- assignment tree from the first ASTtree2- assignment tree from the second AST- Returns:
- null
-
visitCompoundAssignment
Visits a compound assignment expression and scans its variable and expression.- Specified by:
visitCompoundAssignmentin interfaceTreeVisitor<Void,Tree> - Overrides:
visitCompoundAssignmentin classSimpleTreeVisitor<Void,Tree> - Parameters:
ctree1- compound assignment tree from the first ASTtree2- compound assignment tree from the second AST- Returns:
- null
-
visitUnary
Visits a unary expression and scans its operand.- Specified by:
visitUnaryin interfaceTreeVisitor<Void,Tree> - Overrides:
visitUnaryin classSimpleTreeVisitor<Void,Tree> - Parameters:
utree1- unary tree from the first ASTtree2- unary tree from the second AST- Returns:
- null
-
visitBinary
Visits a binary expression and scans its left and right operands.- Specified by:
visitBinaryin interfaceTreeVisitor<Void,Tree> - Overrides:
visitBinaryin classSimpleTreeVisitor<Void,Tree> - Parameters:
btree1- binary tree from the first ASTtree2- binary tree from the second AST- Returns:
- null
-
visitTypeCast
Visits a type cast expression and scans its target type and expression.- Specified by:
visitTypeCastin interfaceTreeVisitor<Void,Tree> - Overrides:
visitTypeCastin classSimpleTreeVisitor<Void,Tree> - Parameters:
ttree1- type cast tree from the first ASTtree2- type cast tree from the second AST- Returns:
- null
-
visitInstanceOf
Visits an instanceof expression and scans its expression, type, and pattern (JDK 16+).- Specified by:
visitInstanceOfin interfaceTreeVisitor<Void,Tree> - Overrides:
visitInstanceOfin classSimpleTreeVisitor<Void,Tree> - Parameters:
itree1- instanceof tree from the first ASTtree2- instanceof tree from the second AST- Returns:
- null
-
visitArrayAccess
Visits an array access expression and scans its array expression and index.- Specified by:
visitArrayAccessin interfaceTreeVisitor<Void,Tree> - Overrides:
visitArrayAccessin classSimpleTreeVisitor<Void,Tree> - Parameters:
atree1- array access tree from the first ASTtree2- array access tree from the second AST- Returns:
- null
-
visitMemberSelect
Visits a member select expression and scans the receiver expression.- Specified by:
visitMemberSelectin interfaceTreeVisitor<Void,Tree> - Overrides:
visitMemberSelectin classSimpleTreeVisitor<Void,Tree> - Parameters:
mtree1- member select tree from the first ASTtree2- member select tree from the second AST- Returns:
- null
-
visitMemberReference
Visits a member reference (method reference) and scans its qualifier expression and type arguments.- Specified by:
visitMemberReferencein interfaceTreeVisitor<Void,Tree> - Overrides:
visitMemberReferencein classSimpleTreeVisitor<Void,Tree> - Parameters:
mtree1- member reference tree from the first ASTtree2- member reference tree from the second AST- Returns:
- null
-
visitIdentifier
Visits an identifier.- Specified by:
visitIdentifierin interfaceTreeVisitor<Void,Tree> - Overrides:
visitIdentifierin classSimpleTreeVisitor<Void,Tree> - Parameters:
itree1- identifier tree from the first ASTtree2- identifier tree from the second AST- Returns:
- null
-
visitLiteral
Visits a literal.- Specified by:
visitLiteralin interfaceTreeVisitor<Void,Tree> - Overrides:
visitLiteralin classSimpleTreeVisitor<Void,Tree> - Parameters:
ltree1- literal tree from the first ASTtree2- literal tree from the second AST- Returns:
- null
-
visitPrimitiveType
Visits a primitive type.- Specified by:
visitPrimitiveTypein interfaceTreeVisitor<Void,Tree> - Overrides:
visitPrimitiveTypein classSimpleTreeVisitor<Void,Tree> - Parameters:
ptree1- primitive type tree from the first ASTtree2- primitive type tree from the second AST- Returns:
- null
-
visitArrayType
Visits an array type and scans the component type.- Specified by:
visitArrayTypein interfaceTreeVisitor<Void,Tree> - Overrides:
visitArrayTypein classSimpleTreeVisitor<Void,Tree> - Parameters:
atree1- array type tree from the first ASTtree2- array type tree from the second AST- Returns:
- null
-
visitParameterizedType
Visits a parameterized type and scans the base type and type arguments.- Specified by:
visitParameterizedTypein interfaceTreeVisitor<Void,Tree> - Overrides:
visitParameterizedTypein classSimpleTreeVisitor<Void,Tree> - Parameters:
ptree1- parameterized type tree from the first ASTtree2- parameterized type tree from the second AST- Returns:
- null
-
visitUnionType
Visits a union type (multi-catch) and scans its type alternatives.- Specified by:
visitUnionTypein interfaceTreeVisitor<Void,Tree> - Overrides:
visitUnionTypein classSimpleTreeVisitor<Void,Tree> - Parameters:
utree1- union type tree from the first ASTtree2- union type tree from the second AST- Returns:
- null
-
visitIntersectionType
Visits an intersection type and scans its bounds.- Specified by:
visitIntersectionTypein interfaceTreeVisitor<Void,Tree> - Overrides:
visitIntersectionTypein classSimpleTreeVisitor<Void,Tree> - Parameters:
itree1- intersection type tree from the first ASTtree2- intersection type tree from the second AST- Returns:
- null
-
visitTypeParameter
Visits a type parameter and scans its bounds.- Specified by:
visitTypeParameterin interfaceTreeVisitor<Void,Tree> - Overrides:
visitTypeParameterin classSimpleTreeVisitor<Void,Tree> - Parameters:
ttree1- type parameter tree from the first ASTtree2- type parameter tree from the second AST- Returns:
- null
-
visitWildcard
Visits a wildcard type and scans its bound (extends or super), if present.The wildcard direction (
extendsvs.super) is enforced byscan(Tree, Tree), which checks that both trees have the sameTree.Kind.- Specified by:
visitWildcardin interfaceTreeVisitor<Void,Tree> - Overrides:
visitWildcardin classSimpleTreeVisitor<Void,Tree> - Parameters:
wtree1- wildcard tree from the first ASTtree2- wildcard tree from the second AST- Returns:
- null
-
visitModifiers
Visits a modifiers node.- Specified by:
visitModifiersin interfaceTreeVisitor<Void,Tree> - Overrides:
visitModifiersin classSimpleTreeVisitor<Void,Tree> - Parameters:
mtree1- modifiers tree from the first ASTtree2- modifiers tree from the second AST- Returns:
- null
-
visitAnnotation
Visits an annotation and scans its annotation type and arguments.- Specified by:
visitAnnotationin interfaceTreeVisitor<Void,Tree> - Overrides:
visitAnnotationin classSimpleTreeVisitor<Void,Tree> - Parameters:
atree1- annotation tree from the first ASTtree2- annotation tree from the second AST- Returns:
- null
-
visitAnnotatedType
Visits an annotated type and scans its underlying type.- Specified by:
visitAnnotatedTypein interfaceTreeVisitor<Void,Tree> - Overrides:
visitAnnotatedTypein classSimpleTreeVisitor<Void,Tree> - Parameters:
atree1- annotated type tree from the first ASTtree2- annotated type tree from the second AST- Returns:
- null
-
visitModule
Visits a module declaration and scans its name and directives.- Specified by:
visitModulein interfaceTreeVisitor<Void,Tree> - Overrides:
visitModulein classSimpleTreeVisitor<Void,Tree> - Parameters:
mtree1- module tree from the first ASTtree2- module tree from the second AST- Returns:
- null
-
visitExports
Visits an exports directive and scans its package name and module names.- Specified by:
visitExportsin interfaceTreeVisitor<Void,Tree> - Overrides:
visitExportsin classSimpleTreeVisitor<Void,Tree> - Parameters:
etree1- exports tree from the first ASTtree2- exports tree from the second AST- Returns:
- null
-
visitOpens
Visits an opens directive and scans its package name and module names.- Specified by:
visitOpensin interfaceTreeVisitor<Void,Tree> - Overrides:
visitOpensin classSimpleTreeVisitor<Void,Tree> - Parameters:
otree1- opens tree from the first ASTtree2- opens tree from the second AST- Returns:
- null
-
visitProvides
Visits a provides directive and scans its service name and implementation names.- Specified by:
visitProvidesin interfaceTreeVisitor<Void,Tree> - Overrides:
visitProvidesin classSimpleTreeVisitor<Void,Tree> - Parameters:
ptree1- provides tree from the first ASTtree2- provides tree from the second AST- Returns:
- null
-
visitRequires
Visits a requires directive and scans its module name.- Specified by:
visitRequiresin interfaceTreeVisitor<Void,Tree> - Overrides:
visitRequiresin classSimpleTreeVisitor<Void,Tree> - Parameters:
rtree1- requires tree from the first ASTtree2- requires tree from the second AST- Returns:
- null
-
visitUses
Visits a uses directive and scans its service name.- Specified by:
visitUsesin interfaceTreeVisitor<Void,Tree> - Overrides:
visitUsesin classSimpleTreeVisitor<Void,Tree> - Parameters:
utree1- uses tree from the first ASTtree2- uses tree from the second AST- Returns:
- null
-
visitErroneous
Visits an erroneous tree and scans its error trees.- Specified by:
visitErroneousin interfaceTreeVisitor<Void,Tree> - Overrides:
visitErroneousin classSimpleTreeVisitor<Void,Tree> - Parameters:
etree1- erroneous tree from the first ASTtree2- erroneous tree from the second AST- Returns:
- null
-
visitOther
Visits an unknown tree kind.- Specified by:
visitOtherin interfaceTreeVisitor<Void,Tree> - Overrides:
visitOtherin classSimpleTreeVisitor<Void,Tree> - Parameters:
tree1- tree from the first ASTtree2- tree from the second AST- Returns:
- null
-