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}
 240      *
 241      * @implSpec This implementation calls {@code defaultAction}.
 242      *
 243      * @param node {@inheritDoc}
 244      * @param p {@inheritDoc}
 245      * @return  the result of {@code defaultAction}
 246      */
 247     @Override
 248     public R visitForLoop(ForLoopTree node, P p) {
 249         return defaultAction(node, p);
 250     }
 251 
 252     /**
 253      * {@inheritDoc}
 254      *
 255      * @implSpec This implementation calls {@code defaultAction}.
 256      *
 257      * @param node {@inheritDoc}
 258      * @param p {@inheritDoc}
 259      * @return  the result of {@code defaultAction}
 260      */
 261     @Override
 262     public R visitEnhancedForLoop(EnhancedForLoopTree node, P p) {
 263         return defaultAction(node, p);
 264     }
 265 
 266     /**
 267      * {@inheritDoc}
 268      *
 269      * @implSpec This implementation calls {@code defaultAction}.
 270      *
 271      * @param node {@inheritDoc}
 272      * @param p {@inheritDoc}
 273      * @return  the result of {@code defaultAction}
 274      */
 275     @Override
 276     public R visitLabeledStatement(LabeledStatementTree node, P p) {
 277         return defaultAction(node, p);
 278     }
 279 
 280     /**
 281      * {@inheritDoc}
 282      *
 283      * @implSpec This implementation calls {@code defaultAction}.
 284      *
 285      * @param node {@inheritDoc}
 286      * @param p {@inheritDoc}
 287      * @return  the result of {@code defaultAction}
 288      */
 289     @Override
 290     public R visitSwitch(SwitchTree node, P p) {
 291         return defaultAction(node, p);
 292     }
 293 
 294     /**
 295      * {@inheritDoc}
 296      *
 297      * @implSpec This implementation calls {@code defaultAction}.
 298      *
 299      * @param node {@inheritDoc}
 300      * @param p {@inheritDoc}
 301      * @return  the result of {@code defaultAction}
 302      *
 303      * @since 14
 304      */
 305     @Override
 306     public R visitSwitchExpression(SwitchExpressionTree node, P p) {
 307         return defaultAction(node, p);
 308     }
 309 
 310     /**
 311      * {@inheritDoc}
 312      *
 313      * @implSpec This implementation calls {@code defaultAction}.
 314      *
 315      * @param node {@inheritDoc}
 316      * @param p {@inheritDoc}
 317      * @return  the result of {@code defaultAction}
 318      */
 319     @Override
 320     public R visitCase(CaseTree node, P p) {
 321         return defaultAction(node, p);
 322     }
 323 
 324     /**
 325      * {@inheritDoc}
 326      *
 327      * @implSpec This implementation calls {@code defaultAction}.
 328      *
 329      * @param node {@inheritDoc}
 330      * @param p {@inheritDoc}
 331      * @return  the result of {@code defaultAction}
 332      */
 333     @Override
 334     public R visitSynchronized(SynchronizedTree node, P p) {
 335         return defaultAction(node, p);
 336     }
 337 
 338     /**
 339      * {@inheritDoc}
 340      *
 341      * @implSpec This implementation calls {@code defaultAction}.
 342      *
 343      * @param node {@inheritDoc}
 344      * @param p {@inheritDoc}
 345      * @return  the result of {@code defaultAction}
 346      */
 347     @Override
 348     public R visitTry(TryTree node, P p) {
 349         return defaultAction(node, p);
 350     }
 351 
 352     /**
 353      * {@inheritDoc}
 354      *
 355      * @implSpec This implementation calls {@code defaultAction}.
 356      *
 357      * @param node {@inheritDoc}
 358      * @param p {@inheritDoc}
 359      * @return  the result of {@code defaultAction}
 360      */
 361     @Override
 362     public R visitCatch(CatchTree node, P p) {
 363         return defaultAction(node, p);
 364     }
 365 
 366     /**
 367      * {@inheritDoc}
 368      *
 369      * @implSpec This implementation calls {@code defaultAction}.
 370      *
 371      * @param node {@inheritDoc}
 372      * @param p {@inheritDoc}
 373      * @return  the result of {@code defaultAction}
 374      */
 375     @Override
 376     public R visitConditionalExpression(ConditionalExpressionTree node, P p) {
 377         return defaultAction(node, p);
 378     }
 379 
 380     /**
 381      * {@inheritDoc}
 382      *
 383      * @implSpec This implementation calls {@code defaultAction}.
 384      *
 385      * @param node {@inheritDoc}
 386      * @param p {@inheritDoc}
 387      * @return  the result of {@code defaultAction}
 388      */
 389     @Override
 390     public R visitIf(IfTree node, P p) {
 391         return defaultAction(node, p);
 392     }
 393 
 394     /**
 395      * {@inheritDoc}
 396      *
 397      * @implSpec This implementation calls {@code defaultAction}.
 398      *
 399      * @param node {@inheritDoc}
 400      * @param p {@inheritDoc}
 401      * @return  the result of {@code defaultAction}
 402      */
 403     @Override
 404     public R visitExpressionStatement(ExpressionStatementTree node, P p) {
 405         return defaultAction(node, p);
 406     }
 407 
 408     /**
 409      * {@inheritDoc}
 410      *
 411      * @implSpec This implementation calls {@code defaultAction}.
 412      *
 413      * @param node {@inheritDoc}
 414      * @param p {@inheritDoc}
 415      * @return  the result of {@code defaultAction}
 416      */
 417     @Override
 418     public R visitBreak(BreakTree node, P p) {
 419         return defaultAction(node, p);
 420     }
 421 
 422     /**
 423      * {@inheritDoc}
 424      *
 425      * @implSpec This implementation calls {@code defaultAction}.
 426      *
 427      * @param node {@inheritDoc}
 428      * @param p {@inheritDoc}
 429      * @return  the result of {@code defaultAction}
 430      */
 431     @Override
 432     public R visitContinue(ContinueTree node, P p) {
 433         return defaultAction(node, p);
 434     }
 435 
 436     /**
 437      * {@inheritDoc}
 438      *
 439      * @implSpec This implementation calls {@code defaultAction}.
 440      *
 441      * @param node {@inheritDoc}
 442      * @param p {@inheritDoc}
 443      * @return  the result of {@code defaultAction}
 444      */
 445     @Override
 446     public R visitReturn(ReturnTree node, P p) {
 447         return defaultAction(node, p);
 448     }
 449 
 450     /**
 451      * {@inheritDoc}
 452      *
 453      * @implSpec This implementation calls {@code defaultAction}.
 454      *
 455      * @param node {@inheritDoc}
 456      * @param p {@inheritDoc}
 457      * @return  the result of {@code defaultAction}
 458      */
 459     @Override
 460     public R visitThrow(ThrowTree node, P p) {
 461         return defaultAction(node, p);
 462     }
 463 
 464     /**
 465      * {@inheritDoc}
 466      *
 467      * @implSpec This implementation calls {@code defaultAction}.
 468      *
 469      * @param node {@inheritDoc}
 470      * @param p {@inheritDoc}
 471      * @return  the result of {@code defaultAction}
 472      */
 473     @Override
 474     public R visitAssert(AssertTree node, P p) {
 475         return defaultAction(node, p);
 476     }
 477 
 478     /**
 479      * {@inheritDoc}
 480      *
 481      * @implSpec This implementation calls {@code defaultAction}.
 482      *
 483      * @param node {@inheritDoc}
 484      * @param p {@inheritDoc}
 485      * @return  the result of {@code defaultAction}
 486      */
 487     @Override
 488     public R visitMethodInvocation(MethodInvocationTree node, P p) {
 489         return defaultAction(node, p);
 490     }
 491 
 492     /**
 493      * {@inheritDoc}
 494      *
 495      * @implSpec This implementation calls {@code defaultAction}.
 496      *
 497      * @param node {@inheritDoc}
 498      * @param p {@inheritDoc}
 499      * @return  the result of {@code defaultAction}
 500      */
 501     @Override
 502     public R visitNewClass(NewClassTree node, P p) {
 503         return defaultAction(node, p);
 504     }
 505 
 506     /**
 507      * {@inheritDoc}
 508      *
 509      * @implSpec This implementation calls {@code defaultAction}.
 510      *
 511      * @param node {@inheritDoc}
 512      * @param p {@inheritDoc}
 513      * @return  the result of {@code defaultAction}
 514      */
 515     @Override
 516     public R visitNewArray(NewArrayTree node, P p) {
 517         return defaultAction(node, p);
 518     }
 519 
 520     /**
 521      * {@inheritDoc}
 522      *
 523      * @implSpec This implementation calls {@code defaultAction}.
 524      *
 525      * @param node {@inheritDoc}
 526      * @param p {@inheritDoc}
 527      * @return  the result of {@code defaultAction}
 528      */
 529     @Override
 530     public R visitLambdaExpression(LambdaExpressionTree node, P p) {
 531         return defaultAction(node, p);
 532     }
 533 
 534     /**
 535      * {@inheritDoc}
 536      *
 537      * @implSpec This implementation calls {@code defaultAction}.
 538      *
 539      * @param node {@inheritDoc}
 540      * @param p {@inheritDoc}
 541      * @return  the result of {@code defaultAction}
 542      */
 543     @Override
 544     public R visitParenthesized(ParenthesizedTree node, P p) {
 545         return defaultAction(node, p);
 546     }
 547 
 548     /**
 549      * {@inheritDoc}
 550      *
 551      * @implSpec This implementation calls {@code defaultAction}.
 552      *
 553      * @param node {@inheritDoc}
 554      * @param p {@inheritDoc}
 555      * @return  the result of {@code defaultAction}
 556      */
 557     @Override
 558     public R visitAssignment(AssignmentTree node, P p) {
 559         return defaultAction(node, p);
 560     }
 561 
 562     /**
 563      * {@inheritDoc}
 564      *
 565      * @implSpec This implementation calls {@code defaultAction}.
 566      *
 567      * @param node {@inheritDoc}
 568      * @param p {@inheritDoc}
 569      * @return  the result of {@code defaultAction}
 570      */
 571     @Override
 572     public R visitCompoundAssignment(CompoundAssignmentTree node, P p) {
 573         return defaultAction(node, p);
 574     }
 575 
 576     /**
 577      * {@inheritDoc}
 578      *
 579      * @implSpec This implementation calls {@code defaultAction}.
 580      *
 581      * @param node {@inheritDoc}
 582      * @param p {@inheritDoc}
 583      * @return  the result of {@code defaultAction}
 584      */
 585     @Override
 586     public R visitUnary(UnaryTree node, P p) {
 587         return defaultAction(node, p);
 588     }
 589 
 590     /**
 591      * {@inheritDoc}
 592      *
 593      * @implSpec This implementation calls {@code defaultAction}.
 594      *
 595      * @param node {@inheritDoc}
 596      * @param p {@inheritDoc}
 597      * @return  the result of {@code defaultAction}
 598      */
 599     @Override
 600     public R visitBinary(BinaryTree node, P p) {
 601         return defaultAction(node, p);
 602     }
 603 
 604     /**
 605      * {@inheritDoc}
 606      *
 607      * @implSpec This implementation calls {@code defaultAction}.
 608      *
 609      * @param node {@inheritDoc}
 610      * @param p {@inheritDoc}
 611      * @return  the result of {@code defaultAction}
 612      */
 613     @Override
 614     public R visitTypeCast(TypeCastTree node, P p) {
 615         return defaultAction(node, p);
 616     }
 617 
 618     /**
 619      * {@inheritDoc}
 620      *
 621      * @implSpec This implementation calls {@code defaultAction}.
 622      *
 623      * @param node {@inheritDoc}
 624      * @param p {@inheritDoc}
 625      * @return  the result of {@code defaultAction}
 626      */
 627     @Override
 628     public R visitInstanceOf(InstanceOfTree node, P p) {
 629         return defaultAction(node, p);
 630     }
 631 
 632     /**
 633      * {@inheritDoc}
 634      *
 635      * @implSpec This implementation calls {@code defaultAction}.
 636      *
 637      * @param node {@inheritDoc}
 638      * @param p {@inheritDoc}
 639      * @return  the result of {@code defaultAction}
 640      * @since 22
 641      */
 642     @Override
 643     public R visitAnyPattern(AnyPatternTree node, P p) {
 644         return defaultAction(node, p);
 645     }
 646 
 647     /**
 648      * {@inheritDoc}
 649      *
 650      * @implSpec This implementation calls {@code defaultAction}.
 651      *
 652      * @param node {@inheritDoc}
 653      * @param p {@inheritDoc}
 654      * @return  the result of {@code defaultAction}
 655      * @since 14
 656      */
 657     @Override
 658     public R visitBindingPattern(BindingPatternTree node, P p) {
 659         return defaultAction(node, p);
 660     }
 661 
 662     /**
 663      * {@inheritDoc}
 664      *
 665      * @implSpec This implementation calls {@code defaultAction}.
 666      *
 667      * @param node {@inheritDoc}
 668      * @param p {@inheritDoc}
 669      * @return  the result of {@code defaultAction}
 670      * @since 21
 671      */
 672     @Override
 673     public R visitDefaultCaseLabel(DefaultCaseLabelTree node, P p) {
 674         return defaultAction(node, p);
 675     }
 676 
 677     /**
 678      * {@inheritDoc}
 679      *
 680      * @implSpec This implementation calls {@code defaultAction}.
 681      *
 682      * @param node {@inheritDoc}
 683      * @param p {@inheritDoc}
 684      * @return  the result of {@code defaultAction}
 685      * @since 21
 686      */
 687     @Override
 688     public R visitConstantCaseLabel(ConstantCaseLabelTree node, P p) {
 689         return defaultAction(node, p);
 690     }
 691 
 692     /**
 693      * {@inheritDoc}
 694      *
 695      * @implSpec This implementation calls {@code defaultAction}.
 696      *
 697      * @param node {@inheritDoc}
 698      * @param p {@inheritDoc}
 699      * @return  the result of {@code defaultAction}
 700      * @since 21
 701      */
 702     @Override
 703     public R visitDeconstructionPattern(DeconstructionPatternTree node, P p) {
 704         return defaultAction(node, p);
 705     }
 706 
 707     /**
 708      * {@inheritDoc}
 709      *
 710      * @implSpec This implementation calls {@code defaultAction}.
 711      *
 712      * @param node {@inheritDoc}
 713      * @param p {@inheritDoc}
 714      * @return  the result of {@code defaultAction}
 715      * @since 21
 716      */
 717     @Override
 718     public R visitPatternCaseLabel(PatternCaseLabelTree node, P p) {
 719         return defaultAction(node, p);
 720     }
 721 
 722     /**
 723      * {@inheritDoc}
 724      *
 725      * @implSpec This implementation calls {@code defaultAction}.
 726      *
 727      * @param node {@inheritDoc}
 728      * @param p {@inheritDoc}
 729      * @return  the result of {@code defaultAction}
 730      */
 731     @Override
 732     public R visitArrayAccess(ArrayAccessTree node, P p) {
 733         return defaultAction(node, p);
 734     }
 735 
 736     /**
 737      * {@inheritDoc}
 738      *
 739      * @implSpec This implementation calls {@code defaultAction}.
 740      *
 741      * @param node {@inheritDoc}
 742      * @param p {@inheritDoc}
 743      * @return  the result of {@code defaultAction}
 744      */
 745     @Override
 746     public R visitMemberSelect(MemberSelectTree node, P p) {
 747         return defaultAction(node, p);
 748     }
 749 
 750     /**
 751      * {@inheritDoc}
 752      *
 753      * @implSpec This implementation calls {@code defaultAction}.
 754      *
 755      * @param node {@inheritDoc}
 756      * @param p {@inheritDoc}
 757      * @return  the result of {@code defaultAction}
 758      */
 759     @Override
 760     public R visitMemberReference(MemberReferenceTree node, P p) {
 761         return defaultAction(node, p);
 762     }
 763 
 764     /**
 765      * {@inheritDoc}
 766      *
 767      * @implSpec This implementation calls {@code defaultAction}.
 768      *
 769      * @param node {@inheritDoc}
 770      * @param p {@inheritDoc}
 771      * @return  the result of {@code defaultAction}
 772      */
 773     @Override
 774     public R visitIdentifier(IdentifierTree node, P p) {
 775         return defaultAction(node, p);
 776     }
 777 
 778     /**
 779      * {@inheritDoc}
 780      *
 781      * @implSpec This implementation calls {@code defaultAction}.
 782      *
 783      * @param node {@inheritDoc}
 784      * @param p {@inheritDoc}
 785      * @return  the result of {@code defaultAction}
 786      */
 787     @Override
 788     public R visitLiteral(LiteralTree node, P p) {
 789         return defaultAction(node, p);
 790     }
 791 
 792     /**
 793      * {@inheritDoc}
 794      *
 795      * @implSpec This implementation calls {@code defaultAction}.
 796      *
 797      * @param node {@inheritDoc}
 798      * @param p {@inheritDoc}
 799      * @return  the result of {@code defaultAction}
 800      */
 801     @Override
 802     public R visitPrimitiveType(PrimitiveTypeTree node, P p) {
 803         return defaultAction(node, p);
 804     }
 805 
 806     /**
 807      * {@inheritDoc}
 808      *
 809      * @implSpec This implementation calls {@code defaultAction}.
 810      *
 811      * @param node {@inheritDoc}
 812      * @param p {@inheritDoc}
 813      * @return  the result of {@code defaultAction}
 814      */
 815     @Override
 816     public R visitArrayType(ArrayTypeTree node, P p) {
 817         return defaultAction(node, p);
 818     }
 819 
 820     /**
 821      * {@inheritDoc}
 822      *
 823      * @implSpec This implementation calls {@code defaultAction}.
 824      *
 825      * @param node {@inheritDoc}
 826      * @param p {@inheritDoc}
 827      * @return  the result of {@code defaultAction}
 828      */
 829     @Override
 830     public R visitParameterizedType(ParameterizedTypeTree node, P p) {
 831         return defaultAction(node, p);
 832     }
 833 
 834     /**
 835      * {@inheritDoc}
 836      *
 837      * @implSpec This implementation calls {@code defaultAction}.
 838      *
 839      * @param node {@inheritDoc}
 840      * @param p {@inheritDoc}
 841      * @return  the result of {@code defaultAction}
 842      */
 843     @Override
 844     public R visitUnionType(UnionTypeTree node, P p) {
 845         return defaultAction(node, p);
 846     }
 847 
 848     /**
 849      * {@inheritDoc}
 850      *
 851      * @implSpec This implementation calls {@code defaultAction}.
 852      *
 853      * @param node {@inheritDoc}
 854      * @param p {@inheritDoc}
 855      * @return  the result of {@code defaultAction}
 856      */
 857     @Override
 858     public R visitIntersectionType(IntersectionTypeTree node, P p) {
 859         return defaultAction(node, p);
 860     }
 861 
 862     /**
 863      * {@inheritDoc}
 864      *
 865      * @implSpec This implementation calls {@code defaultAction}.
 866      *
 867      * @param node {@inheritDoc}
 868      * @param p {@inheritDoc}
 869      * @return  the result of {@code defaultAction}
 870      */
 871     @Override
 872     public R visitTypeParameter(TypeParameterTree node, P p) {
 873         return defaultAction(node, p);
 874     }
 875 
 876     /**
 877      * {@inheritDoc}
 878      *
 879      * @implSpec This implementation calls {@code defaultAction}.
 880      *
 881      * @param node {@inheritDoc}
 882      * @param p {@inheritDoc}
 883      * @return  the result of {@code defaultAction}
 884      */
 885     @Override
 886     public R visitWildcard(WildcardTree node, P p) {
 887         return defaultAction(node, p);
 888     }
 889 
 890     /**
 891      * {@inheritDoc}
 892      *
 893      * @implSpec This implementation calls {@code defaultAction}.
 894      *
 895      * @param node {@inheritDoc}
 896      * @param p {@inheritDoc}
 897      * @return  the result of {@code defaultAction}
 898      */
 899     @Override
 900     public R visitModifiers(ModifiersTree node, P p) {
 901         return defaultAction(node, p);
 902     }
 903 
 904     /**
 905      * {@inheritDoc}
 906      *
 907      * @implSpec This implementation calls {@code defaultAction}.
 908      *
 909      * @param node {@inheritDoc}
 910      * @param p {@inheritDoc}
 911      * @return  the result of {@code defaultAction}
 912      */
 913     @Override
 914     public R visitAnnotation(AnnotationTree node, P p) {
 915         return defaultAction(node, p);
 916     }
 917 
 918     /**
 919      * {@inheritDoc}
 920      *
 921      * @implSpec This implementation calls {@code defaultAction}.
 922      *
 923      * @param node {@inheritDoc}
 924      * @param p {@inheritDoc}
 925      * @return  the result of {@code defaultAction}
 926      */
 927     @Override
 928     public R visitAnnotatedType(AnnotatedTypeTree node, P p) {
 929         return defaultAction(node, p);
 930     }
 931 
 932     /**
 933      * {@inheritDoc}
 934      *
 935      * @implSpec This implementation calls {@code defaultAction}.
 936      *
 937      * @param node {@inheritDoc}
 938      * @param p {@inheritDoc}
 939      * @return  the result of {@code defaultAction}
 940      */
 941     @Override
 942     public R visitModule(ModuleTree node, P p) {
 943         return defaultAction(node, p);
 944     }
 945 
 946     /**
 947      * {@inheritDoc}
 948      *
 949      * @implSpec This implementation calls {@code defaultAction}.
 950      *
 951      * @param node {@inheritDoc}
 952      * @param p {@inheritDoc}
 953      * @return  the result of {@code defaultAction}
 954      */
 955     @Override
 956     public R visitExports(ExportsTree node, P p) {
 957         return defaultAction(node, p);
 958     }
 959 
 960     /**
 961      * {@inheritDoc}
 962      *
 963      * @implSpec This implementation calls {@code defaultAction}.
 964      *
 965      * @param node {@inheritDoc}
 966      * @param p {@inheritDoc}
 967      * @return  the result of {@code defaultAction}
 968      */
 969     @Override
 970     public R visitOpens(OpensTree node, P p) {
 971         return defaultAction(node, p);
 972     }
 973 
 974     /**
 975      * {@inheritDoc}
 976      *
 977      * @implSpec This implementation calls {@code defaultAction}.
 978      *
 979      * @param node {@inheritDoc}
 980      * @param p {@inheritDoc}
 981      * @return  the result of {@code defaultAction}
 982      */
 983     @Override
 984     public R visitProvides(ProvidesTree node, P p) {
 985         return defaultAction(node, p);
 986     }
 987 
 988     /**
 989      * {@inheritDoc}
 990      *
 991      * @implSpec This implementation calls {@code defaultAction}.
 992      *
 993      * @param node {@inheritDoc}
 994      * @param p {@inheritDoc}
 995      * @return  the result of {@code defaultAction}
 996      */
 997     @Override
 998     public R visitRequires(RequiresTree node, P p) {
 999         return defaultAction(node, p);
1000     }
1001 
1002     /**
1003      * {@inheritDoc}
1004      *
1005      * @implSpec This implementation calls {@code defaultAction}.
1006      *
1007      * @param node {@inheritDoc}
1008      * @param p {@inheritDoc}
1009      * @return  the result of {@code defaultAction}
1010      */
1011     @Override
1012     public R visitUses(UsesTree node, P p) {
1013         return defaultAction(node, p);
1014     }
1015 
1016     /**
1017      * {@inheritDoc}
1018      *
1019      * @implSpec This implementation calls {@code defaultAction}.
1020      *
1021      * @param node {@inheritDoc}
1022      * @param p {@inheritDoc}
1023      * @return  the result of {@code defaultAction}
1024      */
1025     @Override
1026     public R visitErroneous(ErroneousTree node, P p) {
1027         return defaultAction(node, p);
1028     }
1029 
1030     /**
1031      * {@inheritDoc}
1032      *
1033      * @implSpec This implementation calls {@code defaultAction}.
1034      *
1035      * @param node {@inheritDoc}
1036      * @param p {@inheritDoc}
1037      * @return  the result of {@code defaultAction}
1038      */
1039     @Override
1040     public R visitOther(Tree node, P p) {
1041         return defaultAction(node, p);
1042     }
1043 
1044     /**
1045      * {@inheritDoc}
1046      *
1047      * @implSpec This implementation calls {@code defaultAction}.
1048      *
1049      * @param node {@inheritDoc}
1050      * @param p {@inheritDoc}
1051      * @return  the result of {@code defaultAction}
1052      *
1053      * @since 14
1054      */
1055     @Override
1056     public R visitYield(YieldTree node, P p) {
1057         return defaultAction(node, p);
1058     }
1059 }