1 /*
   2  * Copyright (c) 2005, 2022, Oracle and/or its affiliates. All rights reserved.
   3  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
   4  *
   5  * This code is free software; you can redistribute it and/or modify it
   6  * under the terms of the GNU General Public License version 2 only, as
   7  * published by the Free Software Foundation.  Oracle designates this
   8  * particular file as subject to the "Classpath" exception as provided
   9  * by Oracle in the LICENSE file that accompanied this code.
  10  *
  11  * This code is distributed in the hope that it will be useful, but WITHOUT
  12  * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
  13  * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
  14  * version 2 for more details (a copy is included in the LICENSE file that
  15  * accompanied this code).
  16  *
  17  * You should have received a copy of the GNU General Public License version
  18  * 2 along with this work; if not, write to the Free Software Foundation,
  19  * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
  20  *
  21  * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
  22  * or visit www.oracle.com if you need additional information or have any
  23  * questions.
  24  */
  25 
  26 package com.sun.source.util;
  27 
  28 import com.sun.source.tree.*;
  29 import jdk.internal.javac.PreviewFeature;
  30 
  31 /**
  32  * A simple visitor for tree nodes.
  33  *
  34  * @param <R> the return type of this visitor's methods.  Use {@link
  35  *            Void} for visitors that do not need to return results.
  36  * @param <P> the type of the additional parameter to this visitor's
  37  *            methods.  Use {@code Void} for visitors that do not need an
  38  *            additional parameter.
  39  *
  40  * @author Peter von der Ah&eacute;
  41  * @since 1.6
  42  */
  43 public class SimpleTreeVisitor <R,P> implements TreeVisitor<R,P> {
  44     /**
  45      * The default value, returned by the {@link #defaultAction default action}.
  46      */
  47     protected final R DEFAULT_VALUE;
  48 
  49     /**
  50      * Creates a visitor, with a DEFAULT_VALUE of {@code null}.
  51      */
  52     protected SimpleTreeVisitor() {
  53         DEFAULT_VALUE = null;
  54     }
  55 
  56     /**
  57      * Creates a visitor, with a specified DEFAULT_VALUE.
  58      * @param defaultValue the default value to be returned by the default action
  59      */
  60     protected SimpleTreeVisitor(R defaultValue) {
  61         DEFAULT_VALUE = defaultValue;
  62     }
  63 
  64     /**
  65      * The default action, used by all visit methods that are not overridden.
  66      * @param node the node being visited
  67      * @param p the parameter value passed to the visit method
  68      * @return the result value to be returned from the visit method
  69      */
  70     protected R defaultAction(Tree node, P p) {
  71         return DEFAULT_VALUE;
  72     }
  73 
  74     /**
  75      * Invokes the appropriate visit method specific to the type of the node.
  76      * @param node the node on which to dispatch
  77      * @param p a parameter to be passed to the appropriate visit method
  78      * @return the value returns from the appropriate visit method
  79      */
  80     public final R visit(Tree node, P p) {
  81         return (node == null) ? null : node.accept(this, p);
  82     }
  83 
  84     /**
  85      * Invokes the appropriate visit method on each of a sequence of nodes.
  86      * @param nodes the nodes on which to dispatch
  87      * @param p a parameter value to be passed to each appropriate visit method
  88      * @return the value return from the last of the visit methods, or null
  89      *      if none were called
  90      */
  91     public final R visit(Iterable<? extends Tree> nodes, P p) {
  92         R r = null;
  93         if (nodes != null)
  94             for (Tree node : nodes)
  95                 r = visit(node, p);
  96         return r;
  97     }
  98 
  99     /**
 100      * {@inheritDoc}
 101      *
 102      * @implSpec This implementation calls {@code defaultAction}.
 103      *
 104      * @param node {@inheritDoc}
 105      * @param p {@inheritDoc}
 106      * @return  the result of {@code defaultAction}
 107      */
 108     @Override
 109     public R visitCompilationUnit(CompilationUnitTree node, P p) {
 110         return defaultAction(node, p);
 111     }
 112 
 113     /**
 114      * {@inheritDoc}
 115      *
 116      * @implSpec This implementation calls {@code defaultAction}.
 117      *
 118      * @param node {@inheritDoc}
 119      * @param p {@inheritDoc}
 120      * @return  the result of {@code defaultAction}
 121      */
 122     @Override
 123     public R visitPackage(PackageTree node, P p) {
 124         return defaultAction(node, p);
 125     }
 126 
 127     /**
 128      * {@inheritDoc}
 129      *
 130      * @implSpec This implementation calls {@code defaultAction}.
 131      *
 132      * @param node {@inheritDoc}
 133      * @param p {@inheritDoc}
 134      * @return  the result of {@code defaultAction}
 135      */
 136     @Override
 137     public R visitImport(ImportTree node, P p) {
 138         return defaultAction(node, p);
 139     }
 140 
 141     /**
 142      * {@inheritDoc}
 143      *
 144      * @implSpec This implementation calls {@code defaultAction}.
 145      *
 146      * @param node {@inheritDoc}
 147      * @param p {@inheritDoc}
 148      * @return  the result of {@code defaultAction}
 149      */
 150     @Override
 151     public R visitClass(ClassTree node, P p) {
 152         return defaultAction(node, p);
 153     }
 154 
 155     /**
 156      * {@inheritDoc}
 157      *
 158      * @implSpec This implementation calls {@code defaultAction}.
 159      *
 160      * @param node {@inheritDoc}
 161      * @param p {@inheritDoc}
 162      * @return  the result of {@code defaultAction}
 163      */
 164     @Override
 165     public R visitMethod(MethodTree node, P p) {
 166         return defaultAction(node, p);
 167     }
 168 
 169     /**
 170      * {@inheritDoc}
 171      *
 172      * @implSpec This implementation calls {@code defaultAction}.
 173      *
 174      * @param node {@inheritDoc}
 175      * @param p {@inheritDoc}
 176      * @return  the result of {@code defaultAction}
 177      */
 178     @Override
 179     public R visitVariable(VariableTree node, P p) {
 180         return defaultAction(node, p);
 181     }
 182 
 183     /**
 184      * {@inheritDoc}
 185      *
 186      * @implSpec This implementation calls {@code defaultAction}.
 187      *
 188      * @param node {@inheritDoc}
 189      * @param p {@inheritDoc}
 190      * @return  the result of {@code defaultAction}
 191      */
 192     @Override
 193     public R visitEmptyStatement(EmptyStatementTree node, P p) {
 194         return defaultAction(node, p);
 195     }
 196 
 197     /**
 198      * {@inheritDoc}
 199      *
 200      * @implSpec This implementation calls {@code defaultAction}.
 201      *
 202      * @param node {@inheritDoc}
 203      * @param p {@inheritDoc}
 204      * @return  the result of {@code defaultAction}
 205      */
 206     @Override
 207     public R visitBlock(BlockTree node, P p) {
 208         return defaultAction(node, p);
 209     }
 210 
 211     /**
 212      * {@inheritDoc}
 213      *
 214      * @implSpec This implementation calls {@code defaultAction}.
 215      *
 216      * @param node {@inheritDoc}
 217      * @param p {@inheritDoc}
 218      * @return  the result of {@code defaultAction}
 219      */
 220     @Override
 221     public R visitDoWhileLoop(DoWhileLoopTree node, P p) {
 222         return defaultAction(node, p);
 223     }
 224 
 225     /**
 226      * {@inheritDoc}
 227      *
 228      * @implSpec This implementation calls {@code defaultAction}.
 229      *
 230      * @param node {@inheritDoc}
 231      * @param p {@inheritDoc}
 232      * @return  the result of {@code defaultAction}
 233      */
 234     @Override
 235     public R visitWhileLoop(WhileLoopTree node, P p) {
 236         return defaultAction(node, p);
 237     }
 238 
 239     /**
 240      * {@inheritDoc}
 241      *
 242      * @implSpec This implementation calls {@code defaultAction}.
 243      *
 244      * @param node {@inheritDoc}
 245      * @param p {@inheritDoc}
 246      * @return  the result of {@code defaultAction}
 247      */
 248     @Override
 249     public R visitForLoop(ForLoopTree node, P p) {
 250         return defaultAction(node, p);
 251     }
 252 
 253     /**
 254      * {@inheritDoc}
 255      *
 256      * @implSpec This implementation calls {@code defaultAction}.
 257      *
 258      * @param node {@inheritDoc}
 259      * @param p {@inheritDoc}
 260      * @return  the result of {@code defaultAction}
 261      */
 262     @Override
 263     public R visitEnhancedForLoop(EnhancedForLoopTree node, P p) {
 264         return defaultAction(node, p);
 265     }
 266 
 267     /**
 268      * {@inheritDoc}
 269      *
 270      * @implSpec This implementation calls {@code defaultAction}.
 271      *
 272      * @param node {@inheritDoc}
 273      * @param p {@inheritDoc}
 274      * @return  the result of {@code defaultAction}
 275      */
 276     @Override
 277     public R visitLabeledStatement(LabeledStatementTree node, P p) {
 278         return defaultAction(node, p);
 279     }
 280 
 281     /**
 282      * {@inheritDoc}
 283      *
 284      * @implSpec This implementation calls {@code defaultAction}.
 285      *
 286      * @param node {@inheritDoc}
 287      * @param p {@inheritDoc}
 288      * @return  the result of {@code defaultAction}
 289      */
 290     @Override
 291     public R visitSwitch(SwitchTree node, P p) {
 292         return defaultAction(node, p);
 293     }
 294 
 295     /**
 296      * {@inheritDoc}
 297      *
 298      * @implSpec This implementation calls {@code defaultAction}.
 299      *
 300      * @param node {@inheritDoc}
 301      * @param p {@inheritDoc}
 302      * @return  the result of {@code defaultAction}
 303      */
 304     @Override
 305     public R visitSwitchExpression(SwitchExpressionTree node, P p) {
 306         return defaultAction(node, p);
 307     }
 308 
 309     /**
 310      * {@inheritDoc}
 311      *
 312      * @implSpec This implementation calls {@code defaultAction}.
 313      *
 314      * @param node {@inheritDoc}
 315      * @param p {@inheritDoc}
 316      * @return  the result of {@code defaultAction}
 317      */
 318     @Override
 319     public R visitCase(CaseTree node, P p) {
 320         return defaultAction(node, p);
 321     }
 322 
 323     /**
 324      * {@inheritDoc}
 325      *
 326      * @implSpec This implementation calls {@code defaultAction}.
 327      *
 328      * @param node {@inheritDoc}
 329      * @param p {@inheritDoc}
 330      * @return  the result of {@code defaultAction}
 331      */
 332     @Override
 333     public R visitSynchronized(SynchronizedTree node, P p) {
 334         return defaultAction(node, p);
 335     }
 336 
 337     /**
 338      * {@inheritDoc}
 339      *
 340      * @implSpec This implementation calls {@code defaultAction}.
 341      *
 342      * @param node {@inheritDoc}
 343      * @param p {@inheritDoc}
 344      * @return  the result of {@code defaultAction}
 345      */
 346     @Override
 347     public R visitTry(TryTree node, P p) {
 348         return defaultAction(node, p);
 349     }
 350 
 351     /**
 352      * {@inheritDoc}
 353      *
 354      * @implSpec This implementation calls {@code defaultAction}.
 355      *
 356      * @param node {@inheritDoc}
 357      * @param p {@inheritDoc}
 358      * @return  the result of {@code defaultAction}
 359      */
 360     @Override
 361     public R visitCatch(CatchTree node, P p) {
 362         return defaultAction(node, p);
 363     }
 364 
 365     /**
 366      * {@inheritDoc}
 367      *
 368      * @implSpec This implementation calls {@code defaultAction}.
 369      *
 370      * @param node {@inheritDoc}
 371      * @param p {@inheritDoc}
 372      * @return  the result of {@code defaultAction}
 373      */
 374     @Override
 375     public R visitConditionalExpression(ConditionalExpressionTree node, P p) {
 376         return defaultAction(node, p);
 377     }
 378 
 379     /**
 380      * {@inheritDoc}
 381      *
 382      * @implSpec This implementation calls {@code defaultAction}.
 383      *
 384      * @param node {@inheritDoc}
 385      * @param p {@inheritDoc}
 386      * @return  the result of {@code defaultAction}
 387      */
 388     @Override
 389     public R visitIf(IfTree node, P p) {
 390         return defaultAction(node, p);
 391     }
 392 
 393     /**
 394      * {@inheritDoc}
 395      *
 396      * @implSpec This implementation calls {@code defaultAction}.
 397      *
 398      * @param node {@inheritDoc}
 399      * @param p {@inheritDoc}
 400      * @return  the result of {@code defaultAction}
 401      */
 402     @Override
 403     public R visitExpressionStatement(ExpressionStatementTree node, P p) {
 404         return defaultAction(node, p);
 405     }
 406 
 407     /**
 408      * {@inheritDoc}
 409      *
 410      * @implSpec This implementation calls {@code defaultAction}.
 411      *
 412      * @param node {@inheritDoc}
 413      * @param p {@inheritDoc}
 414      * @return  the result of {@code defaultAction}
 415      */
 416     @Override
 417     public R visitBreak(BreakTree node, P p) {
 418         return defaultAction(node, p);
 419     }
 420 
 421     /**
 422      * {@inheritDoc}
 423      *
 424      * @implSpec This implementation calls {@code defaultAction}.
 425      *
 426      * @param node {@inheritDoc}
 427      * @param p {@inheritDoc}
 428      * @return  the result of {@code defaultAction}
 429      */
 430     @Override
 431     public R visitContinue(ContinueTree node, P p) {
 432         return defaultAction(node, p);
 433     }
 434 
 435     /**
 436      * {@inheritDoc}
 437      *
 438      * @implSpec This implementation calls {@code defaultAction}.
 439      *
 440      * @param node {@inheritDoc}
 441      * @param p {@inheritDoc}
 442      * @return  the result of {@code defaultAction}
 443      */
 444     @Override
 445     public R visitReturn(ReturnTree node, P p) {
 446         return defaultAction(node, p);
 447     }
 448 
 449     /**
 450      * {@inheritDoc}
 451      *
 452      * @implSpec This implementation calls {@code defaultAction}.
 453      *
 454      * @param node {@inheritDoc}
 455      * @param p {@inheritDoc}
 456      * @return  the result of {@code defaultAction}
 457      */
 458     @Override
 459     public R visitThrow(ThrowTree node, P p) {
 460         return defaultAction(node, p);
 461     }
 462 
 463     /**
 464      * {@inheritDoc}
 465      *
 466      * @implSpec This implementation calls {@code defaultAction}.
 467      *
 468      * @param node {@inheritDoc}
 469      * @param p {@inheritDoc}
 470      * @return  the result of {@code defaultAction}
 471      */
 472     @Override
 473     public R visitAssert(AssertTree node, P p) {
 474         return defaultAction(node, p);
 475     }
 476 
 477     /**
 478      * {@inheritDoc}
 479      *
 480      * @implSpec This implementation calls {@code defaultAction}.
 481      *
 482      * @param node {@inheritDoc}
 483      * @param p {@inheritDoc}
 484      * @return  the result of {@code defaultAction}
 485      */
 486     @Override
 487     public R visitMethodInvocation(MethodInvocationTree node, P p) {
 488         return defaultAction(node, p);
 489     }
 490 
 491     /**
 492      * {@inheritDoc}
 493      *
 494      * @implSpec This implementation calls {@code defaultAction}.
 495      *
 496      * @param node {@inheritDoc}
 497      * @param p {@inheritDoc}
 498      * @return  the result of {@code defaultAction}
 499      */
 500     @Override
 501     public R visitNewClass(NewClassTree node, P p) {
 502         return defaultAction(node, p);
 503     }
 504 
 505     /**
 506      * {@inheritDoc}
 507      *
 508      * @implSpec This implementation calls {@code defaultAction}.
 509      *
 510      * @param node {@inheritDoc}
 511      * @param p {@inheritDoc}
 512      * @return  the result of {@code defaultAction}
 513      */
 514     @Override
 515     public R visitNewArray(NewArrayTree node, P p) {
 516         return defaultAction(node, p);
 517     }
 518 
 519     /**
 520      * {@inheritDoc}
 521      *
 522      * @implSpec This implementation calls {@code defaultAction}.
 523      *
 524      * @param node {@inheritDoc}
 525      * @param p {@inheritDoc}
 526      * @return  the result of {@code defaultAction}
 527      */
 528     @Override
 529     public R visitLambdaExpression(LambdaExpressionTree node, P p) {
 530         return defaultAction(node, p);
 531     }
 532 
 533     /**
 534      * {@inheritDoc}
 535      *
 536      * @implSpec This implementation calls {@code defaultAction}.
 537      *
 538      * @param node {@inheritDoc}
 539      * @param p {@inheritDoc}
 540      * @return  the result of {@code defaultAction}
 541      */
 542     @Override
 543     public R visitParenthesized(ParenthesizedTree node, P p) {
 544         return defaultAction(node, p);
 545     }
 546 
 547     /**
 548      * {@inheritDoc}
 549      *
 550      * @implSpec This implementation calls {@code defaultAction}.
 551      *
 552      * @param node {@inheritDoc}
 553      * @param p {@inheritDoc}
 554      * @return  the result of {@code defaultAction}
 555      */
 556     @Override
 557     public R visitAssignment(AssignmentTree node, P p) {
 558         return defaultAction(node, p);
 559     }
 560 
 561     /**
 562      * {@inheritDoc}
 563      *
 564      * @implSpec This implementation calls {@code defaultAction}.
 565      *
 566      * @param node {@inheritDoc}
 567      * @param p {@inheritDoc}
 568      * @return  the result of {@code defaultAction}
 569      */
 570     @Override
 571     public R visitCompoundAssignment(CompoundAssignmentTree node, P p) {
 572         return defaultAction(node, p);
 573     }
 574 
 575     /**
 576      * {@inheritDoc}
 577      *
 578      * @implSpec This implementation calls {@code defaultAction}.
 579      *
 580      * @param node {@inheritDoc}
 581      * @param p {@inheritDoc}
 582      * @return  the result of {@code defaultAction}
 583      */
 584     @Override
 585     public R visitUnary(UnaryTree node, P p) {
 586         return defaultAction(node, p);
 587     }
 588 
 589     /**
 590      * {@inheritDoc}
 591      *
 592      * @implSpec This implementation calls {@code defaultAction}.
 593      *
 594      * @param node {@inheritDoc}
 595      * @param p {@inheritDoc}
 596      * @return  the result of {@code defaultAction}
 597      */
 598     @Override
 599     public R visitBinary(BinaryTree node, P p) {
 600         return defaultAction(node, p);
 601     }
 602 
 603     /**
 604      * {@inheritDoc}
 605      *
 606      * @implSpec This implementation calls {@code defaultAction}.
 607      *
 608      * @param node {@inheritDoc}
 609      * @param p {@inheritDoc}
 610      * @return  the result of {@code defaultAction}
 611      */
 612     @Override
 613     public R visitTypeCast(TypeCastTree node, P p) {
 614         return defaultAction(node, p);
 615     }
 616 
 617     /**
 618      * {@inheritDoc}
 619      *
 620      * @implSpec This implementation calls {@code defaultAction}.
 621      *
 622      * @param node {@inheritDoc}
 623      * @param p {@inheritDoc}
 624      * @return  the result of {@code defaultAction}
 625      */
 626     @Override
 627     public R visitInstanceOf(InstanceOfTree node, P p) {
 628         return defaultAction(node, p);
 629     }
 630 
 631     /**
 632      * {@inheritDoc} This implementation calls {@code defaultAction}.
 633      *
 634      * @param node {@inheritDoc}
 635      * @param p {@inheritDoc}
 636      * @return  the result of {@code defaultAction}
 637      * @since 21
 638      */
 639     @Override
 640     @PreviewFeature(feature=PreviewFeature.Feature.STRING_TEMPLATES, reflective=true)
 641     public R visitStringTemplate(StringTemplateTree node, P p) {
 642         return defaultAction(node, p);
 643     }
 644 
 645     /**
 646      * {@inheritDoc}
 647      *
 648      * @implSpec This implementation calls {@code defaultAction}.
 649      *
 650      * @param node {@inheritDoc}
 651      * @param p {@inheritDoc}
 652      * @return  the result of {@code defaultAction}
 653      * @since 22
 654      */
 655     @Override
 656     public R visitAnyPattern(AnyPatternTree node, P p) {
 657         return defaultAction(node, p);
 658     }
 659 
 660     /**
 661      * {@inheritDoc}
 662      *
 663      * @implSpec This implementation calls {@code defaultAction}.
 664      *
 665      * @param node {@inheritDoc}
 666      * @param p {@inheritDoc}
 667      * @return  the result of {@code defaultAction}
 668      * @since 14
 669      */
 670     @Override
 671     public R visitBindingPattern(BindingPatternTree node, P p) {
 672         return defaultAction(node, p);
 673     }
 674 
 675     /**
 676      * {@inheritDoc}
 677      *
 678      * @implSpec This implementation calls {@code defaultAction}.
 679      *
 680      * @param node {@inheritDoc}
 681      * @param p {@inheritDoc}
 682      * @return  the result of {@code defaultAction}
 683      * @since 21
 684      */
 685     @Override
 686     public R visitDefaultCaseLabel(DefaultCaseLabelTree node, P p) {
 687         return defaultAction(node, p);
 688     }
 689 
 690     /**
 691      * {@inheritDoc}
 692      *
 693      * @implSpec This implementation calls {@code defaultAction}.
 694      *
 695      * @param node {@inheritDoc}
 696      * @param p {@inheritDoc}
 697      * @return  the result of {@code defaultAction}
 698      * @since 21
 699      */
 700     @Override
 701     public R visitConstantCaseLabel(ConstantCaseLabelTree node, P p) {
 702         return defaultAction(node, p);
 703     }
 704 
 705     /**
 706      * {@inheritDoc}
 707      *
 708      * @implSpec This implementation calls {@code defaultAction}.
 709      *
 710      * @param node {@inheritDoc}
 711      * @param p {@inheritDoc}
 712      * @return  the result of {@code defaultAction}
 713      * @since 21
 714      */
 715     @Override
 716     public R visitDeconstructionPattern(DeconstructionPatternTree node, P p) {
 717         return defaultAction(node, p);
 718     }
 719 
 720     /**
 721      * {@inheritDoc}
 722      *
 723      * @implSpec This implementation calls {@code defaultAction}.
 724      *
 725      * @param node {@inheritDoc}
 726      * @param p {@inheritDoc}
 727      * @return  the result of {@code defaultAction}
 728      * @since 21
 729      */
 730     @Override
 731     public R visitPatternCaseLabel(PatternCaseLabelTree node, P p) {
 732         return defaultAction(node, p);
 733     }
 734 
 735     /**
 736      * {@inheritDoc}
 737      *
 738      * @implSpec This implementation calls {@code defaultAction}.
 739      *
 740      * @param node {@inheritDoc}
 741      * @param p {@inheritDoc}
 742      * @return  the result of {@code defaultAction}
 743      */
 744     @Override
 745     public R visitArrayAccess(ArrayAccessTree node, P p) {
 746         return defaultAction(node, p);
 747     }
 748 
 749     /**
 750      * {@inheritDoc}
 751      *
 752      * @implSpec This implementation calls {@code defaultAction}.
 753      *
 754      * @param node {@inheritDoc}
 755      * @param p {@inheritDoc}
 756      * @return  the result of {@code defaultAction}
 757      */
 758     @Override
 759     public R visitMemberSelect(MemberSelectTree node, P p) {
 760         return defaultAction(node, p);
 761     }
 762 
 763     /**
 764      * {@inheritDoc}
 765      *
 766      * @implSpec This implementation calls {@code defaultAction}.
 767      *
 768      * @param node {@inheritDoc}
 769      * @param p {@inheritDoc}
 770      * @return  the result of {@code defaultAction}
 771      */
 772     @Override
 773     public R visitMemberReference(MemberReferenceTree node, P p) {
 774         return defaultAction(node, p);
 775     }
 776 
 777     /**
 778      * {@inheritDoc}
 779      *
 780      * @implSpec This implementation calls {@code defaultAction}.
 781      *
 782      * @param node {@inheritDoc}
 783      * @param p {@inheritDoc}
 784      * @return  the result of {@code defaultAction}
 785      */
 786     @Override
 787     public R visitIdentifier(IdentifierTree node, P p) {
 788         return defaultAction(node, p);
 789     }
 790 
 791     /**
 792      * {@inheritDoc}
 793      *
 794      * @implSpec This implementation calls {@code defaultAction}.
 795      *
 796      * @param node {@inheritDoc}
 797      * @param p {@inheritDoc}
 798      * @return  the result of {@code defaultAction}
 799      */
 800     @Override
 801     public R visitLiteral(LiteralTree node, P p) {
 802         return defaultAction(node, p);
 803     }
 804 
 805     /**
 806      * {@inheritDoc}
 807      *
 808      * @implSpec This implementation calls {@code defaultAction}.
 809      *
 810      * @param node {@inheritDoc}
 811      * @param p {@inheritDoc}
 812      * @return  the result of {@code defaultAction}
 813      */
 814     @Override
 815     public R visitPrimitiveType(PrimitiveTypeTree node, P p) {
 816         return defaultAction(node, p);
 817     }
 818 
 819     /**
 820      * {@inheritDoc}
 821      *
 822      * @implSpec This implementation calls {@code defaultAction}.
 823      *
 824      * @param node {@inheritDoc}
 825      * @param p {@inheritDoc}
 826      * @return  the result of {@code defaultAction}
 827      */
 828     @Override
 829     public R visitArrayType(ArrayTypeTree node, P p) {
 830         return defaultAction(node, p);
 831     }
 832 
 833     /**
 834      * {@inheritDoc}
 835      *
 836      * @implSpec This implementation calls {@code defaultAction}.
 837      *
 838      * @param node {@inheritDoc}
 839      * @param p {@inheritDoc}
 840      * @return  the result of {@code defaultAction}
 841      */
 842     @Override
 843     public R visitParameterizedType(ParameterizedTypeTree node, P p) {
 844         return defaultAction(node, p);
 845     }
 846 
 847     /**
 848      * {@inheritDoc}
 849      *
 850      * @implSpec This implementation calls {@code defaultAction}.
 851      *
 852      * @param node {@inheritDoc}
 853      * @param p {@inheritDoc}
 854      * @return  the result of {@code defaultAction}
 855      */
 856     @Override
 857     public R visitUnionType(UnionTypeTree node, P p) {
 858         return defaultAction(node, p);
 859     }
 860 
 861     /**
 862      * {@inheritDoc}
 863      *
 864      * @implSpec This implementation calls {@code defaultAction}.
 865      *
 866      * @param node {@inheritDoc}
 867      * @param p {@inheritDoc}
 868      * @return  the result of {@code defaultAction}
 869      */
 870     @Override
 871     public R visitIntersectionType(IntersectionTypeTree node, P p) {
 872         return defaultAction(node, p);
 873     }
 874 
 875     /**
 876      * {@inheritDoc}
 877      *
 878      * @implSpec This implementation calls {@code defaultAction}.
 879      *
 880      * @param node {@inheritDoc}
 881      * @param p {@inheritDoc}
 882      * @return  the result of {@code defaultAction}
 883      */
 884     @Override
 885     public R visitTypeParameter(TypeParameterTree node, P p) {
 886         return defaultAction(node, p);
 887     }
 888 
 889     /**
 890      * {@inheritDoc}
 891      *
 892      * @implSpec This implementation calls {@code defaultAction}.
 893      *
 894      * @param node {@inheritDoc}
 895      * @param p {@inheritDoc}
 896      * @return  the result of {@code defaultAction}
 897      */
 898     @Override
 899     public R visitWildcard(WildcardTree node, P p) {
 900         return defaultAction(node, p);
 901     }
 902 
 903     /**
 904      * {@inheritDoc}
 905      *
 906      * @implSpec This implementation calls {@code defaultAction}.
 907      *
 908      * @param node {@inheritDoc}
 909      * @param p {@inheritDoc}
 910      * @return  the result of {@code defaultAction}
 911      */
 912     @Override
 913     public R visitModifiers(ModifiersTree node, P p) {
 914         return defaultAction(node, p);
 915     }
 916 
 917     /**
 918      * {@inheritDoc}
 919      *
 920      * @implSpec This implementation calls {@code defaultAction}.
 921      *
 922      * @param node {@inheritDoc}
 923      * @param p {@inheritDoc}
 924      * @return  the result of {@code defaultAction}
 925      */
 926     @Override
 927     public R visitAnnotation(AnnotationTree node, P p) {
 928         return defaultAction(node, p);
 929     }
 930 
 931     /**
 932      * {@inheritDoc}
 933      *
 934      * @implSpec This implementation calls {@code defaultAction}.
 935      *
 936      * @param node {@inheritDoc}
 937      * @param p {@inheritDoc}
 938      * @return  the result of {@code defaultAction}
 939      */
 940     @Override
 941     public R visitAnnotatedType(AnnotatedTypeTree node, P p) {
 942         return defaultAction(node, p);
 943     }
 944 
 945     /**
 946      * {@inheritDoc}
 947      *
 948      * @implSpec This implementation calls {@code defaultAction}.
 949      *
 950      * @param node {@inheritDoc}
 951      * @param p {@inheritDoc}
 952      * @return  the result of {@code defaultAction}
 953      */
 954     @Override
 955     public R visitModule(ModuleTree node, P p) {
 956         return defaultAction(node, p);
 957     }
 958 
 959     /**
 960      * {@inheritDoc}
 961      *
 962      * @implSpec This implementation calls {@code defaultAction}.
 963      *
 964      * @param node {@inheritDoc}
 965      * @param p {@inheritDoc}
 966      * @return  the result of {@code defaultAction}
 967      */
 968     @Override
 969     public R visitExports(ExportsTree node, P p) {
 970         return defaultAction(node, p);
 971     }
 972 
 973     /**
 974      * {@inheritDoc}
 975      *
 976      * @implSpec This implementation calls {@code defaultAction}.
 977      *
 978      * @param node {@inheritDoc}
 979      * @param p {@inheritDoc}
 980      * @return  the result of {@code defaultAction}
 981      */
 982     @Override
 983     public R visitOpens(OpensTree node, P p) {
 984         return defaultAction(node, p);
 985     }
 986 
 987     /**
 988      * {@inheritDoc}
 989      *
 990      * @implSpec This implementation calls {@code defaultAction}.
 991      *
 992      * @param node {@inheritDoc}
 993      * @param p {@inheritDoc}
 994      * @return  the result of {@code defaultAction}
 995      */
 996     @Override
 997     public R visitProvides(ProvidesTree node, P p) {
 998         return defaultAction(node, p);
 999     }
1000 
1001     /**
1002      * {@inheritDoc}
1003      *
1004      * @implSpec This implementation calls {@code defaultAction}.
1005      *
1006      * @param node {@inheritDoc}
1007      * @param p {@inheritDoc}
1008      * @return  the result of {@code defaultAction}
1009      */
1010     @Override
1011     public R visitRequires(RequiresTree node, P p) {
1012         return defaultAction(node, p);
1013     }
1014 
1015     /**
1016      * {@inheritDoc}
1017      *
1018      * @implSpec This implementation calls {@code defaultAction}.
1019      *
1020      * @param node {@inheritDoc}
1021      * @param p {@inheritDoc}
1022      * @return  the result of {@code defaultAction}
1023      */
1024     @Override
1025     public R visitUses(UsesTree node, P p) {
1026         return defaultAction(node, p);
1027     }
1028 
1029     /**
1030      * {@inheritDoc}
1031      *
1032      * @implSpec This implementation calls {@code defaultAction}.
1033      *
1034      * @param node {@inheritDoc}
1035      * @param p {@inheritDoc}
1036      * @return  the result of {@code defaultAction}
1037      */
1038     @Override
1039     public R visitErroneous(ErroneousTree node, P p) {
1040         return defaultAction(node, p);
1041     }
1042 
1043     /**
1044      * {@inheritDoc}
1045      *
1046      * @implSpec This implementation calls {@code defaultAction}.
1047      *
1048      * @param node {@inheritDoc}
1049      * @param p {@inheritDoc}
1050      * @return  the result of {@code defaultAction}
1051      */
1052     @Override
1053     public R visitOther(Tree node, P p) {
1054         return defaultAction(node, p);
1055     }
1056 
1057     /**
1058      * {@inheritDoc}
1059      *
1060      * @implSpec This implementation calls {@code defaultAction}.
1061      *
1062      * @param node {@inheritDoc}
1063      * @param p {@inheritDoc}
1064      * @return  the result of {@code defaultAction}
1065      */
1066     @Override
1067     public R visitYield(YieldTree node, P p) {
1068         return defaultAction(node, p);
1069     }
1070 }