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