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