1 /******************************************************************************* 2 * Copyright (c) 2000, 2020 IBM Corporation and others. 3 * 4 * This program and the accompanying materials 5 * are made available under the terms of the Eclipse Public License 2.0 6 * which accompanies this distribution, and is available at 7 * https://www.eclipse.org/legal/epl-2.0/ 8 * 9 * SPDX-License-Identifier: EPL-2.0 10 * 11 * Contributors: 12 * IBM Corporation - initial API and implementation 13 *******************************************************************************/ 14 15 package org.eclipse.jdt.core.dom; 16 17 /** 18 * A visitor for abstract syntax trees. 19 * <p> 20 * For each different concrete AST node type <i>T</i> there are 21 * a pair of methods: 22 * <ul> 23 * <li><code>public boolean visit(<i>T</i> node)</code> - Visits 24 * the given node to perform some arbitrary operation. If <code>true</code> 25 * is returned, the given node's child nodes will be visited next; however, 26 * if <code>false</code> is returned, the given node's child nodes will 27 * not be visited. The default implementation provided by this class does 28 * nothing and returns <code>true</code> (with the exception of 29 * {@link #visit(Javadoc) ASTVisitor.visit(Javadoc)}). 30 * Subclasses may reimplement this method as needed.</li> 31 * <li><code>public void endVisit(<i>T</i> node)</code> - Visits 32 * the given node to perform some arbitrary operation. When used in the 33 * conventional way, this method is called after all of the given node's 34 * children have been visited (or immediately, if <code>visit</code> returned 35 * <code>false</code>). The default implementation provided by this class does 36 * nothing. Subclasses may reimplement this method as needed.</li> 37 * </ul> 38 * <p> 39 * In addition, there are a pair of methods for visiting AST nodes in the 40 * abstract, regardless of node type: 41 * <ul> 42 * <li><code>public void preVisit(ASTNode node)</code> - Visits 43 * the given node to perform some arbitrary operation. 44 * This method is invoked prior to the appropriate type-specific 45 * <code>visit</code> method. 46 * The default implementation of this method does nothing. 47 * Subclasses may reimplement this method as needed.</li> 48 * <li><code>public void postVisit(ASTNode node)</code> - Visits 49 * the given node to perform some arbitrary operation. 50 * This method is invoked after the appropriate type-specific 51 * <code>endVisit</code> method. 52 * The default implementation of this method does nothing. 53 * Subclasses may reimplement this method as needed.</li> 54 * </ul> 55 * <p> 56 * For nodes with list-valued properties, the child nodes within the list 57 * are visited in order. For nodes with multiple properties, the child nodes 58 * are visited in the order that most closely corresponds to the lexical 59 * reading order of the source program. For instance, for a type declaration 60 * node, the child ordering is: name, superclass, superinterfaces, and 61 * body declarations. 62 * </p> 63 * <p> 64 * While it is possible to modify the tree in the visitor, care is required to 65 * ensure that the consequences are as expected and desirable. 66 * During the course of an ordinary visit starting at a given node, every node 67 * in the subtree is visited exactly twice, first with <code>visit</code> and 68 * then with <code>endVisit</code>. During a traversal of a stationary tree, 69 * each node is either behind (after <code>endVisit</code>), ahead (before 70 * <code>visit</code>), or in progress (between <code>visit</code> and 71 * the matching <code>endVisit</code>). Changes to the "behind" region of the 72 * tree are of no consequence to the visit in progress. Changes to the "ahead" 73 * region will be taken in stride. Changes to the "in progress" portion are 74 * the more interesting cases. With a node, the various properties are arranged 75 * in a linear list, with a cursor that separates the properties that have 76 * been visited from the ones that are still to be visited (the cursor 77 * is between the elements, rather than on an element). The cursor moves from 78 * the head to the tail of this list, advancing to the next position just 79 * <i>before</i> <code>visit</code> if called for that child. After the child 80 * subtree has been completely visited, the visit moves on the child 81 * immediately after the cursor. Removing a child while it is being visited 82 * does not alter the course of the visit. But any children added at positions 83 * after the cursor are considered in the "ahead" portion and will be visited. 84 * </p> 85 * <p> 86 * Cases to watch out for: 87 * <ul> 88 * <li>Moving a child node further down the list. This could result in the 89 * child subtree being visited multiple times; these visits are sequential.</li> 90 * <li>Moving a child node up into an ancestor. If the new home for 91 * the node is in the "ahead" portion, the subtree will be visited 92 * a second time; again, these visits are sequential.</li> 93 * <li>Moving a node down into a child. If the new home for 94 * the node is in the "ahead" portion, the subtree will be visited 95 * a second time; in this case, the visits will be nested. In some cases, 96 * this can lead to a stack overflow or out of memory condition.</li> 97 * </ul> 98 * <p>Note that {@link LineComment} and {@link BlockComment} nodes are 99 * not normally visited in an AST because they are not considered 100 * part of main structure of the AST. Use 101 * {@link CompilationUnit#getCommentList()} to find these additional 102 * comments nodes. 103 * </p> 104 * 105 * @see org.eclipse.jdt.core.dom.ASTNode#accept(ASTVisitor) 106 */ 107 public abstract class ASTVisitor { 108 109 /** 110 * Indicates whether doc tags should be visited by default. 111 * @since 3.0 112 */ 113 private boolean visitDocTags; 114 115 /** 116 * Creates a new AST visitor instance. 117 * <p> 118 * For backwards compatibility, the visitor does not visit tag 119 * elements below doc comments by default. Use 120 * {@link #ASTVisitor(boolean) ASTVisitor(true)} 121 * for an visitor that includes doc comments by default. 122 * </p> 123 */ ASTVisitor()124 public ASTVisitor() { 125 this(false); 126 } 127 128 /** 129 * Creates a new AST visitor instance. 130 * 131 * @param visitDocTags <code>true</code> if doc comment tags are 132 * to be visited by default, and <code>false</code> otherwise 133 * @see Javadoc#tags() 134 * @see #visit(Javadoc) 135 * @since 3.0 136 */ ASTVisitor(boolean visitDocTags)137 public ASTVisitor(boolean visitDocTags) { 138 this.visitDocTags = visitDocTags; 139 } 140 141 /** 142 * Visits the given AST node prior to the type-specific visit 143 * (before <code>visit</code>). 144 * <p> 145 * The default implementation does nothing. Subclasses may reimplement. 146 * </p> 147 * 148 * @param node the node to visit 149 * 150 * @see #preVisit2(ASTNode) 151 */ preVisit(ASTNode node)152 public void preVisit(ASTNode node) { 153 // default implementation: do nothing 154 } 155 156 /** 157 * Visits the given AST node prior to the type-specific visit (before <code>visit</code>). 158 * <p> 159 * The default implementation calls {@link #preVisit(ASTNode)} and then 160 * returns true. Subclasses may reimplement. 161 * </p> 162 * 163 * @param node the node to visit 164 * @return <code>true</code> if <code>visit(node)</code> should be called, 165 * and <code>false</code> otherwise. 166 * @see #preVisit(ASTNode) 167 * @since 3.5 168 */ preVisit2(ASTNode node)169 public boolean preVisit2(ASTNode node) { 170 preVisit(node); 171 return true; 172 } 173 174 /** 175 * Visits the given AST node following the type-specific visit 176 * (after <code>endVisit</code>). 177 * <p> 178 * The default implementation does nothing. Subclasses may reimplement. 179 * </p> 180 * 181 * @param node the node to visit 182 */ postVisit(ASTNode node)183 public void postVisit(ASTNode node) { 184 // default implementation: do nothing 185 } 186 187 188 /** 189 * Visits the given type-specific AST node. 190 * <p> 191 * The default implementation does nothing and return true. 192 * Subclasses may reimplement. 193 * </p> 194 * 195 * @param node the node to visit 196 * @return <code>true</code> if the children of this node should be 197 * visited, and <code>false</code> if the children of this node should 198 * be skipped 199 * @since 3.1 200 */ visit(AnnotationTypeDeclaration node)201 public boolean visit(AnnotationTypeDeclaration node) { 202 return true; 203 } 204 205 /** 206 * Visits the given type-specific AST node. 207 * <p> 208 * The default implementation does nothing and return true. 209 * Subclasses may reimplement. 210 * </p> 211 * 212 * @param node the node to visit 213 * @return <code>true</code> if the children of this node should be 214 * visited, and <code>false</code> if the children of this node should 215 * be skipped 216 * @since 3.1 217 */ visit(AnnotationTypeMemberDeclaration node)218 public boolean visit(AnnotationTypeMemberDeclaration node) { 219 return true; 220 } 221 222 /** 223 * Visits the given type-specific AST node. 224 * <p> 225 * The default implementation does nothing and return true. 226 * Subclasses may reimplement. 227 * </p> 228 * 229 * @param node the node to visit 230 * @return <code>true</code> if the children of this node should be 231 * visited, and <code>false</code> if the children of this node should 232 * be skipped 233 */ visit(AnonymousClassDeclaration node)234 public boolean visit(AnonymousClassDeclaration node) { 235 return true; 236 } 237 238 /** 239 * Visits the given type-specific AST node. 240 * <p> 241 * The default implementation does nothing and return true. 242 * Subclasses may reimplement. 243 * </p> 244 * 245 * @param node the node to visit 246 * @return <code>true</code> if the children of this node should be 247 * visited, and <code>false</code> if the children of this node should 248 * be skipped 249 */ visit(ArrayAccess node)250 public boolean visit(ArrayAccess node) { 251 return true; 252 } 253 254 /** 255 * Visits the given type-specific AST node. 256 * <p> 257 * The default implementation does nothing and return true. 258 * Subclasses may reimplement. 259 * </p> 260 * 261 * @param node the node to visit 262 * @return <code>true</code> if the children of this node should be 263 * visited, and <code>false</code> if the children of this node should 264 * be skipped 265 */ visit(ArrayCreation node)266 public boolean visit(ArrayCreation node) { 267 return true; 268 } 269 270 /** 271 * Visits the given type-specific AST node. 272 * <p> 273 * The default implementation does nothing and return true. 274 * Subclasses may reimplement. 275 * </p> 276 * 277 * @param node the node to visit 278 * @return <code>true</code> if the children of this node should be 279 * visited, and <code>false</code> if the children of this node should 280 * be skipped 281 */ visit(ArrayInitializer node)282 public boolean visit(ArrayInitializer node) { 283 return true; 284 } 285 286 /** 287 * Visits the given type-specific AST node. 288 * <p> 289 * The default implementation does nothing and return true. 290 * Subclasses may reimplement. 291 * </p> 292 * 293 * @param node the node to visit 294 * @return <code>true</code> if the children of this node should be 295 * visited, and <code>false</code> if the children of this node should 296 * be skipped 297 */ visit(ArrayType node)298 public boolean visit(ArrayType node) { 299 return true; 300 } 301 302 /** 303 * Visits the given type-specific AST node. 304 * <p> 305 * The default implementation does nothing and return true. 306 * Subclasses may reimplement. 307 * </p> 308 * 309 * @param node the node to visit 310 * @return <code>true</code> if the children of this node should be 311 * visited, and <code>false</code> if the children of this node should 312 * be skipped 313 */ visit(AssertStatement node)314 public boolean visit(AssertStatement node) { 315 return true; 316 } 317 318 /** 319 * Visits the given type-specific AST node. 320 * <p> 321 * The default implementation does nothing and return true. 322 * Subclasses may reimplement. 323 * </p> 324 * 325 * @param node the node to visit 326 * @return <code>true</code> if the children of this node should be 327 * visited, and <code>false</code> if the children of this node should 328 * be skipped 329 */ visit(Assignment node)330 public boolean visit(Assignment node) { 331 return true; 332 } 333 334 /** 335 * Visits the given type-specific AST node. 336 * <p> 337 * The default implementation does nothing and return true. 338 * Subclasses may reimplement. 339 * </p> 340 * 341 * @param node the node to visit 342 * @return <code>true</code> if the children of this node should be 343 * visited, and <code>false</code> if the children of this node should 344 * be skipped 345 */ visit(Block node)346 public boolean visit(Block node) { 347 return true; 348 } 349 350 351 /** 352 * Visits the given type-specific AST node. 353 * <p> 354 * The default implementation does nothing and return true. 355 * Subclasses may reimplement. 356 * </p> 357 * <p>Note: {@link LineComment} and {@link BlockComment} nodes are 358 * not considered part of main structure of the AST. This method will 359 * only be called if a client goes out of their way to visit this 360 * kind of node explicitly. 361 * </p> 362 * 363 * @param node the node to visit 364 * @return <code>true</code> if the children of this node should be 365 * visited, and <code>false</code> if the children of this node should 366 * be skipped 367 * @since 3.0 368 */ visit(BlockComment node)369 public boolean visit(BlockComment node) { 370 return true; 371 } 372 373 /** 374 * Visits the given type-specific AST node. 375 * <p> 376 * The default implementation does nothing and return true. 377 * Subclasses may reimplement. 378 * </p> 379 * 380 * @param node the node to visit 381 * @return <code>true</code> if the children of this node should be 382 * visited, and <code>false</code> if the children of this node should 383 * be skipped 384 */ visit(BooleanLiteral node)385 public boolean visit(BooleanLiteral node) { 386 return true; 387 } 388 389 /** 390 * Visits the given type-specific AST node. 391 * <p> 392 * The default implementation does nothing and return true. 393 * Subclasses may reimplement. 394 * </p> 395 * 396 * @param node the node to visit 397 * @return <code>true</code> if the children of this node should be 398 * visited, and <code>false</code> if the children of this node should 399 * be skipped 400 */ visit(BreakStatement node)401 public boolean visit(BreakStatement node) { 402 return true; 403 } 404 405 /** 406 * Visits the given type-specific AST node. 407 * <p> 408 * The default implementation does nothing and return true. 409 * Subclasses may reimplement. 410 * </p> 411 * 412 * @param node the node to visit 413 * @return <code>true</code> if the children of this node should be 414 * visited, and <code>false</code> if the children of this node should 415 * be skipped 416 */ visit(CastExpression node)417 public boolean visit(CastExpression node) { 418 return true; 419 } 420 421 /** 422 * Visits the given type-specific AST node. 423 * <p> 424 * The default implementation does nothing and return true. 425 * Subclasses may reimplement. 426 * </p> 427 * 428 * @param node the node to visit 429 * @return <code>true</code> if the children of this node should be 430 * visited, and <code>false</code> if the children of this node should 431 * be skipped 432 */ visit(CatchClause node)433 public boolean visit(CatchClause node) { 434 return true; 435 } 436 437 /** 438 * Visits the given type-specific AST node. 439 * <p> 440 * The default implementation does nothing and return true. 441 * Subclasses may reimplement. 442 * </p> 443 * 444 * @param node the node to visit 445 * @return <code>true</code> if the children of this node should be 446 * visited, and <code>false</code> if the children of this node should 447 * be skipped 448 */ visit(CharacterLiteral node)449 public boolean visit(CharacterLiteral node) { 450 return true; 451 } 452 453 /** 454 * Visits the given type-specific AST node. 455 * <p> 456 * The default implementation does nothing and return true. 457 * Subclasses may reimplement. 458 * </p> 459 * 460 * @param node the node to visit 461 * @return <code>true</code> if the children of this node should be 462 * visited, and <code>false</code> if the children of this node should 463 * be skipped 464 */ visit(ClassInstanceCreation node)465 public boolean visit(ClassInstanceCreation node) { 466 return true; 467 } 468 469 /** 470 * Visits the given type-specific AST node. 471 * <p> 472 * The default implementation does nothing and return true. 473 * Subclasses may reimplement. 474 * </p> 475 * 476 * @param node the node to visit 477 * @return <code>true</code> if the children of this node should be 478 * visited, and <code>false</code> if the children of this node should 479 * be skipped 480 */ visit(CompilationUnit node)481 public boolean visit(CompilationUnit node) { 482 return true; 483 } 484 485 /** 486 * Visits the given type-specific AST node. 487 * <p> 488 * The default implementation does nothing and return true. 489 * Subclasses may reimplement. 490 * </p> 491 * 492 * @param node the node to visit 493 * @return <code>true</code> if the children of this node should be 494 * visited, and <code>false</code> if the children of this node should 495 * be skipped 496 */ visit(ConditionalExpression node)497 public boolean visit(ConditionalExpression node) { 498 return true; 499 } 500 501 /** 502 * Visits the given type-specific AST node. 503 * <p> 504 * The default implementation does nothing and return true. 505 * Subclasses may reimplement. 506 * </p> 507 * 508 * @param node the node to visit 509 * @return <code>true</code> if the children of this node should be 510 * visited, and <code>false</code> if the children of this node should 511 * be skipped 512 */ visit(ConstructorInvocation node)513 public boolean visit(ConstructorInvocation node) { 514 return true; 515 } 516 517 /** 518 * Visits the given type-specific AST node. 519 * <p> 520 * The default implementation does nothing and return true. 521 * Subclasses may reimplement. 522 * </p> 523 * 524 * @param node the node to visit 525 * @return <code>true</code> if the children of this node should be 526 * visited, and <code>false</code> if the children of this node should 527 * be skipped 528 */ visit(ContinueStatement node)529 public boolean visit(ContinueStatement node) { 530 return true; 531 } 532 533 /** 534 * Visits the given type-specific AST node. 535 * <p> 536 * The default implementation does nothing and return true. 537 * Subclasses may re-implement. 538 * </p> 539 * 540 * @param node the node to visit 541 * @return <code>true</code> if the children of this node should be 542 * visited, and <code>false</code> if the children of this node should 543 * be skipped 544 * @since 3.10 545 */ visit(CreationReference node)546 public boolean visit(CreationReference node) { 547 return true; 548 } 549 550 /** 551 * Visits the given type-specific AST node. 552 * <p> 553 * The default implementation does nothing and return true. 554 * Subclasses may reimplement. 555 * </p> 556 * 557 * @param node the node to visit 558 * @return <code>true</code> if the children of this node should be 559 * visited, and <code>false</code> if the children of this node should 560 * be skipped 561 * @since 3.10 562 */ visit(Dimension node)563 public boolean visit(Dimension node) { 564 return true; 565 } 566 567 /** 568 * Visits the given type-specific AST node. 569 * <p> 570 * The default implementation does nothing and return true. 571 * Subclasses may reimplement. 572 * </p> 573 * 574 * @param node the node to visit 575 * @return <code>true</code> if the children of this node should be 576 * visited, and <code>false</code> if the children of this node should 577 * be skipped 578 */ visit(DoStatement node)579 public boolean visit(DoStatement node) { 580 return true; 581 } 582 583 /** 584 * Visits the given type-specific AST node. 585 * <p> 586 * The default implementation does nothing and return true. 587 * Subclasses may reimplement. 588 * </p> 589 * 590 * @param node the node to visit 591 * @return <code>true</code> if the children of this node should be 592 * visited, and <code>false</code> if the children of this node should 593 * be skipped 594 */ visit(EmptyStatement node)595 public boolean visit(EmptyStatement node) { 596 return true; 597 } 598 599 /** 600 * Visits the given type-specific AST node. 601 * <p> 602 * The default implementation does nothing and return true. 603 * Subclasses may reimplement. 604 * </p> 605 * 606 * @param node the node to visit 607 * @return <code>true</code> if the children of this node should be 608 * visited, and <code>false</code> if the children of this node should 609 * be skipped 610 * @since 3.1 611 */ visit(EnhancedForStatement node)612 public boolean visit(EnhancedForStatement node) { 613 return true; 614 } 615 616 /** 617 * Visits the given type-specific AST node. 618 * <p> 619 * The default implementation does nothing and return true. 620 * Subclasses may reimplement. 621 * </p> 622 * 623 * @param node the node to visit 624 * @return <code>true</code> if the children of this node should be 625 * visited, and <code>false</code> if the children of this node should 626 * be skipped 627 * @since 3.1 628 */ visit(EnumConstantDeclaration node)629 public boolean visit(EnumConstantDeclaration node) { 630 return true; 631 } 632 633 /** 634 * Visits the given type-specific AST node. 635 * <p> 636 * The default implementation does nothing and return true. 637 * Subclasses may reimplement. 638 * </p> 639 * 640 * @param node the node to visit 641 * @return <code>true</code> if the children of this node should be 642 * visited, and <code>false</code> if the children of this node should 643 * be skipped 644 * @since 3.1 645 */ visit(EnumDeclaration node)646 public boolean visit(EnumDeclaration node) { 647 return true; 648 } 649 650 /** 651 * Visits the given type-specific AST node. 652 * <p> 653 * The default implementation does nothing and return true. 654 * Subclasses may re-implement. 655 * </p> 656 * 657 * @param node the node to visit 658 * @return <code>true</code> if the children of this node should be 659 * visited, and <code>false</code> if the children of this node should 660 * be skipped 661 * @since 3.14 662 */ visit(ExportsDirective node)663 public boolean visit(ExportsDirective node) { 664 return true; 665 } 666 667 /** 668 * Visits the given type-specific AST node. 669 * <p> 670 * The default implementation does nothing and return true. 671 * Subclasses may re-implement. 672 * </p> 673 * 674 * @param node the node to visit 675 * @return <code>true</code> if the children of this node should be 676 * visited, and <code>false</code> if the children of this node should 677 * be skipped 678 * @since 3.10 679 */ visit(ExpressionMethodReference node)680 public boolean visit(ExpressionMethodReference node) { 681 return true; 682 } 683 684 /** 685 * Visits the given type-specific AST node. 686 * <p> 687 * The default implementation does nothing and return true. 688 * Subclasses may reimplement. 689 * </p> 690 * 691 * @param node the node to visit 692 * @return <code>true</code> if the children of this node should be 693 * visited, and <code>false</code> if the children of this node should 694 * be skipped 695 */ visit(ExpressionStatement node)696 public boolean visit(ExpressionStatement node) { 697 return true; 698 } 699 700 /** 701 * Visits the given type-specific AST node. 702 * <p> 703 * The default implementation does nothing and return true. 704 * Subclasses may reimplement. 705 * </p> 706 * 707 * @param node the node to visit 708 * @return <code>true</code> if the children of this node should be 709 * visited, and <code>false</code> if the children of this node should 710 * be skipped 711 */ visit(FieldAccess node)712 public boolean visit(FieldAccess node) { 713 return true; 714 } 715 716 /** 717 * Visits the given type-specific AST node. 718 * <p> 719 * The default implementation does nothing and return true. 720 * Subclasses may reimplement. 721 * </p> 722 * 723 * @param node the node to visit 724 * @return <code>true</code> if the children of this node should be 725 * visited, and <code>false</code> if the children of this node should 726 * be skipped 727 */ visit(FieldDeclaration node)728 public boolean visit(FieldDeclaration node) { 729 return true; 730 } 731 732 /** 733 * Visits the given type-specific AST node. 734 * <p> 735 * The default implementation does nothing and return true. 736 * Subclasses may reimplement. 737 * </p> 738 * 739 * @param node the node to visit 740 * @return <code>true</code> if the children of this node should be 741 * visited, and <code>false</code> if the children of this node should 742 * be skipped 743 */ visit(ForStatement node)744 public boolean visit(ForStatement node) { 745 return true; 746 } 747 748 /** 749 * Visits the given type-specific AST node. 750 * <p> 751 * The default implementation does nothing and return true. 752 * Subclasses may reimplement. 753 * </p> 754 * 755 * @param node the node to visit 756 * @return <code>true</code> if the children of this node should be 757 * visited, and <code>false</code> if the children of this node should 758 * be skipped 759 */ visit(IfStatement node)760 public boolean visit(IfStatement node) { 761 return true; 762 } 763 764 /** 765 * Visits the given type-specific AST node. 766 * <p> 767 * The default implementation does nothing and return true. 768 * Subclasses may reimplement. 769 * </p> 770 * 771 * @param node the node to visit 772 * @return <code>true</code> if the children of this node should be 773 * visited, and <code>false</code> if the children of this node should 774 * be skipped 775 */ visit(ImportDeclaration node)776 public boolean visit(ImportDeclaration node) { 777 return true; 778 } 779 780 /** 781 * Visits the given type-specific AST node. 782 * <p> 783 * The default implementation does nothing and return true. 784 * Subclasses may reimplement. 785 * </p> 786 * 787 * @param node the node to visit 788 * @return <code>true</code> if the children of this node should be 789 * visited, and <code>false</code> if the children of this node should 790 * be skipped 791 */ visit(InfixExpression node)792 public boolean visit(InfixExpression node) { 793 return true; 794 } 795 796 /** 797 * Visits the given type-specific AST node. 798 * <p> 799 * The default implementation does nothing and return true. 800 * Subclasses may reimplement. 801 * </p> 802 * 803 * @param node the node to visit 804 * @return <code>true</code> if the children of this node should be 805 * visited, and <code>false</code> if the children of this node should 806 * be skipped 807 */ visit(Initializer node)808 public boolean visit(Initializer node) { 809 return true; 810 } 811 812 /** 813 * Visits the given type-specific AST node. 814 * <p> 815 * The default implementation does nothing and return true. 816 * Subclasses may reimplement. 817 * </p> 818 * 819 * @param node the node to visit 820 * @return <code>true</code> if the children of this node should be 821 * visited, and <code>false</code> if the children of this node should 822 * be skipped 823 */ visit(InstanceofExpression node)824 public boolean visit(InstanceofExpression node) { 825 return true; 826 } 827 828 /** 829 * Visits the given type-specific AST node. 830 * <p> 831 * The default implementation does nothing and return true. 832 * Subclasses may reimplement. 833 * </p> 834 * 835 * @param node the node to visit 836 * @return <code>true</code> if the children of this node should be 837 * visited, and <code>false</code> if the children of this node should 838 * be skipped 839 * @since 3.10 840 */ visit(IntersectionType node)841 public boolean visit(IntersectionType node) { 842 return true; 843 } 844 845 /** 846 * Visits the given AST node. 847 * <p> 848 * Unlike other node types, the boolean returned by the default 849 * implementation is controlled by a constructor-supplied 850 * parameter {@link #ASTVisitor(boolean) ASTVisitor(boolean)} 851 * which is <code>false</code> by default. 852 * Subclasses may reimplement. 853 * </p> 854 * 855 * @param node the node to visit 856 * @return <code>true</code> if the children of this node should be 857 * visited, and <code>false</code> if the children of this node should 858 * be skipped 859 * @see #ASTVisitor() 860 * @see #ASTVisitor(boolean) 861 */ visit(Javadoc node)862 public boolean visit(Javadoc node) { 863 // visit tag elements inside doc comments only if requested 864 return this.visitDocTags; 865 } 866 867 /** 868 * Visits the given type-specific AST node. 869 * <p> 870 * The default implementation does nothing and return true. 871 * Subclasses may reimplement. 872 * </p> 873 * 874 * @param node the node to visit 875 * @return <code>true</code> if the children of this node should be 876 * visited, and <code>false</code> if the children of this node should 877 * be skipped 878 */ visit(LabeledStatement node)879 public boolean visit(LabeledStatement node) { 880 return true; 881 } 882 883 884 /** 885 * Visits the given type-specific AST node. 886 * <p> 887 * The default implementation does nothing and return true. 888 * Subclasses may reimplement. 889 * </p> 890 * 891 * @param node the node to visit 892 * @return <code>true</code> if the children of this node should be 893 * visited, and <code>false</code> if the children of this node should 894 * be skipped 895 * @since 3.10 896 */ visit(LambdaExpression node)897 public boolean visit(LambdaExpression node) { 898 return true; 899 } 900 901 /** 902 * Visits the given type-specific AST node. 903 * <p> 904 * The default implementation does nothing and return true. 905 * Subclasses may reimplement. 906 * </p> 907 * <p>Note: {@link LineComment} and {@link BlockComment} nodes are 908 * not considered part of main structure of the AST. This method will 909 * only be called if a client goes out of their way to visit this 910 * kind of node explicitly. 911 * </p> 912 * 913 * @param node the node to visit 914 * @return <code>true</code> if the children of this node should be 915 * visited, and <code>false</code> if the children of this node should 916 * be skipped 917 * @since 3.0 918 */ visit(LineComment node)919 public boolean visit(LineComment node) { 920 return true; 921 } 922 923 924 /** 925 * Visits the given type-specific AST node. 926 * <p> 927 * The default implementation does nothing and return true. 928 * Subclasses may reimplement. 929 * </p> 930 * 931 * @param node the node to visit 932 * @return <code>true</code> if the children of this node should be 933 * visited, and <code>false</code> if the children of this node should 934 * be skipped 935 * @since 3.1 936 */ visit(MarkerAnnotation node)937 public boolean visit(MarkerAnnotation node) { 938 return true; 939 } 940 941 942 /** 943 * Visits the given type-specific AST node. 944 * <p> 945 * The default implementation does nothing and return true. 946 * Subclasses may reimplement. 947 * </p> 948 * 949 * @param node the node to visit 950 * @return <code>true</code> if the children of this node should be 951 * visited, and <code>false</code> if the children of this node should 952 * be skipped 953 * @since 3.0 954 */ visit(MemberRef node)955 public boolean visit(MemberRef node) { 956 return true; 957 } 958 959 960 /** 961 * Visits the given type-specific AST node. 962 * <p> 963 * The default implementation does nothing and return true. 964 * Subclasses may reimplement. 965 * </p> 966 * 967 * @param node the node to visit 968 * @return <code>true</code> if the children of this node should be 969 * visited, and <code>false</code> if the children of this node should 970 * be skipped 971 * @since 3.1 972 */ visit(MemberValuePair node)973 public boolean visit(MemberValuePair node) { 974 return true; 975 } 976 977 978 /** 979 * Visits the given type-specific AST node. 980 * <p> 981 * The default implementation does nothing and return true. 982 * Subclasses may reimplement. 983 * </p> 984 * 985 * @param node the node to visit 986 * @return <code>true</code> if the children of this node should be 987 * visited, and <code>false</code> if the children of this node should 988 * be skipped 989 * @since 3.0 990 */ visit(MethodRef node)991 public boolean visit(MethodRef node) { 992 return true; 993 } 994 995 996 /** 997 * Visits the given type-specific AST node. 998 * <p> 999 * The default implementation does nothing and return true. 1000 * Subclasses may reimplement. 1001 * </p> 1002 * 1003 * @param node the node to visit 1004 * @return <code>true</code> if the children of this node should be 1005 * visited, and <code>false</code> if the children of this node should 1006 * be skipped 1007 * @since 3.0 1008 */ visit(MethodRefParameter node)1009 public boolean visit(MethodRefParameter node) { 1010 return true; 1011 } 1012 1013 1014 /** 1015 * Visits the given type-specific AST node. 1016 * <p> 1017 * The default implementation does nothing and return true. 1018 * Subclasses may reimplement. 1019 * </p> 1020 * 1021 * @param node the node to visit 1022 * @return <code>true</code> if the children of this node should be 1023 * visited, and <code>false</code> if the children of this node should 1024 * be skipped 1025 */ visit(MethodDeclaration node)1026 public boolean visit(MethodDeclaration node) { 1027 return true; 1028 } 1029 1030 /** 1031 * Visits the given type-specific AST node. 1032 * <p> 1033 * The default implementation does nothing and return true. 1034 * Subclasses may reimplement. 1035 * </p> 1036 * 1037 * @param node the node to visit 1038 * @return <code>true</code> if the children of this node should be 1039 * visited, and <code>false</code> if the children of this node should 1040 * be skipped 1041 */ visit(MethodInvocation node)1042 public boolean visit(MethodInvocation node) { 1043 return true; 1044 } 1045 1046 1047 /** 1048 * Visits the given type-specific AST node. 1049 * <p> 1050 * The default implementation does nothing and return true. 1051 * Subclasses may reimplement. 1052 * </p> 1053 * 1054 * @param node the node to visit 1055 * @return <code>true</code> if the children of this node should be 1056 * visited, and <code>false</code> if the children of this node should 1057 * be skipped 1058 * @since 3.1 1059 */ visit(Modifier node)1060 public boolean visit(Modifier node) { 1061 return true; 1062 } 1063 1064 /** 1065 * Visits the given type-specific AST node. 1066 * <p> 1067 * The default implementation does nothing and return true. 1068 * Subclasses may reimplement. 1069 * </p> 1070 * 1071 * @param node the node to visit 1072 * @return <code>true</code> if the children of this node should be 1073 * visited, and <code>false</code> if the children of this node should 1074 * be skipped 1075 * @since 3.14 1076 */ visit(ModuleDeclaration node)1077 public boolean visit(ModuleDeclaration node) { 1078 return true; 1079 } 1080 1081 /** 1082 * Visits the given type-specific AST node. 1083 * <p> 1084 * The default implementation does nothing and return true. 1085 * Subclasses may reimplement. 1086 * </p> 1087 * 1088 * @param node the node to visit 1089 * @return <code>true</code> if the children of this node should be 1090 * visited, and <code>false</code> if the children of this node should 1091 * be skipped 1092 * @since 3.14 1093 */ visit(ModuleModifier node)1094 public boolean visit(ModuleModifier node) { 1095 return true; 1096 } 1097 1098 /** 1099 * Visits the given type-specific AST node. 1100 * <p> 1101 * The default implementation does nothing and return true. 1102 * Subclasses may reimplement. 1103 * </p> 1104 * 1105 * @param node the node to visit 1106 * @return <code>true</code> if the children of this node should be 1107 * visited, and <code>false</code> if the children of this node should 1108 * be skipped 1109 * @since 3.10 1110 */ visit(NameQualifiedType node)1111 public boolean visit(NameQualifiedType node) { 1112 return true; 1113 } 1114 1115 /** 1116 * Visits the given type-specific AST node. 1117 * <p> 1118 * The default implementation does nothing and return true. 1119 * Subclasses may reimplement. 1120 * </p> 1121 * 1122 * @param node the node to visit 1123 * @return <code>true</code> if the children of this node should be 1124 * visited, and <code>false</code> if the children of this node should 1125 * be skipped 1126 * @since 3.1 1127 */ visit(NormalAnnotation node)1128 public boolean visit(NormalAnnotation node) { 1129 return true; 1130 } 1131 1132 /** 1133 * Visits the given type-specific AST node. 1134 * <p> 1135 * The default implementation does nothing and return true. 1136 * Subclasses may reimplement. 1137 * </p> 1138 * 1139 * @param node the node to visit 1140 * @return <code>true</code> if the children of this node should be 1141 * visited, and <code>false</code> if the children of this node should 1142 * be skipped 1143 */ visit(NullLiteral node)1144 public boolean visit(NullLiteral node) { 1145 return true; 1146 } 1147 1148 /** 1149 * Visits the given type-specific AST node. 1150 * <p> 1151 * The default implementation does nothing and return true. 1152 * Subclasses may reimplement. 1153 * </p> 1154 * 1155 * @param node the node to visit 1156 * @return <code>true</code> if the children of this node should be 1157 * visited, and <code>false</code> if the children of this node should 1158 * be skipped 1159 */ visit(NumberLiteral node)1160 public boolean visit(NumberLiteral node) { 1161 return true; 1162 } 1163 1164 /** 1165 * Visits the given type-specific AST node. 1166 * <p> 1167 * The default implementation does nothing and return true. 1168 * Subclasses may re-implement. 1169 * </p> 1170 * 1171 * @param node the node to visit 1172 * @return <code>true</code> if the children of this node should be 1173 * visited, and <code>false</code> if the children of this node should 1174 * be skipped 1175 * @since 3.14 1176 */ visit(OpensDirective node)1177 public boolean visit(OpensDirective node) { 1178 return true; 1179 } 1180 1181 /** 1182 * Visits the given type-specific AST node. 1183 * <p> 1184 * The default implementation does nothing and return true. 1185 * Subclasses may reimplement. 1186 * </p> 1187 * 1188 * @param node the node to visit 1189 * @return <code>true</code> if the children of this node should be 1190 * visited, and <code>false</code> if the children of this node should 1191 * be skipped 1192 */ visit(PackageDeclaration node)1193 public boolean visit(PackageDeclaration node) { 1194 return true; 1195 } 1196 1197 /** 1198 * Visits the given type-specific AST node. 1199 * <p> 1200 * The default implementation does nothing and return true. 1201 * Subclasses may reimplement. 1202 * </p> 1203 * 1204 * @param node the node to visit 1205 * @return <code>true</code> if the children of this node should be 1206 * visited, and <code>false</code> if the children of this node should 1207 * be skipped 1208 * @since 3.1 1209 */ visit(ParameterizedType node)1210 public boolean visit(ParameterizedType node) { 1211 return true; 1212 } 1213 1214 /** 1215 * Visits the given type-specific AST node. 1216 * <p> 1217 * The default implementation does nothing and return true. 1218 * Subclasses may reimplement. 1219 * </p> 1220 * 1221 * @param node the node to visit 1222 * @return <code>true</code> if the children of this node should be 1223 * visited, and <code>false</code> if the children of this node should 1224 * be skipped 1225 */ visit(ParenthesizedExpression node)1226 public boolean visit(ParenthesizedExpression node) { 1227 return true; 1228 } 1229 1230 /** 1231 * Visits the given type-specific AST node. 1232 * <p> 1233 * The default implementation does nothing and return true. 1234 * Subclasses may reimplement. 1235 * </p> 1236 * 1237 * @param node the node to visit 1238 * @return <code>true</code> if the children of this node should be 1239 * visited, and <code>false</code> if the children of this node should 1240 * be skipped 1241 */ visit(PostfixExpression node)1242 public boolean visit(PostfixExpression node) { 1243 return true; 1244 } 1245 1246 /** 1247 * Visits the given type-specific AST node. 1248 * <p> 1249 * The default implementation does nothing and return true. 1250 * Subclasses may reimplement. 1251 * </p> 1252 * 1253 * @param node the node to visit 1254 * @return <code>true</code> if the children of this node should be 1255 * visited, and <code>false</code> if the children of this node should 1256 * be skipped 1257 */ visit(PrefixExpression node)1258 public boolean visit(PrefixExpression node) { 1259 return true; 1260 } 1261 1262 /** 1263 * Visits the given type-specific AST node. 1264 * <p> 1265 * The default implementation does nothing and return true. 1266 * Subclasses may re-implement. 1267 * </p> 1268 * 1269 * @param node the node to visit 1270 * @return <code>true</code> if the children of this node should be 1271 * visited, and <code>false</code> if the children of this node should 1272 * be skipped 1273 * @since 3.14 1274 */ visit(ProvidesDirective node)1275 public boolean visit(ProvidesDirective node) { 1276 return true; 1277 } 1278 1279 /** 1280 * Visits the given type-specific AST node. 1281 * <p> 1282 * The default implementation does nothing and return true. 1283 * Subclasses may reimplement. 1284 * </p> 1285 * 1286 * @param node the node to visit 1287 * @return <code>true</code> if the children of this node should be 1288 * visited, and <code>false</code> if the children of this node should 1289 * be skipped 1290 */ visit(PrimitiveType node)1291 public boolean visit(PrimitiveType node) { 1292 return true; 1293 } 1294 1295 /** 1296 * Visits the given type-specific AST node. 1297 * <p> 1298 * The default implementation does nothing and return true. 1299 * Subclasses may reimplement. 1300 * </p> 1301 * 1302 * @param node the node to visit 1303 * @return <code>true</code> if the children of this node should be 1304 * visited, and <code>false</code> if the children of this node should 1305 * be skipped 1306 */ visit(QualifiedName node)1307 public boolean visit(QualifiedName node) { 1308 return true; 1309 } 1310 1311 /** 1312 * Visits the given type-specific AST node. 1313 * <p> 1314 * The default implementation does nothing and return true. 1315 * Subclasses may reimplement. 1316 * </p> 1317 * 1318 * @param node the node to visit 1319 * @return <code>true</code> if the children of this node should be 1320 * visited, and <code>false</code> if the children of this node should 1321 * be skipped 1322 * @since 3.1 1323 */ visit(QualifiedType node)1324 public boolean visit(QualifiedType node) { 1325 return true; 1326 } 1327 1328 /** 1329 * Visits the given type-specific AST node. 1330 * <p> 1331 * The default implementation does nothing and return true. 1332 * Subclasses may re-implement. 1333 * </p> 1334 * 1335 * @param node the node to visit 1336 * @return <code>true</code> if the children of this node should be 1337 * visited, and <code>false</code> if the children of this node should 1338 * be skipped 1339 * @since 3.14 1340 */ visit(RequiresDirective node)1341 public boolean visit(RequiresDirective node) { 1342 return true; 1343 } 1344 1345 /** 1346 * Visits the given type-specific AST node. 1347 * <p> 1348 * The default implementation does nothing and return true. 1349 * Subclasses may re-implement. 1350 * </p> 1351 * 1352 * @param node the node to visit 1353 * @return <code>true</code> if the children of this node should be 1354 * visited, and <code>false</code> if the children of this node should 1355 * be skipped 1356 * @since 3.22 1357 * @noreference This method is not intended to be referenced by clients. 1358 */ visit(RecordDeclaration node)1359 public boolean visit(RecordDeclaration node) { 1360 return true; 1361 } 1362 1363 /** 1364 * Visits the given type-specific AST node. 1365 * <p> 1366 * The default implementation does nothing and return true. 1367 * Subclasses may reimplement. 1368 * </p> 1369 * 1370 * @param node the node to visit 1371 * @return <code>true</code> if the children of this node should be 1372 * visited, and <code>false</code> if the children of this node should 1373 * be skipped 1374 */ visit(ReturnStatement node)1375 public boolean visit(ReturnStatement node) { 1376 return true; 1377 } 1378 1379 /** 1380 * Visits the given type-specific AST node. 1381 * <p> 1382 * The default implementation does nothing and return true. 1383 * Subclasses may reimplement. 1384 * </p> 1385 * 1386 * @param node the node to visit 1387 * @return <code>true</code> if the children of this node should be 1388 * visited, and <code>false</code> if the children of this node should 1389 * be skipped 1390 */ visit(SimpleName node)1391 public boolean visit(SimpleName node) { 1392 return true; 1393 } 1394 1395 /** 1396 * Visits the given type-specific AST node. 1397 * <p> 1398 * The default implementation does nothing and return true. 1399 * Subclasses may reimplement. 1400 * </p> 1401 * 1402 * @param node the node to visit 1403 * @return <code>true</code> if the children of this node should be 1404 * visited, and <code>false</code> if the children of this node should 1405 * be skipped 1406 */ visit(SimpleType node)1407 public boolean visit(SimpleType node) { 1408 return true; 1409 } 1410 1411 1412 /** 1413 * Visits the given type-specific AST node. 1414 * <p> 1415 * The default implementation does nothing and return true. 1416 * Subclasses may reimplement. 1417 * </p> 1418 * 1419 * @param node the node to visit 1420 * @return <code>true</code> if the children of this node should be 1421 * visited, and <code>false</code> if the children of this node should 1422 * be skipped 1423 * @since 3.1 1424 */ visit(SingleMemberAnnotation node)1425 public boolean visit(SingleMemberAnnotation node) { 1426 return true; 1427 } 1428 1429 1430 /** 1431 * Visits the given type-specific AST node. 1432 * <p> 1433 * The default implementation does nothing and return true. 1434 * Subclasses may reimplement. 1435 * </p> 1436 * 1437 * @param node the node to visit 1438 * @return <code>true</code> if the children of this node should be 1439 * visited, and <code>false</code> if the children of this node should 1440 * be skipped 1441 */ visit(SingleVariableDeclaration node)1442 public boolean visit(SingleVariableDeclaration node) { 1443 return true; 1444 } 1445 1446 /** 1447 * Visits the given type-specific AST node. 1448 * <p> 1449 * The default implementation does nothing and return true. 1450 * Subclasses may reimplement. 1451 * </p> 1452 * 1453 * @param node the node to visit 1454 * @return <code>true</code> if the children of this node should be 1455 * visited, and <code>false</code> if the children of this node should 1456 * be skipped 1457 */ visit(StringLiteral node)1458 public boolean visit(StringLiteral node) { 1459 return true; 1460 } 1461 1462 /** 1463 * Visits the given type-specific AST node. 1464 * <p> 1465 * The default implementation does nothing and return true. 1466 * Subclasses may reimplement. 1467 * </p> 1468 * 1469 * @param node the node to visit 1470 * @return <code>true</code> if the children of this node should be 1471 * visited, and <code>false</code> if the children of this node should 1472 * be skipped 1473 */ visit(SuperConstructorInvocation node)1474 public boolean visit(SuperConstructorInvocation node) { 1475 return true; 1476 } 1477 1478 /** 1479 * Visits the given type-specific AST node. 1480 * <p> 1481 * The default implementation does nothing and return true. 1482 * Subclasses may reimplement. 1483 * </p> 1484 * 1485 * @param node the node to visit 1486 * @return <code>true</code> if the children of this node should be 1487 * visited, and <code>false</code> if the children of this node should 1488 * be skipped 1489 */ visit(SuperFieldAccess node)1490 public boolean visit(SuperFieldAccess node) { 1491 return true; 1492 } 1493 1494 /** 1495 * Visits the given type-specific AST node. 1496 * <p> 1497 * The default implementation does nothing and return true. 1498 * Subclasses may reimplement. 1499 * </p> 1500 * 1501 * @param node the node to visit 1502 * @return <code>true</code> if the children of this node should be 1503 * visited, and <code>false</code> if the children of this node should 1504 * be skipped 1505 */ visit(SuperMethodInvocation node)1506 public boolean visit(SuperMethodInvocation node) { 1507 return true; 1508 } 1509 1510 /** 1511 * Visits the given type-specific AST node. 1512 * <p> 1513 * The default implementation does nothing and return true. 1514 * Subclasses may reimplement. 1515 * </p> 1516 * 1517 * @param node the node to visit 1518 * @return <code>true</code> if the children of this node should be 1519 * visited, and <code>false</code> if the children of this node should 1520 * be skipped 1521 * @since 3.10 1522 */ visit(SuperMethodReference node)1523 public boolean visit(SuperMethodReference node) { 1524 return true; 1525 } 1526 1527 /** 1528 * Visits the given type-specific AST node. 1529 * <p> 1530 * The default implementation does nothing and return true. 1531 * Subclasses may reimplement. 1532 * </p> 1533 * 1534 * @param node the node to visit 1535 * @return <code>true</code> if the children of this node should be 1536 * visited, and <code>false</code> if the children of this node should 1537 * be skipped 1538 */ visit(SwitchCase node)1539 public boolean visit(SwitchCase node) { 1540 return true; 1541 } 1542 1543 /** 1544 * Visits the given type-specific AST node. 1545 * <p> 1546 * The default implementation does nothing and return true. 1547 * Subclasses may reimplement. 1548 * </p> 1549 * 1550 * @param node the node to visit 1551 * @return <code>true</code> if the children of this node should be 1552 * visited, and <code>false</code> if the children of this node should 1553 * be skipped 1554 * @noreference This method is not intended to be referenced by clients as it is a part of Java preview feature. 1555 * @nooverride This method is not intended to be re-implemented or extended by clients as it is a part of Java preview feature. 1556 * @since 3.18 1557 */ visit(SwitchExpression node)1558 public boolean visit(SwitchExpression node) { 1559 return true; 1560 } 1561 1562 /** 1563 * Visits the given type-specific AST node. 1564 * <p> 1565 * The default implementation does nothing and return true. 1566 * Subclasses may reimplement. 1567 * </p> 1568 * 1569 * @param node the node to visit 1570 * @return <code>true</code> if the children of this node should be 1571 * visited, and <code>false</code> if the children of this node should 1572 * be skipped 1573 */ visit(SwitchStatement node)1574 public boolean visit(SwitchStatement node) { 1575 return true; 1576 } 1577 1578 /** 1579 * Visits the given type-specific AST node. 1580 * <p> 1581 * The default implementation does nothing and return true. 1582 * Subclasses may reimplement. 1583 * </p> 1584 * 1585 * @param node the node to visit 1586 * @return <code>true</code> if the children of this node should be 1587 * visited, and <code>false</code> if the children of this node should 1588 * be skipped 1589 */ visit(SynchronizedStatement node)1590 public boolean visit(SynchronizedStatement node) { 1591 return true; 1592 } 1593 1594 1595 /** 1596 * Visits the given type-specific AST node. 1597 * <p> 1598 * The default implementation does nothing and return true. 1599 * Subclasses may reimplement. 1600 * </p> 1601 * 1602 * @param node the node to visit 1603 * @return <code>true</code> if the children of this node should be 1604 * visited, and <code>false</code> if the children of this node should 1605 * be skipped 1606 * @since 3.0 1607 */ visit(TagElement node)1608 public boolean visit(TagElement node) { 1609 return true; 1610 } 1611 1612 1613 /** 1614 * Visits the given type-specific AST node. 1615 * <p> 1616 * The default implementation does nothing and returns true. 1617 * Subclasses may reimplement. 1618 * </p> 1619 * 1620 * @param node the node to visit 1621 * @return <code>true</code> if the children of this node should be 1622 * visited, and <code>false</code> if the children of this node should 1623 * be skipped 1624 * @noreference This method is not intended to be referenced by clients as it is a part of Java preview feature. 1625 * @nooverride This method is not intended to be re-implemented or extended by clients as it is a part of Java preview feature. 1626 * @since 3.20 1627 */ visit(TextBlock node)1628 public boolean visit(TextBlock node) { 1629 return true; 1630 } 1631 1632 /** 1633 * Visits the given type-specific AST node. 1634 * <p> 1635 * The default implementation does nothing and return true. 1636 * Subclasses may reimplement. 1637 * </p> 1638 * 1639 * @param node the node to visit 1640 * @return <code>true</code> if the children of this node should be 1641 * visited, and <code>false</code> if the children of this node should 1642 * be skipped 1643 * @since 3.0 1644 */ visit(TextElement node)1645 public boolean visit(TextElement node) { 1646 return true; 1647 } 1648 1649 1650 /** 1651 * Visits the given type-specific AST node. 1652 * <p> 1653 * The default implementation does nothing and return true. 1654 * Subclasses may reimplement. 1655 * </p> 1656 * 1657 * @param node the node to visit 1658 * @return <code>true</code> if the children of this node should be 1659 * visited, and <code>false</code> if the children of this node should 1660 * be skipped 1661 */ visit(ThisExpression node)1662 public boolean visit(ThisExpression node) { 1663 return true; 1664 } 1665 1666 /** 1667 * Visits the given type-specific AST node. 1668 * <p> 1669 * The default implementation does nothing and return true. 1670 * Subclasses may reimplement. 1671 * </p> 1672 * 1673 * @param node the node to visit 1674 * @return <code>true</code> if the children of this node should be 1675 * visited, and <code>false</code> if the children of this node should 1676 * be skipped 1677 */ visit(ThrowStatement node)1678 public boolean visit(ThrowStatement node) { 1679 return true; 1680 } 1681 1682 /** 1683 * Visits the given type-specific AST node. 1684 * <p> 1685 * The default implementation does nothing and return true. 1686 * Subclasses may reimplement. 1687 * </p> 1688 * 1689 * @param node the node to visit 1690 * @return <code>true</code> if the children of this node should be 1691 * visited, and <code>false</code> if the children of this node should 1692 * be skipped 1693 */ visit(TryStatement node)1694 public boolean visit(TryStatement node) { 1695 return true; 1696 } 1697 /** 1698 * Visits the given type-specific AST node. 1699 * <p> 1700 * The default implementation does nothing and return true. 1701 * Subclasses may reimplement. 1702 * </p> 1703 * 1704 * @param node the node to visit 1705 * @return <code>true</code> if the children of this node should be 1706 * visited, and <code>false</code> if the children of this node should 1707 * be skipped 1708 */ visit(TypeDeclaration node)1709 public boolean visit(TypeDeclaration node) { 1710 return true; 1711 } 1712 1713 /** 1714 * Visits the given type-specific AST node. 1715 * <p> 1716 * The default implementation does nothing and return true. 1717 * Subclasses may reimplement. 1718 * </p> 1719 * 1720 * @param node the node to visit 1721 * @return <code>true</code> if the children of this node should be 1722 * visited, and <code>false</code> if the children of this node should 1723 * be skipped 1724 */ visit(TypeDeclarationStatement node)1725 public boolean visit(TypeDeclarationStatement node) { 1726 return true; 1727 } 1728 1729 /** 1730 * Visits the given type-specific AST node. 1731 * <p> 1732 * The default implementation does nothing and return true. 1733 * Subclasses may reimplement. 1734 * </p> 1735 * 1736 * @param node the node to visit 1737 * @return <code>true</code> if the children of this node should be 1738 * visited, and <code>false</code> if the children of this node should 1739 * be skipped 1740 */ visit(TypeLiteral node)1741 public boolean visit(TypeLiteral node) { 1742 return true; 1743 } 1744 1745 /** 1746 * Visits the given type-specific AST node. 1747 * <p> 1748 * The default implementation does nothing and return true. 1749 * Subclasses may reimplement. 1750 * </p> 1751 * 1752 * @param node the node to visit 1753 * @return <code>true</code> if the children of this node should be 1754 * visited, and <code>false</code> if the children of this node should 1755 * be skipped 1756 * 1757 * @since 3.10 1758 */ visit(TypeMethodReference node)1759 public boolean visit(TypeMethodReference node) { 1760 return true; 1761 } 1762 1763 /** 1764 * Visits the given type-specific AST node. 1765 * <p> 1766 * The default implementation does nothing and return true. 1767 * Subclasses may reimplement. 1768 * </p> 1769 * 1770 * @param node the node to visit 1771 * @return <code>true</code> if the children of this node should be 1772 * visited, and <code>false</code> if the children of this node should 1773 * be skipped 1774 * @since 3.1 1775 */ visit(TypeParameter node)1776 public boolean visit(TypeParameter node) { 1777 return true; 1778 } 1779 1780 /** 1781 * Visits the given type-specific AST node. 1782 * <p> 1783 * The default implementation does nothing and return true. 1784 * Subclasses may reimplement. 1785 * </p> 1786 * 1787 * @param node the node to visit 1788 * @return <code>true</code> if the children of this node should be 1789 * visited, and <code>false</code> if the children of this node should 1790 * be skipped 1791 * @since 3.7.1 1792 */ visit(UnionType node)1793 public boolean visit(UnionType node) { 1794 return true; 1795 } 1796 1797 /** 1798 * Visits the given type-specific AST node. 1799 * <p> 1800 * The default implementation does nothing and return true. 1801 * Subclasses may re-implement. 1802 * </p> 1803 * 1804 * @param node the node to visit 1805 * @return <code>true</code> if the children of this node should be 1806 * visited, and <code>false</code> if the children of this node should 1807 * be skipped 1808 * @since 3.14 1809 */ visit(UsesDirective node)1810 public boolean visit(UsesDirective node) { 1811 return true; 1812 } 1813 1814 /** 1815 * Visits the given type-specific AST node. 1816 * <p> 1817 * The default implementation does nothing and return true. 1818 * Subclasses may reimplement. 1819 * </p> 1820 * 1821 * @param node the node to visit 1822 * @return <code>true</code> if the children of this node should be 1823 * visited, and <code>false</code> if the children of this node should 1824 * be skipped 1825 */ visit(VariableDeclarationExpression node)1826 public boolean visit(VariableDeclarationExpression node) { 1827 return true; 1828 } 1829 1830 /** 1831 * Visits the given type-specific AST node. 1832 * <p> 1833 * The default implementation does nothing and return true. 1834 * Subclasses may reimplement. 1835 * </p> 1836 * 1837 * @param node the node to visit 1838 * @return <code>true</code> if the children of this node should be 1839 * visited, and <code>false</code> if the children of this node should 1840 * be skipped 1841 */ visit(VariableDeclarationStatement node)1842 public boolean visit(VariableDeclarationStatement node) { 1843 return true; 1844 } 1845 1846 /** 1847 * Visits the given type-specific AST node. 1848 * <p> 1849 * The default implementation does nothing and return true. 1850 * Subclasses may reimplement. 1851 * </p> 1852 * 1853 * @param node the node to visit 1854 * @return <code>true</code> if the children of this node should be 1855 * visited, and <code>false</code> if the children of this node should 1856 * be skipped 1857 */ visit(VariableDeclarationFragment node)1858 public boolean visit(VariableDeclarationFragment node) { 1859 return true; 1860 } 1861 1862 /** 1863 * Visits the given type-specific AST node. 1864 * <p> 1865 * The default implementation does nothing and return true. 1866 * Subclasses may reimplement. 1867 * </p> 1868 * 1869 * @param node the node to visit 1870 * @return <code>true</code> if the children of this node should be 1871 * visited, and <code>false</code> if the children of this node should 1872 * be skipped 1873 */ visit(WhileStatement node)1874 public boolean visit(WhileStatement node) { 1875 return true; 1876 } 1877 1878 /** 1879 * Visits the given type-specific AST node. 1880 * <p> 1881 * The default implementation does nothing and return true. 1882 * Subclasses may reimplement. 1883 * </p> 1884 * 1885 * @param node the node to visit 1886 * @return <code>true</code> if the children of this node should be 1887 * visited, and <code>false</code> if the children of this node should 1888 * be skipped 1889 * @since 3.1 1890 */ visit(WildcardType node)1891 public boolean visit(WildcardType node) { 1892 return true; 1893 } 1894 1895 /** 1896 * Visits the given type-specific AST node. 1897 * <p> 1898 * The default implementation does nothing and returns true. 1899 * Subclasses may reimplement. 1900 * </p> 1901 * 1902 * @param node the node to visit 1903 * @return <code>true</code> if the children of this node should be 1904 * visited, and <code>false</code> if the children of this node should 1905 * be skipped 1906 * @noreference This method is not intended to be referenced by clients as it is a part of Java preview feature. 1907 * @nooverride This method is not intended to be re-implemented or extended by clients as it is a part of Java preview feature. 1908 * @since 3.20 1909 */ visit(YieldStatement node)1910 public boolean visit(YieldStatement node) { 1911 return true; 1912 } 1913 1914 /** 1915 * End of visit the given type-specific AST node. 1916 * <p> 1917 * The default implementation does nothing. Subclasses may reimplement. 1918 * </p> 1919 * 1920 * @param node the node to visit 1921 * @since 3.1 1922 */ endVisit(AnnotationTypeDeclaration node)1923 public void endVisit(AnnotationTypeDeclaration node) { 1924 // default implementation: do nothing 1925 } 1926 1927 /** 1928 * End of visit the given type-specific AST node. 1929 * <p> 1930 * The default implementation does nothing. Subclasses may reimplement. 1931 * </p> 1932 * 1933 * @param node the node to visit 1934 * @since 3.1 1935 */ endVisit(AnnotationTypeMemberDeclaration node)1936 public void endVisit(AnnotationTypeMemberDeclaration node) { 1937 // default implementation: do nothing 1938 } 1939 1940 /** 1941 * End of visit the given type-specific AST node. 1942 * <p> 1943 * The default implementation does nothing. Subclasses may reimplement. 1944 * </p> 1945 * 1946 * @param node the node to visit 1947 */ endVisit(AnonymousClassDeclaration node)1948 public void endVisit(AnonymousClassDeclaration node) { 1949 // default implementation: do nothing 1950 } 1951 1952 /** 1953 * End of visit the given type-specific AST node. 1954 * <p> 1955 * The default implementation does nothing. Subclasses may reimplement. 1956 * </p> 1957 * 1958 * @param node the node to visit 1959 */ endVisit(ArrayAccess node)1960 public void endVisit(ArrayAccess node) { 1961 // default implementation: do nothing 1962 } 1963 1964 /** 1965 * End of visit the given type-specific AST node. 1966 * <p> 1967 * The default implementation does nothing. Subclasses may reimplement. 1968 * </p> 1969 * 1970 * @param node the node to visit 1971 */ endVisit(ArrayCreation node)1972 public void endVisit(ArrayCreation node) { 1973 // default implementation: do nothing 1974 } 1975 1976 /** 1977 * End of visit the given type-specific AST node. 1978 * <p> 1979 * The default implementation does nothing. Subclasses may reimplement. 1980 * </p> 1981 * 1982 * @param node the node to visit 1983 */ endVisit(ArrayInitializer node)1984 public void endVisit(ArrayInitializer node) { 1985 // default implementation: do nothing 1986 } 1987 1988 /** 1989 * End of visit the given type-specific AST node. 1990 * <p> 1991 * The default implementation does nothing. Subclasses may reimplement. 1992 * </p> 1993 * 1994 * @param node the node to visit 1995 */ endVisit(ArrayType node)1996 public void endVisit(ArrayType node) { 1997 // default implementation: do nothing 1998 } 1999 2000 /** 2001 * End of visit the given type-specific AST node. 2002 * <p> 2003 * The default implementation does nothing. Subclasses may reimplement. 2004 * </p> 2005 * 2006 * @param node the node to visit 2007 */ endVisit(AssertStatement node)2008 public void endVisit(AssertStatement node) { 2009 // default implementation: do nothing 2010 } 2011 2012 /** 2013 * End of visit the given type-specific AST node. 2014 * <p> 2015 * The default implementation does nothing. Subclasses may reimplement. 2016 * </p> 2017 * 2018 * @param node the node to visit 2019 */ endVisit(Assignment node)2020 public void endVisit(Assignment node) { 2021 // default implementation: do nothing 2022 } 2023 2024 /** 2025 * End of visit the given type-specific AST node. 2026 * <p> 2027 * The default implementation does nothing. Subclasses may reimplement. 2028 * </p> 2029 * 2030 * @param node the node to visit 2031 */ endVisit(Block node)2032 public void endVisit(Block node) { 2033 // default implementation: do nothing 2034 } 2035 2036 /** 2037 * End of visit the given type-specific AST node. 2038 * <p> 2039 * The default implementation does nothing. Subclasses may reimplement. 2040 * </p> 2041 * <p>Note: {@link LineComment} and {@link BlockComment} nodes are 2042 * not considered part of main structure of the AST. This method will 2043 * only be called if a client goes out of their way to visit this 2044 * kind of node explicitly. 2045 * </p> 2046 * 2047 * @param node the node to visit 2048 * @since 3.0 2049 */ endVisit(BlockComment node)2050 public void endVisit(BlockComment node) { 2051 // default implementation: do nothing 2052 } 2053 2054 /** 2055 * End of visit the given type-specific AST node. 2056 * <p> 2057 * The default implementation does nothing. Subclasses may reimplement. 2058 * </p> 2059 * 2060 * @param node the node to visit 2061 */ endVisit(BooleanLiteral node)2062 public void endVisit(BooleanLiteral node) { 2063 // default implementation: do nothing 2064 } 2065 2066 /** 2067 * End of visit the given type-specific AST node. 2068 * <p> 2069 * The default implementation does nothing. Subclasses may reimplement. 2070 * </p> 2071 * 2072 * @param node the node to visit 2073 */ endVisit(BreakStatement node)2074 public void endVisit(BreakStatement node) { 2075 // default implementation: do nothing 2076 } 2077 2078 /** 2079 * End of visit the given type-specific AST node. 2080 * <p> 2081 * The default implementation does nothing. Subclasses may reimplement. 2082 * </p> 2083 * 2084 * @param node the node to visit 2085 */ endVisit(CastExpression node)2086 public void endVisit(CastExpression node) { 2087 // default implementation: do nothing 2088 } 2089 2090 /** 2091 * End of visit the given type-specific AST node. 2092 * <p> 2093 * The default implementation does nothing. Subclasses may reimplement. 2094 * </p> 2095 * 2096 * @param node the node to visit 2097 */ endVisit(CatchClause node)2098 public void endVisit(CatchClause node) { 2099 // default implementation: do nothing 2100 } 2101 2102 /** 2103 * End of visit the given type-specific AST node. 2104 * <p> 2105 * The default implementation does nothing. Subclasses may reimplement. 2106 * </p> 2107 * 2108 * @param node the node to visit 2109 */ endVisit(CharacterLiteral node)2110 public void endVisit(CharacterLiteral node) { 2111 // default implementation: do nothing 2112 } 2113 2114 /** 2115 * End of visit the given type-specific AST node. 2116 * <p> 2117 * The default implementation does nothing. Subclasses may reimplement. 2118 * </p> 2119 * 2120 * @param node the node to visit 2121 */ endVisit(ClassInstanceCreation node)2122 public void endVisit(ClassInstanceCreation node) { 2123 // default implementation: do nothing 2124 } 2125 2126 /** 2127 * End of visit the given type-specific AST node. 2128 * <p> 2129 * The default implementation does nothing. Subclasses may reimplement. 2130 * </p> 2131 * 2132 * @param node the node to visit 2133 */ endVisit(CompilationUnit node)2134 public void endVisit(CompilationUnit node) { 2135 // default implementation: do nothing 2136 } 2137 2138 /** 2139 * End of visit the given type-specific AST node. 2140 * <p> 2141 * The default implementation does nothing. Subclasses may reimplement. 2142 * </p> 2143 * 2144 * @param node the node to visit 2145 */ endVisit(ConditionalExpression node)2146 public void endVisit(ConditionalExpression node) { 2147 // default implementation: do nothing 2148 } 2149 2150 /** 2151 * End of visit the given type-specific AST node. 2152 * <p> 2153 * The default implementation does nothing. Subclasses may reimplement. 2154 * </p> 2155 * 2156 * @param node the node to visit 2157 */ endVisit(ConstructorInvocation node)2158 public void endVisit(ConstructorInvocation node) { 2159 // default implementation: do nothing 2160 } 2161 2162 /** 2163 * End of visit the given type-specific AST node. 2164 * <p> 2165 * The default implementation does nothing. Subclasses may reimplement. 2166 * </p> 2167 * 2168 * @param node the node to visit 2169 */ endVisit(ContinueStatement node)2170 public void endVisit(ContinueStatement node) { 2171 // default implementation: do nothing 2172 } 2173 2174 /** 2175 * End of visit the given type-specific AST node. 2176 * <p> 2177 * The default implementation does nothing. Subclasses may reimplement. 2178 * </p> 2179 * 2180 * @param node the node to visit 2181 * @since 3.10 2182 */ endVisit(CreationReference node)2183 public void endVisit(CreationReference node) { 2184 // default implementation: do nothing 2185 } 2186 2187 /** 2188 * End of visit the given type-specific AST node. 2189 * <p> 2190 * The default implementation does nothing. Subclasses may reimplement. 2191 * </p> 2192 * 2193 * @param node the node to visit 2194 */ endVisit(DoStatement node)2195 public void endVisit(DoStatement node) { 2196 // default implementation: do nothing 2197 } 2198 2199 /** 2200 * End of visit the given type-specific AST node. 2201 * <p> 2202 * The default implementation does nothing. Subclasses may reimplement. 2203 * </p> 2204 * 2205 * @param node the node to visit 2206 */ endVisit(EmptyStatement node)2207 public void endVisit(EmptyStatement node) { 2208 // default implementation: do nothing 2209 } 2210 2211 /** 2212 * End of visit the given type-specific AST node. 2213 * <p> 2214 * The default implementation does nothing. Subclasses may reimplement. 2215 * </p> 2216 * 2217 * @param node the node to visit 2218 * @since 3.1 2219 */ endVisit(EnhancedForStatement node)2220 public void endVisit(EnhancedForStatement node) { 2221 // default implementation: do nothing 2222 } 2223 2224 /** 2225 * End of visit the given type-specific AST node. 2226 * <p> 2227 * The default implementation does nothing. Subclasses may reimplement. 2228 * </p> 2229 * 2230 * @param node the node to visit 2231 * @since 3.1 2232 */ endVisit(EnumConstantDeclaration node)2233 public void endVisit(EnumConstantDeclaration node) { 2234 // default implementation: do nothing 2235 } 2236 2237 /** 2238 * End of visit the given type-specific AST node. 2239 * <p> 2240 * The default implementation does nothing. Subclasses may reimplement. 2241 * </p> 2242 * 2243 * @param node the node to visit 2244 * @since 3.1 2245 */ endVisit(EnumDeclaration node)2246 public void endVisit(EnumDeclaration node) { 2247 // default implementation: do nothing 2248 } 2249 2250 /** 2251 * End of visit the given type-specific AST node. 2252 * <p> 2253 * The default implementation does nothing. Subclasses may reimplement. 2254 * </p> 2255 * 2256 * @param node the node to visit 2257 * @since 3.14 2258 */ endVisit(ExportsDirective node)2259 public void endVisit(ExportsDirective node) { 2260 // default implementation: do nothing 2261 } 2262 2263 /** 2264 * End of visit the given type-specific AST node. 2265 * <p> 2266 * The default implementation does nothing. Subclasses may reimplement. 2267 * </p> 2268 * 2269 * @param node the node to visit 2270 * @since 3.10 2271 */ endVisit(ExpressionMethodReference node)2272 public void endVisit(ExpressionMethodReference node) { 2273 // default implementation: do nothing 2274 } 2275 2276 /** 2277 * End of visit the given type-specific AST node. 2278 * <p> 2279 * The default implementation does nothing. Subclasses may reimplement. 2280 * </p> 2281 * 2282 * @param node the node to visit 2283 */ endVisit(ExpressionStatement node)2284 public void endVisit(ExpressionStatement node) { 2285 // default implementation: do nothing 2286 } 2287 2288 /** 2289 * End of visit the given type-specific AST node. 2290 * <p> 2291 * The default implementation does nothing. Subclasses may reimplement. 2292 * </p> 2293 * 2294 * @param node the node to visit 2295 * @since 3.10 2296 */ endVisit(Dimension node)2297 public void endVisit(Dimension node) { 2298 // do nothing by default 2299 } 2300 2301 /** 2302 * End of visit the given type-specific AST node. 2303 * <p> 2304 * The default implementation does nothing. Subclasses may reimplement. 2305 * </p> 2306 * 2307 * @param node the node to visit 2308 */ endVisit(FieldAccess node)2309 public void endVisit(FieldAccess node) { 2310 // default implementation: do nothing 2311 } 2312 2313 /** 2314 * End of visit the given type-specific AST node. 2315 * <p> 2316 * The default implementation does nothing. Subclasses may reimplement. 2317 * </p> 2318 * 2319 * @param node the node to visit 2320 */ endVisit(FieldDeclaration node)2321 public void endVisit(FieldDeclaration node) { 2322 // default implementation: do nothing 2323 } 2324 2325 /** 2326 * End of visit the given type-specific AST node. 2327 * <p> 2328 * The default implementation does nothing. Subclasses may reimplement. 2329 * </p> 2330 * 2331 * @param node the node to visit 2332 */ endVisit(ForStatement node)2333 public void endVisit(ForStatement node) { 2334 // default implementation: do nothing 2335 } 2336 2337 /** 2338 * End of visit the given type-specific AST node. 2339 * <p> 2340 * The default implementation does nothing. Subclasses may reimplement. 2341 * </p> 2342 * 2343 * @param node the node to visit 2344 */ endVisit(IfStatement node)2345 public void endVisit(IfStatement node) { 2346 // default implementation: do nothing 2347 } 2348 2349 /** 2350 * End of visit the given type-specific AST node. 2351 * <p> 2352 * The default implementation does nothing. Subclasses may reimplement. 2353 * </p> 2354 * 2355 * @param node the node to visit 2356 */ endVisit(ImportDeclaration node)2357 public void endVisit(ImportDeclaration node) { 2358 // default implementation: do nothing 2359 } 2360 2361 /** 2362 * End of visit the given type-specific AST node. 2363 * <p> 2364 * The default implementation does nothing. Subclasses may reimplement. 2365 * </p> 2366 * 2367 * @param node the node to visit 2368 */ endVisit(InfixExpression node)2369 public void endVisit(InfixExpression node) { 2370 // default implementation: do nothing 2371 } 2372 2373 /** 2374 * End of visit the given type-specific AST node. 2375 * <p> 2376 * The default implementation does nothing. Subclasses may reimplement. 2377 * </p> 2378 * 2379 * @param node the node to visit 2380 */ endVisit(InstanceofExpression node)2381 public void endVisit(InstanceofExpression node) { 2382 // default implementation: do nothing 2383 } 2384 2385 /** 2386 * End of visit the given type-specific AST node. 2387 * <p> 2388 * The default implementation does nothing. Subclasses may reimplement. 2389 * </p> 2390 * 2391 * @param node the node to visit 2392 */ endVisit(Initializer node)2393 public void endVisit(Initializer node) { 2394 // default implementation: do nothing 2395 } 2396 2397 /** 2398 * End of visit the given type-specific AST node. 2399 * <p> 2400 * The default implementation does nothing. Subclasses may reimplement. 2401 * </p> 2402 * 2403 * @param node the node to visit 2404 */ endVisit(Javadoc node)2405 public void endVisit(Javadoc node) { 2406 // default implementation: do nothing 2407 } 2408 2409 /** 2410 * End of visit the given type-specific AST node. 2411 * <p> 2412 * The default implementation does nothing. Subclasses may reimplement. 2413 * </p> 2414 * 2415 * @param node the node to visit 2416 */ endVisit(LabeledStatement node)2417 public void endVisit(LabeledStatement node) { 2418 // default implementation: do nothing 2419 } 2420 2421 /** 2422 * End of visit the given type-specific AST node. 2423 * <p> 2424 * The default implementation does nothing. Subclasses may reimplement. 2425 * </p> 2426 * 2427 * @param node the node to visit 2428 * @since 3.10 2429 */ endVisit(LambdaExpression node)2430 public void endVisit(LambdaExpression node) { 2431 // default implementation: do nothing 2432 } 2433 2434 /** 2435 * End of visit the given type-specific AST node. 2436 * <p> 2437 * The default implementation does nothing. Subclasses may reimplement. 2438 * </p> 2439 * <p>Note: {@link LineComment} and {@link BlockComment} nodes are 2440 * not considered part of main structure of the AST. This method will 2441 * only be called if a client goes out of their way to visit this 2442 * kind of node explicitly. 2443 * </p> 2444 * 2445 * @param node the node to visit 2446 * @since 3.0 2447 */ endVisit(LineComment node)2448 public void endVisit(LineComment node) { 2449 // default implementation: do nothing 2450 } 2451 2452 /** 2453 * End of visit the given type-specific AST node. 2454 * <p> 2455 * The default implementation does nothing. Subclasses may reimplement. 2456 * </p> 2457 * 2458 * @param node the node to visit 2459 * @since 3.1 2460 */ endVisit(MarkerAnnotation node)2461 public void endVisit(MarkerAnnotation node) { 2462 // default implementation: do nothing 2463 } 2464 2465 /** 2466 * End of visit the given type-specific AST node. 2467 * <p> 2468 * The default implementation does nothing. Subclasses may reimplement. 2469 * </p> 2470 * 2471 * @param node the node to visit 2472 * @since 3.0 2473 */ endVisit(MemberRef node)2474 public void endVisit(MemberRef node) { 2475 // default implementation: do nothing 2476 } 2477 2478 /** 2479 * End of visit the given type-specific AST node. 2480 * <p> 2481 * The default implementation does nothing. Subclasses may reimplement. 2482 * </p> 2483 * 2484 * @param node the node to visit 2485 * @since 3.1 2486 */ endVisit(MemberValuePair node)2487 public void endVisit(MemberValuePair node) { 2488 // default implementation: do nothing 2489 } 2490 2491 /** 2492 * End of visit the given type-specific AST node. 2493 * <p> 2494 * The default implementation does nothing. Subclasses may reimplement. 2495 * </p> 2496 * 2497 * @param node the node to visit 2498 * @since 3.0 2499 */ endVisit(MethodRef node)2500 public void endVisit(MethodRef node) { 2501 // default implementation: do nothing 2502 } 2503 2504 /** 2505 * End of visit the given type-specific AST node. 2506 * <p> 2507 * The default implementation does nothing. Subclasses may reimplement. 2508 * </p> 2509 * 2510 * @param node the node to visit 2511 * @since 3.0 2512 */ endVisit(MethodRefParameter node)2513 public void endVisit(MethodRefParameter node) { 2514 // default implementation: do nothing 2515 } 2516 2517 /** 2518 * End of visit the given type-specific AST node. 2519 * <p> 2520 * The default implementation does nothing. Subclasses may reimplement. 2521 * </p> 2522 * 2523 * @param node the node to visit 2524 */ endVisit(MethodDeclaration node)2525 public void endVisit(MethodDeclaration node) { 2526 // default implementation: do nothing 2527 } 2528 2529 /** 2530 * End of visit the given type-specific AST node. 2531 * <p> 2532 * The default implementation does nothing. Subclasses may reimplement. 2533 * </p> 2534 * 2535 * @param node the node to visit 2536 */ endVisit(MethodInvocation node)2537 public void endVisit(MethodInvocation node) { 2538 // default implementation: do nothing 2539 } 2540 2541 /** 2542 * End of visit the given type-specific AST node. 2543 * <p> 2544 * The default implementation does nothing. Subclasses may reimplement. 2545 * </p> 2546 * 2547 * @param node the node to visit 2548 * @since 3.1 2549 */ endVisit(Modifier node)2550 public void endVisit(Modifier node) { 2551 // default implementation: do nothing 2552 } 2553 2554 /** 2555 * End of visit the given type-specific AST node. 2556 * <p> 2557 * The default implementation does nothing. Subclasses may reimplement. 2558 * </p> 2559 * 2560 * @param node the node to visit 2561 * @since 3.14 2562 */ endVisit(ModuleDeclaration node)2563 public void endVisit(ModuleDeclaration node) { 2564 // default implementation: do nothing 2565 } 2566 2567 /** 2568 * End of visit the given type-specific AST node. 2569 * <p> 2570 * The default implementation does nothing. Subclasses may reimplement. 2571 * </p> 2572 * 2573 * @param node the node to visit 2574 * @since 3.14 2575 */ endVisit(ModuleModifier node)2576 public void endVisit(ModuleModifier node) { 2577 // default implementation: do nothing 2578 } 2579 2580 /** 2581 * End of visit the given type-specific AST node. 2582 * <p> 2583 * The default implementation does nothing. Subclasses may reimplement. 2584 * </p> 2585 * 2586 * @param node the node to visit 2587 * @since 3.10 2588 */ endVisit(NameQualifiedType node)2589 public void endVisit(NameQualifiedType node) { 2590 // default implementation: do nothing 2591 } 2592 2593 /** 2594 * End of visit the given type-specific AST node. 2595 * <p> 2596 * The default implementation does nothing. Subclasses may reimplement. 2597 * </p> 2598 * 2599 * @param node the node to visit 2600 * @since 3.1 2601 */ endVisit(NormalAnnotation node)2602 public void endVisit(NormalAnnotation node) { 2603 // default implementation: do nothing 2604 } 2605 2606 /** 2607 * End of visit the given type-specific AST node. 2608 * <p> 2609 * The default implementation does nothing. Subclasses may reimplement. 2610 * </p> 2611 * 2612 * @param node the node to visit 2613 */ endVisit(NullLiteral node)2614 public void endVisit(NullLiteral node) { 2615 // default implementation: do nothing 2616 } 2617 2618 /** 2619 * End of visit the given type-specific AST node. 2620 * <p> 2621 * The default implementation does nothing. Subclasses may reimplement. 2622 * </p> 2623 * 2624 * @param node the node to visit 2625 */ endVisit(NumberLiteral node)2626 public void endVisit(NumberLiteral node) { 2627 // default implementation: do nothing 2628 } 2629 2630 /** 2631 * End of visit the given type-specific AST node. 2632 * <p> 2633 * The default implementation does nothing. Subclasses may reimplement. 2634 * </p> 2635 * 2636 * @param node the node to visit 2637 * @since 3.14 2638 */ endVisit(OpensDirective node)2639 public void endVisit(OpensDirective node) { 2640 // default implementation: do nothing 2641 } 2642 2643 /** 2644 * End of visit the given type-specific AST node. 2645 * <p> 2646 * The default implementation does nothing. Subclasses may reimplement. 2647 * </p> 2648 * 2649 * @param node the node to visit 2650 */ endVisit(PackageDeclaration node)2651 public void endVisit(PackageDeclaration node) { 2652 // default implementation: do nothing 2653 } 2654 2655 /** 2656 * End of visit the given type-specific AST node. 2657 * <p> 2658 * The default implementation does nothing. Subclasses may reimplement. 2659 * </p> 2660 * 2661 * @param node the node to visit 2662 * @since 3.1 2663 */ endVisit(ParameterizedType node)2664 public void endVisit(ParameterizedType node) { 2665 // default implementation: do nothing 2666 } 2667 2668 /** 2669 * End of visit the given type-specific AST node. 2670 * <p> 2671 * The default implementation does nothing. Subclasses may reimplement. 2672 * </p> 2673 * 2674 * @param node the node to visit 2675 */ endVisit(ParenthesizedExpression node)2676 public void endVisit(ParenthesizedExpression node) { 2677 // default implementation: do nothing 2678 } 2679 2680 /** 2681 * End of visit the given type-specific AST node. 2682 * <p> 2683 * The default implementation does nothing. Subclasses may reimplement. 2684 * </p> 2685 * 2686 * @param node the node to visit 2687 */ endVisit(PostfixExpression node)2688 public void endVisit(PostfixExpression node) { 2689 // default implementation: do nothing 2690 } 2691 2692 /** 2693 * End of visit the given type-specific AST node. 2694 * <p> 2695 * The default implementation does nothing. Subclasses may reimplement. 2696 * </p> 2697 * 2698 * @param node the node to visit 2699 */ endVisit(PrefixExpression node)2700 public void endVisit(PrefixExpression node) { 2701 // default implementation: do nothing 2702 } 2703 2704 /** 2705 * End of visit the given type-specific AST node. 2706 * <p> 2707 * The default implementation does nothing. Subclasses may reimplement. 2708 * </p> 2709 * 2710 * @param node the node to visit 2711 */ endVisit(PrimitiveType node)2712 public void endVisit(PrimitiveType node) { 2713 // default implementation: do nothing 2714 } 2715 2716 /** 2717 * End of visit the given type-specific AST node. 2718 * <p> 2719 * The default implementation does nothing. Subclasses may reimplement. 2720 * </p> 2721 * 2722 * @param node the node to visit 2723 * @since 3.14 2724 */ endVisit(ProvidesDirective node)2725 public void endVisit(ProvidesDirective node) { 2726 // default implementation: do nothing 2727 } 2728 2729 /** 2730 * End of visit the given type-specific AST node. 2731 * <p> 2732 * The default implementation does nothing. Subclasses may reimplement. 2733 * </p> 2734 * 2735 * @param node the node to visit 2736 */ endVisit(QualifiedName node)2737 public void endVisit(QualifiedName node) { 2738 // default implementation: do nothing 2739 } 2740 2741 /** 2742 * End of visit the given type-specific AST node. 2743 * <p> 2744 * The default implementation does nothing. Subclasses may reimplement. 2745 * </p> 2746 * 2747 * @param node the node to visit 2748 * @since 3.1 2749 */ endVisit(QualifiedType node)2750 public void endVisit(QualifiedType node) { 2751 // default implementation: do nothing 2752 } 2753 2754 /** 2755 * End of visit the given type-specific AST node. 2756 * <p> 2757 * The default implementation does nothing. Subclasses may reimplement. 2758 * </p> 2759 * 2760 * @param node the node to visit 2761 * @since 3.14 2762 */ endVisit(RequiresDirective node)2763 public void endVisit(RequiresDirective node) { 2764 // default implementation: do nothing 2765 } 2766 2767 /** 2768 * End of visit the given type-specific AST node. 2769 * <p> 2770 * The default implementation does nothing. Subclasses may re implement. 2771 * </p> 2772 * 2773 * @param node the node to visit 2774 * @since 3.22 2775 * @noreference This method is not intended to be referenced by clients. 2776 */ endVisit(RecordDeclaration node)2777 public void endVisit(RecordDeclaration node) { 2778 // default implementation: do nothing 2779 } 2780 2781 2782 /** 2783 * End of visit the given type-specific AST node. 2784 * <p> 2785 * The default implementation does nothing. Subclasses may reimplement. 2786 * </p> 2787 * 2788 * @param node the node to visit 2789 */ endVisit(ReturnStatement node)2790 public void endVisit(ReturnStatement node) { 2791 // default implementation: do nothing 2792 } 2793 2794 /** 2795 * End of visit the given type-specific AST node. 2796 * <p> 2797 * The default implementation does nothing. Subclasses may reimplement. 2798 * </p> 2799 * 2800 * @param node the node to visit 2801 */ endVisit(SimpleName node)2802 public void endVisit(SimpleName node) { 2803 // default implementation: do nothing 2804 } 2805 2806 /** 2807 * End of visit the given type-specific AST node. 2808 * <p> 2809 * The default implementation does nothing. Subclasses may reimplement. 2810 * </p> 2811 * 2812 * @param node the node to visit 2813 */ endVisit(SimpleType node)2814 public void endVisit(SimpleType node) { 2815 // default implementation: do nothing 2816 } 2817 2818 /** 2819 * End of visit the given type-specific AST node. 2820 * <p> 2821 * The default implementation does nothing. Subclasses may reimplement. 2822 * </p> 2823 * 2824 * @param node the node to visit 2825 * @since 3.1 2826 */ endVisit(SingleMemberAnnotation node)2827 public void endVisit(SingleMemberAnnotation node) { 2828 // default implementation: do nothing 2829 } 2830 2831 /** 2832 * End of visit the given type-specific AST node. 2833 * <p> 2834 * The default implementation does nothing. Subclasses may reimplement. 2835 * </p> 2836 * 2837 * @param node the node to visit 2838 */ endVisit(SingleVariableDeclaration node)2839 public void endVisit(SingleVariableDeclaration node) { 2840 // default implementation: do nothing 2841 } 2842 2843 /** 2844 * End of visit the given type-specific AST node. 2845 * <p> 2846 * The default implementation does nothing. Subclasses may reimplement. 2847 * </p> 2848 * 2849 * @param node the node to visit 2850 */ endVisit(StringLiteral node)2851 public void endVisit(StringLiteral node) { 2852 // default implementation: do nothing 2853 } 2854 2855 /** 2856 * End of visit the given type-specific AST node. 2857 * <p> 2858 * The default implementation does nothing. Subclasses may reimplement. 2859 * </p> 2860 * 2861 * @param node the node to visit 2862 */ endVisit(SuperConstructorInvocation node)2863 public void endVisit(SuperConstructorInvocation node) { 2864 // default implementation: do nothing 2865 } 2866 2867 /** 2868 * End of visit the given type-specific AST node. 2869 * <p> 2870 * The default implementation does nothing. Subclasses may reimplement. 2871 * </p> 2872 * 2873 * @param node the node to visit 2874 */ endVisit(SuperFieldAccess node)2875 public void endVisit(SuperFieldAccess node) { 2876 // default implementation: do nothing 2877 } 2878 2879 /** 2880 * End of visit the given type-specific AST node. 2881 * <p> 2882 * The default implementation does nothing. Subclasses may reimplement. 2883 * </p> 2884 * 2885 * @param node the node to visit 2886 */ endVisit(SuperMethodInvocation node)2887 public void endVisit(SuperMethodInvocation node) { 2888 // default implementation: do nothing 2889 } 2890 2891 /** 2892 * End of visit the given type-specific AST node. 2893 * <p> 2894 * The default implementation does nothing. Subclasses may reimplement. 2895 * </p> 2896 * 2897 * @param node the node to visit 2898 * @since 3.10 2899 */ endVisit(SuperMethodReference node)2900 public void endVisit(SuperMethodReference node) { 2901 // default implementation: do nothing 2902 } 2903 2904 /** 2905 * End of visit the given type-specific AST node. 2906 * <p> 2907 * The default implementation does nothing. Subclasses may reimplement. 2908 * </p> 2909 * 2910 * @param node the node to visit 2911 */ endVisit(SwitchCase node)2912 public void endVisit(SwitchCase node) { 2913 // default implementation: do nothing 2914 } 2915 2916 /** 2917 * End of visit the given type-specific AST node. 2918 * <p> 2919 * The default implementation does nothing. Subclasses may reimplement. 2920 * </p> 2921 * 2922 * @param node the node to visit 2923 * @since 3.18 2924 */ endVisit(SwitchExpression node)2925 public void endVisit(SwitchExpression node) { 2926 // default implementation: do nothing 2927 } 2928 2929 /** 2930 * End of visit the given type-specific AST node. 2931 * <p> 2932 * The default implementation does nothing. Subclasses may reimplement. 2933 * </p> 2934 * 2935 * @param node the node to visit 2936 */ endVisit(SwitchStatement node)2937 public void endVisit(SwitchStatement node) { 2938 // default implementation: do nothing 2939 } 2940 2941 /** 2942 * End of visit the given type-specific AST node. 2943 * <p> 2944 * The default implementation does nothing. Subclasses may reimplement. 2945 * </p> 2946 * 2947 * @param node the node to visit 2948 */ endVisit(SynchronizedStatement node)2949 public void endVisit(SynchronizedStatement node) { 2950 // default implementation: do nothing 2951 } 2952 2953 /** 2954 * End of visit the given type-specific AST node. 2955 * <p> 2956 * The default implementation does nothing. Subclasses may reimplement. 2957 * </p> 2958 * 2959 * @param node the node to visit 2960 * @since 3.0 2961 */ endVisit(TagElement node)2962 public void endVisit(TagElement node) { 2963 // default implementation: do nothing 2964 } 2965 2966 /** 2967 * End of visit the given type-specific AST node. 2968 * <p> 2969 * The default implementation does nothing. Subclasses may reimplement. 2970 * </p> 2971 * 2972 * @param node the node to visit 2973 * @noreference This method is not intended to be referenced by clients as it is a part of Java preview feature. 2974 * @nooverride This method is not intended to be re-implemented or extended by clients as it is a part of Java preview feature. 2975 * @since 3.20 2976 */ endVisit(TextBlock node)2977 public void endVisit(TextBlock node) { 2978 // default implementation: do nothing 2979 } 2980 2981 /** 2982 * End of visit the given type-specific AST node. 2983 * <p> 2984 * The default implementation does nothing. Subclasses may reimplement. 2985 * </p> 2986 * 2987 * @param node the node to visit 2988 * @since 3.0 2989 */ endVisit(TextElement node)2990 public void endVisit(TextElement node) { 2991 // default implementation: do nothing 2992 } 2993 2994 /** 2995 * End of visit the given type-specific AST node. 2996 * <p> 2997 * The default implementation does nothing. Subclasses may reimplement. 2998 * </p> 2999 * 3000 * @param node the node to visit 3001 */ endVisit(ThisExpression node)3002 public void endVisit(ThisExpression node) { 3003 // default implementation: do nothing 3004 } 3005 3006 /** 3007 * End of visit the given type-specific AST node. 3008 * <p> 3009 * The default implementation does nothing. Subclasses may reimplement. 3010 * </p> 3011 * 3012 * @param node the node to visit 3013 */ endVisit(ThrowStatement node)3014 public void endVisit(ThrowStatement node) { 3015 // default implementation: do nothing 3016 } 3017 3018 /** 3019 * End of visit the given type-specific AST node. 3020 * <p> 3021 * The default implementation does nothing. Subclasses may reimplement. 3022 * </p> 3023 * 3024 * @param node the node to visit 3025 */ endVisit(TryStatement node)3026 public void endVisit(TryStatement node) { 3027 // default implementation: do nothing 3028 } 3029 /** 3030 * End of visit the given type-specific AST node. 3031 * <p> 3032 * The default implementation does nothing. Subclasses may reimplement. 3033 * </p> 3034 * 3035 * @param node the node to visit 3036 */ endVisit(TypeDeclaration node)3037 public void endVisit(TypeDeclaration node) { 3038 // default implementation: do nothing 3039 } 3040 3041 /** 3042 * End of visit the given type-specific AST node. 3043 * <p> 3044 * The default implementation does nothing. Subclasses may reimplement. 3045 * </p> 3046 * 3047 * @param node the node to visit 3048 */ endVisit(TypeDeclarationStatement node)3049 public void endVisit(TypeDeclarationStatement node) { 3050 // default implementation: do nothing 3051 } 3052 3053 /** 3054 * End of visit the given type-specific AST node. 3055 * <p> 3056 * The default implementation does nothing. Subclasses may reimplement. 3057 * </p> 3058 * 3059 * @param node the node to visit 3060 */ endVisit(TypeLiteral node)3061 public void endVisit(TypeLiteral node) { 3062 // default implementation: do nothing 3063 } 3064 3065 /** 3066 * End of visit the given type-specific AST node. 3067 * <p> 3068 * The default implementation does nothing. Subclasses may reimplement. 3069 * </p> 3070 * 3071 * @param node the node to visit 3072 * 3073 * @since 3.10 3074 */ endVisit(TypeMethodReference node)3075 public void endVisit(TypeMethodReference node) { 3076 // default implementation: do nothing 3077 } 3078 3079 /** 3080 * End of visit the given type-specific AST node. 3081 * <p> 3082 * The default implementation does nothing. Subclasses may reimplement. 3083 * </p> 3084 * 3085 * @param node the node to visit 3086 * @since 3.1 3087 */ endVisit(TypeParameter node)3088 public void endVisit(TypeParameter node) { 3089 // default implementation: do nothing 3090 } 3091 3092 /** 3093 * End of visit the given type-specific AST node. 3094 * <p> 3095 * The default implementation does nothing. Subclasses may reimplement. 3096 * </p> 3097 * 3098 * @param node the node to visit 3099 * @since 3.7.1 3100 */ endVisit(UnionType node)3101 public void endVisit(UnionType node) { 3102 // default implementation: do nothing 3103 } 3104 3105 /** 3106 * End of visit the given type-specific AST node. 3107 * <p> 3108 * The default implementation does nothing. Subclasses may reimplement. 3109 * </p> 3110 * 3111 * @param node the node to visit 3112 * @since 3.14 3113 */ endVisit(UsesDirective node)3114 public void endVisit(UsesDirective node) { 3115 // default implementation: do nothing 3116 } 3117 3118 /** 3119 * End of visit the given type-specific AST node. 3120 * <p> 3121 * The default implementation does nothing. Subclasses may reimplement. 3122 * </p> 3123 * 3124 * @param node the node to visit 3125 * @since 3.10 3126 */ endVisit(IntersectionType node)3127 public void endVisit(IntersectionType node) { 3128 // default implementation: do nothing 3129 } 3130 3131 /** 3132 * End of visit the given type-specific AST node. 3133 * <p> 3134 * The default implementation does nothing. Subclasses may reimplement. 3135 * </p> 3136 * 3137 * @param node the node to visit 3138 */ endVisit(VariableDeclarationExpression node)3139 public void endVisit(VariableDeclarationExpression node) { 3140 // default implementation: do nothing 3141 } 3142 3143 /** 3144 * End of visit the given type-specific AST node. 3145 * <p> 3146 * The default implementation does nothing. Subclasses may reimplement. 3147 * </p> 3148 * 3149 * @param node the node to visit 3150 */ endVisit(VariableDeclarationStatement node)3151 public void endVisit(VariableDeclarationStatement node) { 3152 // default implementation: do nothing 3153 } 3154 3155 /** 3156 * End of visit the given type-specific AST node. 3157 * <p> 3158 * The default implementation does nothing. Subclasses may reimplement. 3159 * </p> 3160 * 3161 * @param node the node to visit 3162 */ endVisit(VariableDeclarationFragment node)3163 public void endVisit(VariableDeclarationFragment node) { 3164 // default implementation: do nothing 3165 } 3166 3167 /** 3168 * End of visit the given type-specific AST node. 3169 * <p> 3170 * The default implementation does nothing. Subclasses may reimplement. 3171 * </p> 3172 * 3173 * @param node the node to visit 3174 */ endVisit(WhileStatement node)3175 public void endVisit(WhileStatement node) { 3176 // default implementation: do nothing 3177 } 3178 3179 /** 3180 * End of visit the given type-specific AST node. 3181 * <p> 3182 * The default implementation does nothing. Subclasses may reimplement. 3183 * </p> 3184 * 3185 * @param node the node to visit 3186 * @since 3.1 3187 */ endVisit(WildcardType node)3188 public void endVisit(WildcardType node) { 3189 // default implementation: do nothing 3190 } 3191 3192 /** 3193 * End of visit the given type-specific AST node. 3194 * <p> 3195 * The default implementation does nothing. Subclasses may reimplement. 3196 * </p> 3197 * 3198 * @param node the node to visit 3199 * @noreference This method is not intended to be referenced by clients as it is a part of Java preview feature. 3200 * @nooverride This method is not intended to be re-implemented or extended by clients as it is a part of Java preview feature. 3201 * @since 3.20 3202 */ endVisit(YieldStatement node)3203 public void endVisit(YieldStatement node) { 3204 // default implementation: do nothing 3205 } 3206 } 3207