1 /*
   2  * Copyright (c) 1999, 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.tools.javac.tree;
  27 
  28 import java.io.IOException;
  29 import java.io.StringWriter;
  30 import java.util.*;
  31 
  32 import javax.lang.model.element.Modifier;
  33 import javax.lang.model.type.TypeKind;
  34 import javax.tools.JavaFileObject;
  35 
  36 import com.sun.source.tree.*;
  37 import com.sun.tools.javac.code.*;
  38 import com.sun.tools.javac.code.Directive.RequiresDirective;
  39 import com.sun.tools.javac.code.Scope.*;
  40 import com.sun.tools.javac.code.Symbol.*;
  41 import com.sun.tools.javac.util.*;
  42 import com.sun.tools.javac.util.DefinedBy.Api;
  43 import com.sun.tools.javac.util.JCDiagnostic.DiagnosticPosition;
  44 import com.sun.tools.javac.util.List;
  45 
  46 import static com.sun.tools.javac.tree.JCTree.Tag.*;
  47 
  48 import javax.tools.JavaFileManager.Location;
  49 
  50 import com.sun.source.tree.ModuleTree.ModuleKind;
  51 import com.sun.tools.javac.code.Directive.ExportsDirective;
  52 import com.sun.tools.javac.code.Directive.OpensDirective;
  53 import com.sun.tools.javac.code.Type.ModuleType;
  54 
  55 /**
  56  * Root class for abstract syntax tree nodes. It provides definitions
  57  * for specific tree nodes as subclasses nested inside.
  58  *
  59  * <p>Each subclass is highly standardized.  It generally contains
  60  * only tree fields for the syntactic subcomponents of the node.  Some
  61  * classes that represent identifier uses or definitions also define a
  62  * Symbol field that denotes the represented identifier.  Classes for
  63  * non-local jumps also carry the jump target as a field.  The root
  64  * class Tree itself defines fields for the tree's type and position.
  65  * No other fields are kept in a tree node; instead parameters are
  66  * passed to methods accessing the node.
  67  *
  68  * <p>Except for the methods defined by com.sun.source, the only
  69  * method defined in subclasses is `visit' which applies a given
  70  * visitor to the tree. The actual tree processing is done by visitor
  71  * classes in other packages. The abstract class Visitor, as well as
  72  * an Factory interface for trees, are defined as inner classes in
  73  * Tree.
  74  *
  75  * <p>To avoid ambiguities with the Tree API in com.sun.source all sub
  76  * classes should, by convention, start with JC (javac).
  77  *
  78  * <p><b>This is NOT part of any supported API.
  79  * If you write code that depends on this, you do so at your own risk.
  80  * This code and its internal interfaces are subject to change or
  81  * deletion without notice.</b>
  82  *
  83  * @see TreeMaker
  84  * @see TreeInfo
  85  * @see TreeTranslator
  86  * @see Pretty
  87  */
  88 public abstract class JCTree implements Tree, Cloneable, DiagnosticPosition {
  89 
  90     /* Tree tag values, identifying kinds of trees */
  91     public enum Tag {
  92         /** For methods that return an invalid tag if a given condition is not met
  93          */
  94         NO_TAG,
  95 
  96         /** Toplevel nodes, of type TopLevel, representing entire source files.
  97         */
  98         TOPLEVEL,
  99 
 100         /** Package level definitions.
 101          */
 102         PACKAGEDEF,
 103 
 104         /** Import clauses, of type Import.
 105          */
 106         IMPORT,
 107 
 108         /** Class definitions, of type ClassDef.
 109          */
 110         CLASSDEF,
 111 
 112         /** Method definitions, of type MethodDef.
 113          */
 114         METHODDEF,
 115 
 116         /** Variable definitions, of type VarDef.
 117          */
 118         VARDEF,
 119 
 120         /** The no-op statement ";", of type Skip
 121          */
 122         SKIP,
 123 
 124         /** Blocks, of type Block.
 125          */
 126         BLOCK,
 127 
 128         /** Do-while loops, of type DoLoop.
 129          */
 130         DOLOOP,
 131 
 132         /** While-loops, of type WhileLoop.
 133          */
 134         WHILELOOP,
 135 
 136         /** For-loops, of type ForLoop.
 137          */
 138         FORLOOP,
 139 
 140         /** Foreach-loops, of type ForeachLoop.
 141          */
 142         FOREACHLOOP,
 143 
 144         /** Labelled statements, of type Labelled.
 145          */
 146         LABELLED,
 147 
 148         /** Switch statements, of type Switch.
 149          */
 150         SWITCH,
 151 
 152         /** Case parts in switch statements/expressions, of type Case.
 153          */
 154         CASE,
 155 
 156         /** Switch expression statements, of type Switch.
 157          */
 158         SWITCH_EXPRESSION,
 159 
 160         /** Synchronized statements, of type Synchronized.
 161          */
 162         SYNCHRONIZED,
 163 
 164         /** Try statements, of type Try.
 165          */
 166         TRY,
 167 
 168         /** Catch clauses in try statements, of type Catch.
 169          */
 170         CATCH,
 171 
 172         /** Conditional expressions, of type Conditional.
 173          */
 174         CONDEXPR,
 175 
 176         /** Conditional statements, of type If.
 177          */
 178         IF,
 179 
 180         /** Expression statements, of type Exec.
 181          */
 182         EXEC,
 183 
 184         /** Break statements, of type Break.
 185          */
 186         BREAK,
 187 
 188         /** Yield statements, of type Yield.
 189          */
 190         YIELD,
 191 
 192         /** Continue statements, of type Continue.
 193          */
 194         CONTINUE,
 195 
 196         /** Return statements, of type Return.
 197          */
 198         RETURN,
 199 
 200         /** Throw statements, of type Throw.
 201          */
 202         THROW,
 203 
 204         /** Assert statements, of type Assert.
 205          */
 206         ASSERT,
 207 
 208         /** Method invocation expressions, of type Apply.
 209          */
 210         APPLY,
 211 
 212         /** Class instance creation expressions, of type NewClass.
 213          */
 214         NEWCLASS,
 215 
 216         /** Array creation expressions, of type NewArray.
 217          */
 218         NEWARRAY,
 219 
 220         /** Lambda expression, of type Lambda.
 221          */
 222         LAMBDA,
 223 
 224         /** Parenthesized subexpressions, of type Parens.
 225          */
 226         PARENS,
 227 
 228         /** Assignment expressions, of type Assign.
 229          */
 230         ASSIGN,
 231 
 232         /** Type cast expressions, of type TypeCast.
 233          */
 234         TYPECAST,
 235 
 236         /** Type test expressions, of type TypeTest.
 237          */
 238         TYPETEST,
 239 
 240         /** Patterns.
 241          */
 242         BINDINGPATTERN,
 243         DEFAULTCASELABEL,
 244         GUARDPATTERN,
 245         PARENTHESIZEDPATTERN,
 246 
 247         /** Indexed array expressions, of type Indexed.
 248          */
 249         INDEXED,
 250 
 251         /** Selections, of type Select.
 252          */
 253         SELECT,
 254 
 255         /** Member references, of type Reference.
 256          */
 257         REFERENCE,
 258 
 259         /** Simple identifiers, of type Ident.
 260          */
 261         IDENT,
 262 
 263         /** Literals, of type Literal.
 264          */
 265         LITERAL,
 266 
 267         /** Basic type identifiers, of type TypeIdent.
 268          */
 269         TYPEIDENT,
 270 
 271         /** Array types, of type TypeArray.
 272          */
 273         TYPEARRAY,
 274 
 275         /** Parameterized types, of type TypeApply.
 276          */
 277         TYPEAPPLY,
 278 
 279         /** Union types, of type TypeUnion.
 280          */
 281         TYPEUNION,
 282 
 283         /** Intersection types, of type TypeIntersection.
 284          */
 285         TYPEINTERSECTION,
 286 
 287         /** Formal type parameters, of type TypeParameter.
 288          */
 289         TYPEPARAMETER,
 290 
 291         /** Type argument.
 292          */
 293         WILDCARD,
 294 
 295         /** Bound kind: extends, super, exact, or unbound
 296          */
 297         TYPEBOUNDKIND,
 298 
 299         /** metadata: Annotation.
 300          */
 301         ANNOTATION,
 302 
 303         /** metadata: Type annotation.
 304          */
 305         TYPE_ANNOTATION,
 306 
 307         /** metadata: Modifiers
 308          */
 309         MODIFIERS,
 310 
 311         /** An annotated type tree.
 312          */
 313         ANNOTATED_TYPE,
 314 
 315         /** Error trees, of type Erroneous.
 316          */
 317         ERRONEOUS,
 318 
 319         /** Unary operators, of type Unary.
 320          */
 321         POS,                             // +
 322         NEG,                             // -
 323         NOT,                             // !
 324         COMPL,                           // ~
 325         PREINC,                          // ++ _
 326         PREDEC,                          // -- _
 327         POSTINC,                         // _ ++
 328         POSTDEC,                         // _ --
 329 
 330         /** unary operator for null reference checks, only used internally.
 331          */
 332         NULLCHK,
 333 
 334         /** Binary operators, of type Binary.
 335          */
 336         OR,                              // ||
 337         AND,                             // &&
 338         BITOR,                           // |
 339         BITXOR,                          // ^
 340         BITAND,                          // &
 341         EQ,                              // ==
 342         NE,                              // !=
 343         LT,                              // <
 344         GT,                              // >
 345         LE,                              // <=
 346         GE,                              // >=
 347         SL,                              // <<
 348         SR,                              // >>
 349         USR,                             // >>>
 350         PLUS,                            // +
 351         MINUS,                           // -
 352         MUL,                             // *
 353         DIV,                             // /
 354         MOD,                             // %
 355 
 356         /** Assignment operators, of type Assignop.
 357          */
 358         BITOR_ASG(BITOR),                // |=
 359         BITXOR_ASG(BITXOR),              // ^=
 360         BITAND_ASG(BITAND),              // &=
 361 
 362         SL_ASG(SL),                      // <<=
 363         SR_ASG(SR),                      // >>=
 364         USR_ASG(USR),                    // >>>=
 365         PLUS_ASG(PLUS),                  // +=
 366         MINUS_ASG(MINUS),                // -=
 367         MUL_ASG(MUL),                    // *=
 368         DIV_ASG(DIV),                    // /=
 369         MOD_ASG(MOD),                    // %=
 370 
 371         MODULEDEF,
 372         EXPORTS,
 373         OPENS,
 374         PROVIDES,
 375         REQUIRES,
 376         USES,
 377 
 378         /** A synthetic let expression, of type LetExpr.
 379          */
 380         LETEXPR;                         // ala scheme
 381 
 382         private final Tag noAssignTag;
 383 
 384         private static final int numberOfOperators = MOD.ordinal() - POS.ordinal() + 1;
 385 
 386         private Tag(Tag noAssignTag) {
 387             this.noAssignTag = noAssignTag;
 388         }
 389 
 390         private Tag() {
 391             this(null);
 392         }
 393 
 394         public static int getNumberOfOperators() {
 395             return numberOfOperators;
 396         }
 397 
 398         public Tag noAssignOp() {
 399             if (noAssignTag != null)
 400                 return noAssignTag;
 401             throw new AssertionError("noAssignOp() method is not available for non assignment tags");
 402         }
 403 
 404         public boolean isPostUnaryOp() {
 405             return (this == POSTINC || this == POSTDEC);
 406         }
 407 
 408         public boolean isIncOrDecUnaryOp() {
 409             return (this == PREINC || this == PREDEC || this == POSTINC || this == POSTDEC);
 410         }
 411 
 412         public boolean isAssignop() {
 413             return noAssignTag != null;
 414         }
 415 
 416         public int operatorIndex() {
 417             return (this.ordinal() - POS.ordinal());
 418         }
 419     }
 420 
 421     /* The (encoded) position in the source file. @see util.Position.
 422      */
 423     public int pos;
 424 
 425     /* The type of this node.
 426      */
 427     public Type type;
 428 
 429     /* The tag of this node -- one of the constants declared above.
 430      */
 431     public abstract Tag getTag();
 432 
 433     /* Returns true if the tag of this node is equals to tag.
 434      */
 435     public boolean hasTag(Tag tag) {
 436         return tag == getTag();
 437     }
 438 
 439     /** Convert a tree to a pretty-printed string. */
 440     @Override
 441     public String toString() {
 442         StringWriter s = new StringWriter();
 443         try {
 444             new Pretty(s, false).printExpr(this);
 445         }
 446         catch (IOException e) {
 447             // should never happen, because StringWriter is defined
 448             // never to throw any IOExceptions
 449             throw new AssertionError(e);
 450         }
 451         return s.toString();
 452     }
 453 
 454     /** Set position field and return this tree.
 455      */
 456     public JCTree setPos(int pos) {
 457         this.pos = pos;
 458         return this;
 459     }
 460 
 461     /** Set type field and return this tree.
 462      */
 463     public JCTree setType(Type type) {
 464         this.type = type;
 465         return this;
 466     }
 467 
 468     /** Visit this tree with a given visitor.
 469      */
 470     public abstract void accept(Visitor v);
 471 
 472     @DefinedBy(Api.COMPILER_TREE)
 473     public abstract <R,D> R accept(TreeVisitor<R,D> v, D d);
 474 
 475     /** Return a shallow copy of this tree.
 476      */
 477     @Override
 478     public Object clone() {
 479         try {
 480             return super.clone();
 481         } catch(CloneNotSupportedException e) {
 482             throw new RuntimeException(e);
 483         }
 484     }
 485 
 486     /** Get a default position for this tree node.
 487      */
 488     public DiagnosticPosition pos() {
 489         return this;
 490     }
 491 
 492     // for default DiagnosticPosition
 493     public JCTree getTree() {
 494         return this;
 495     }
 496 
 497     // for default DiagnosticPosition
 498     public int getStartPosition() {
 499         return TreeInfo.getStartPos(this);
 500     }
 501 
 502     // for default DiagnosticPosition
 503     public int getPreferredPosition() {
 504         return pos;
 505     }
 506 
 507     // for default DiagnosticPosition
 508     public int getEndPosition(EndPosTable endPosTable) {
 509         return TreeInfo.getEndPos(this, endPosTable);
 510     }
 511 
 512     /**
 513      * Everything in one source file is kept in a {@linkplain JCCompilationUnit} structure.
 514      */
 515     public static class JCCompilationUnit extends JCTree implements CompilationUnitTree {
 516         /** All definitions in this file (ClassDef, Import, and Skip) */
 517         public List<JCTree> defs;
 518         /** The source file name. */
 519         public JavaFileObject sourcefile;
 520         /** The module to which this compilation unit belongs. */
 521         public ModuleSymbol modle;
 522         /** The location in which this compilation unit was found. */
 523         public Location locn;
 524         /** The package to which this compilation unit belongs. */
 525         public PackageSymbol packge;
 526         /** A scope containing top level classes. */
 527         public WriteableScope toplevelScope;
 528         /** A scope for all named imports. */
 529         public NamedImportScope namedImportScope;
 530         /** A scope for all import-on-demands. */
 531         public StarImportScope starImportScope;
 532         /** Line starting positions, defined only if option -g is set. */
 533         public Position.LineMap lineMap = null;
 534         /** A table that stores all documentation comments indexed by the tree
 535          * nodes they refer to. defined only if option -s is set. */
 536         public DocCommentTable docComments = null;
 537         /* An object encapsulating ending positions of source ranges indexed by
 538          * the tree nodes they belong to. Defined only if option -Xjcov is set. */
 539         public EndPosTable endPositions = null;
 540         protected JCCompilationUnit(List<JCTree> defs) {
 541             this.defs = defs;
 542         }
 543         @Override
 544         public void accept(Visitor v) { v.visitTopLevel(this); }
 545 
 546         @DefinedBy(Api.COMPILER_TREE)
 547         public Kind getKind() { return Kind.COMPILATION_UNIT; }
 548 
 549         public JCModuleDecl getModuleDecl() {
 550             for (JCTree tree : defs) {
 551                 if (tree.hasTag(MODULEDEF)) {
 552                     return (JCModuleDecl) tree;
 553                 }
 554             }
 555 
 556             return null;
 557         }
 558 
 559         @DefinedBy(Api.COMPILER_TREE)
 560         public JCModuleDecl getModule() {
 561             return getModuleDecl();
 562         }
 563 
 564         @DefinedBy(Api.COMPILER_TREE)
 565         public JCPackageDecl getPackage() {
 566             // PackageDecl must be the first entry if it exists
 567             if (!defs.isEmpty() && defs.head.hasTag(PACKAGEDEF))
 568                 return (JCPackageDecl)defs.head;
 569             return null;
 570         }
 571         @DefinedBy(Api.COMPILER_TREE)
 572         public List<JCAnnotation> getPackageAnnotations() {
 573             JCPackageDecl pd = getPackage();
 574             return pd != null ? pd.getAnnotations() : List.nil();
 575         }
 576         @DefinedBy(Api.COMPILER_TREE)
 577         public ExpressionTree getPackageName() {
 578             JCPackageDecl pd = getPackage();
 579             return pd != null ? pd.getPackageName() : null;
 580         }
 581 
 582         @DefinedBy(Api.COMPILER_TREE)
 583         public List<JCImport> getImports() {
 584             ListBuffer<JCImport> imports = new ListBuffer<>();
 585             for (JCTree tree : defs) {
 586                 if (tree.hasTag(IMPORT))
 587                     imports.append((JCImport)tree);
 588                 else if (!tree.hasTag(PACKAGEDEF) && !tree.hasTag(SKIP))
 589                     break;
 590             }
 591             return imports.toList();
 592         }
 593         @DefinedBy(Api.COMPILER_TREE)
 594         public JavaFileObject getSourceFile() {
 595             return sourcefile;
 596         }
 597         @DefinedBy(Api.COMPILER_TREE)
 598         public Position.LineMap getLineMap() {
 599             return lineMap;
 600         }
 601         @DefinedBy(Api.COMPILER_TREE)
 602         public List<JCTree> getTypeDecls() {
 603             List<JCTree> typeDefs;
 604             for (typeDefs = defs; !typeDefs.isEmpty(); typeDefs = typeDefs.tail) {
 605                 if (!typeDefs.head.hasTag(MODULEDEF)
 606                         && !typeDefs.head.hasTag(PACKAGEDEF) && !typeDefs.head.hasTag(IMPORT)) {
 607                     break;
 608                 }
 609             }
 610             return typeDefs;
 611         }
 612         @Override @DefinedBy(Api.COMPILER_TREE)
 613         public <R,D> R accept(TreeVisitor<R,D> v, D d) {
 614             return v.visitCompilationUnit(this, d);
 615         }
 616 
 617         @Override
 618         public Tag getTag() {
 619             return TOPLEVEL;
 620         }
 621     }
 622 
 623     /**
 624      * Package definition.
 625      */
 626     public static class JCPackageDecl extends JCTree implements PackageTree {
 627         public List<JCAnnotation> annotations;
 628         /** The tree representing the package clause. */
 629         public JCExpression pid;
 630         public PackageSymbol packge;
 631         public JCPackageDecl(List<JCAnnotation> annotations, JCExpression pid) {
 632             this.annotations = annotations;
 633             this.pid = pid;
 634         }
 635         @Override
 636         public void accept(Visitor v) { v.visitPackageDef(this); }
 637         @DefinedBy(Api.COMPILER_TREE)
 638         public Kind getKind() {
 639             return Kind.PACKAGE;
 640         }
 641         @DefinedBy(Api.COMPILER_TREE)
 642         public List<JCAnnotation> getAnnotations() {
 643             return annotations;
 644         }
 645         @DefinedBy(Api.COMPILER_TREE)
 646         public JCExpression getPackageName() {
 647             return pid;
 648         }
 649         @Override @DefinedBy(Api.COMPILER_TREE)
 650         public <R,D> R accept(TreeVisitor<R,D> v, D d) {
 651             return v.visitPackage(this, d);
 652         }
 653         @Override
 654         public Tag getTag() {
 655             return PACKAGEDEF;
 656         }
 657     }
 658 
 659     /**
 660      * An import clause.
 661      */
 662     public static class JCImport extends JCTree implements ImportTree {
 663         public boolean staticImport;
 664         /** The imported class(es). */
 665         public JCTree qualid;
 666         public com.sun.tools.javac.code.Scope importScope;
 667         protected JCImport(JCTree qualid, boolean importStatic) {
 668             this.qualid = qualid;
 669             this.staticImport = importStatic;
 670         }
 671         @Override
 672         public void accept(Visitor v) { v.visitImport(this); }
 673 
 674         @DefinedBy(Api.COMPILER_TREE)
 675         public boolean isStatic() { return staticImport; }
 676         @DefinedBy(Api.COMPILER_TREE)
 677         public JCTree getQualifiedIdentifier() { return qualid; }
 678 
 679         @DefinedBy(Api.COMPILER_TREE)
 680         public Kind getKind() { return Kind.IMPORT; }
 681         @Override @DefinedBy(Api.COMPILER_TREE)
 682         public <R,D> R accept(TreeVisitor<R,D> v, D d) {
 683             return v.visitImport(this, d);
 684         }
 685 
 686         @Override
 687         public Tag getTag() {
 688             return IMPORT;
 689         }
 690     }
 691 
 692     public static abstract class JCStatement extends JCTree implements StatementTree {
 693         @Override
 694         public JCStatement setType(Type type) {
 695             super.setType(type);
 696             return this;
 697         }
 698         @Override
 699         public JCStatement setPos(int pos) {
 700             super.setPos(pos);
 701             return this;
 702         }
 703     }
 704 
 705     public static abstract class JCCaseLabel extends JCTree implements CaseLabelTree {
 706         public abstract boolean isExpression();
 707         public boolean isNullPattern() {
 708             return isExpression() && TreeInfo.isNull((JCExpression) this);
 709         }
 710         public abstract boolean isPattern();
 711     }
 712 
 713     public static abstract class JCExpression extends JCCaseLabel implements ExpressionTree {
 714         @Override
 715         public JCExpression setType(Type type) {
 716             super.setType(type);
 717             return this;
 718         }
 719         @Override
 720         public JCExpression setPos(int pos) {
 721             super.setPos(pos);
 722             return this;
 723         }
 724 
 725         public boolean isPoly() { return false; }
 726         public boolean isStandalone() { return true; }
 727 
 728         @Override
 729         public boolean isExpression() {
 730             return true;
 731         }
 732 
 733         @Override
 734         public boolean isPattern() {
 735             return false;
 736         }
 737     }
 738 
 739     /**
 740      * Common supertype for all poly expression trees (lambda, method references,
 741      * conditionals, method and constructor calls)
 742      */
 743     public static abstract class JCPolyExpression extends JCExpression {
 744 
 745         /**
 746          * A poly expression can only be truly 'poly' in certain contexts
 747          */
 748         public enum PolyKind {
 749             /** poly expression to be treated as a standalone expression */
 750             STANDALONE,
 751             /** true poly expression */
 752             POLY
 753         }
 754 
 755         /** is this poly expression a 'true' poly expression? */
 756         public PolyKind polyKind;
 757 
 758         @Override public boolean isPoly() { return polyKind == PolyKind.POLY; }
 759         @Override public boolean isStandalone() { return polyKind == PolyKind.STANDALONE; }
 760     }
 761 
 762     /**
 763      * Common supertype for all functional expression trees (lambda and method references)
 764      */
 765     public static abstract class JCFunctionalExpression extends JCPolyExpression {
 766 
 767         public JCFunctionalExpression() {
 768             //a functional expression is always a 'true' poly
 769             polyKind = PolyKind.POLY;
 770         }
 771 
 772         /** list of target types inferred for this functional expression. */
 773         public Type target;
 774 
 775         public Type getDescriptorType(Types types) {
 776             return target != null ? types.findDescriptorType(target) : types.createErrorType(null);
 777         }
 778     }
 779 
 780     /**
 781      * A class definition.
 782      */
 783     public static class JCClassDecl extends JCStatement implements ClassTree {
 784         /** the modifiers */
 785         public JCModifiers mods;
 786         /** the name of the class */
 787         public Name name;
 788         /** formal class parameters */
 789         public List<JCTypeParameter> typarams;
 790         /** the classes this class extends */
 791         public JCExpression extending;
 792         /** the interfaces implemented by this class */
 793         public List<JCExpression> implementing;
 794         /** the subclasses allowed to extend this class, if sealed */
 795         public List<JCExpression> permitting;
 796         /** all variables and methods defined in this class */
 797         public List<JCTree> defs;
 798         /** the symbol */
 799         public ClassSymbol sym;
 800         protected JCClassDecl(JCModifiers mods,
 801                            Name name,
 802                            List<JCTypeParameter> typarams,
 803                            JCExpression extending,
 804                            List<JCExpression> implementing,
 805                            List<JCExpression> permitting,
 806                            List<JCTree> defs,
 807                            ClassSymbol sym)
 808         {
 809             this.mods = mods;
 810             this.name = name;
 811             this.typarams = typarams;
 812             this.extending = extending;
 813             this.implementing = implementing;
 814             this.permitting = permitting;
 815             this.defs = defs;
 816             this.sym = sym;
 817         }
 818         @Override
 819         public void accept(Visitor v) { v.visitClassDef(this); }
 820 
 821         @DefinedBy(Api.COMPILER_TREE)
 822         public Kind getKind() {
 823             if ((mods.flags & Flags.ANNOTATION) != 0)
 824                 return Kind.ANNOTATION_TYPE;
 825             else if ((mods.flags & Flags.INTERFACE) != 0)
 826                 return Kind.INTERFACE;
 827             else if ((mods.flags & Flags.ENUM) != 0)
 828                 return Kind.ENUM;
 829             else if ((mods.flags & Flags.RECORD) != 0)
 830                 return Kind.RECORD;
 831             else
 832                 return Kind.CLASS;
 833         }
 834 
 835         @DefinedBy(Api.COMPILER_TREE)
 836         public JCModifiers getModifiers() { return mods; }
 837         @DefinedBy(Api.COMPILER_TREE)
 838         public Name getSimpleName() { return name; }
 839         @DefinedBy(Api.COMPILER_TREE)
 840         public List<JCTypeParameter> getTypeParameters() {
 841             return typarams;
 842         }
 843         @DefinedBy(Api.COMPILER_TREE)
 844         public JCExpression getExtendsClause() { return extending; }
 845         @DefinedBy(Api.COMPILER_TREE)
 846         public List<JCExpression> getImplementsClause() {
 847             return implementing;
 848         }
 849         @SuppressWarnings("removal")
 850         @DefinedBy(Api.COMPILER_TREE)
 851         public List<JCExpression> getPermitsClause() {
 852             return permitting;
 853         }
 854         @DefinedBy(Api.COMPILER_TREE)
 855         public List<JCTree> getMembers() {
 856             return defs;
 857         }
 858         @Override @DefinedBy(Api.COMPILER_TREE)
 859         public <R,D> R accept(TreeVisitor<R,D> v, D d) {
 860             return v.visitClass(this, d);
 861         }
 862 
 863         @Override
 864         public Tag getTag() {
 865             return CLASSDEF;
 866         }
 867     }
 868 
 869     /**
 870      * A method definition.
 871      */
 872     public static class JCMethodDecl extends JCTree implements MethodTree {
 873         /** method modifiers */
 874         public JCModifiers mods;
 875         /** method name */
 876         public Name name;
 877         /** type of method return value */
 878         public JCExpression restype;
 879         /** type parameters */
 880         public List<JCTypeParameter> typarams;
 881         /** receiver parameter */
 882         public JCVariableDecl recvparam;
 883         /** value parameters */
 884         public List<JCVariableDecl> params;
 885         /** exceptions thrown by this method */
 886         public List<JCExpression> thrown;
 887         /** statements in the method */
 888         public JCBlock body;
 889         /** default value, for annotation types */
 890         public JCExpression defaultValue;
 891         /** method symbol */
 892         public MethodSymbol sym;
 893         /** does this method completes normally */
 894         public boolean completesNormally;
 895 
 896         protected JCMethodDecl(JCModifiers mods,
 897                             Name name,
 898                             JCExpression restype,
 899                             List<JCTypeParameter> typarams,
 900                             JCVariableDecl recvparam,
 901                             List<JCVariableDecl> params,
 902                             List<JCExpression> thrown,
 903                             JCBlock body,
 904                             JCExpression defaultValue,
 905                             MethodSymbol sym)
 906         {
 907             this.mods = mods;
 908             this.name = name;
 909             this.restype = restype;
 910             this.typarams = typarams;
 911             this.params = params;
 912             this.recvparam = recvparam;
 913             // TODO: do something special if the given type is null?
 914             // receiver != null ? receiver : List.<JCTypeAnnotation>nil());
 915             this.thrown = thrown;
 916             this.body = body;
 917             this.defaultValue = defaultValue;
 918             this.sym = sym;
 919         }
 920         @Override
 921         public void accept(Visitor v) { v.visitMethodDef(this); }
 922 
 923         @DefinedBy(Api.COMPILER_TREE)
 924         public Kind getKind() { return Kind.METHOD; }
 925         @DefinedBy(Api.COMPILER_TREE)
 926         public JCModifiers getModifiers() { return mods; }
 927         @DefinedBy(Api.COMPILER_TREE)
 928         public Name getName() { return name; }
 929         @DefinedBy(Api.COMPILER_TREE)
 930         public JCTree getReturnType() { return restype; }
 931         @DefinedBy(Api.COMPILER_TREE)
 932         public List<JCTypeParameter> getTypeParameters() {
 933             return typarams;
 934         }
 935         @DefinedBy(Api.COMPILER_TREE)
 936         public List<JCVariableDecl> getParameters() {
 937             return params;
 938         }
 939         @DefinedBy(Api.COMPILER_TREE)
 940         public JCVariableDecl getReceiverParameter() { return recvparam; }
 941         @DefinedBy(Api.COMPILER_TREE)
 942         public List<JCExpression> getThrows() {
 943             return thrown;
 944         }
 945         @DefinedBy(Api.COMPILER_TREE)
 946         public JCBlock getBody() { return body; }
 947         @DefinedBy(Api.COMPILER_TREE)
 948         public JCTree getDefaultValue() { // for annotation types
 949             return defaultValue;
 950         }
 951         @Override @DefinedBy(Api.COMPILER_TREE)
 952         public <R,D> R accept(TreeVisitor<R,D> v, D d) {
 953             return v.visitMethod(this, d);
 954         }
 955 
 956         @Override
 957         public Tag getTag() {
 958             return METHODDEF;
 959         }
 960   }
 961 
 962     /**
 963      * A variable definition.
 964      */
 965     public static class JCVariableDecl extends JCStatement implements VariableTree {
 966         /** variable modifiers */
 967         public JCModifiers mods;
 968         /** variable name */
 969         public Name name;
 970         /** variable name expression */
 971         public JCExpression nameexpr;
 972         /** type of the variable */
 973         public JCExpression vartype;
 974         /** variable's initial value */
 975         public JCExpression init;
 976         /** symbol */
 977         public VarSymbol sym;
 978         /** explicit start pos */
 979         public int startPos = Position.NOPOS;
 980         /** declared using `var` */
 981         private boolean declaredUsingVar;
 982 
 983         protected JCVariableDecl(JCModifiers mods,
 984                          Name name,
 985                          JCExpression vartype,
 986                          JCExpression init,
 987                          VarSymbol sym) {
 988             this(mods, name, vartype, init, sym, false);
 989         }
 990 
 991         protected JCVariableDecl(JCModifiers mods,
 992                                  Name name,
 993                                  JCExpression vartype,
 994                                  JCExpression init,
 995                                  VarSymbol sym,
 996                                  boolean declaredUsingVar) {
 997             this.mods = mods;
 998             this.name = name;
 999             this.vartype = vartype;
1000             this.init = init;
1001             this.sym = sym;
1002             this.declaredUsingVar = declaredUsingVar;
1003         }
1004 
1005         protected JCVariableDecl(JCModifiers mods,
1006                          JCExpression nameexpr,
1007                          JCExpression vartype) {
1008             this(mods, null, vartype, null, null, false);
1009             this.nameexpr = nameexpr;
1010             if (nameexpr.hasTag(Tag.IDENT)) {
1011                 this.name = ((JCIdent)nameexpr).name;
1012             } else {
1013                 // Only other option is qualified name x.y.this;
1014                 this.name = ((JCFieldAccess)nameexpr).name;
1015             }
1016         }
1017 
1018         public boolean isImplicitlyTyped() {
1019             return vartype == null;
1020         }
1021 
1022         public boolean declaredUsingVar() {
1023             return declaredUsingVar;
1024         }
1025 
1026         @Override
1027         public void accept(Visitor v) { v.visitVarDef(this); }
1028 
1029         @DefinedBy(Api.COMPILER_TREE)
1030         public Kind getKind() { return Kind.VARIABLE; }
1031         @DefinedBy(Api.COMPILER_TREE)
1032         public JCModifiers getModifiers() { return mods; }
1033         @DefinedBy(Api.COMPILER_TREE)
1034         public Name getName() { return name; }
1035         @DefinedBy(Api.COMPILER_TREE)
1036         public JCExpression getNameExpression() { return nameexpr; }
1037         @DefinedBy(Api.COMPILER_TREE)
1038         public JCTree getType() { return vartype; }
1039         @DefinedBy(Api.COMPILER_TREE)
1040         public JCExpression getInitializer() {
1041             return init;
1042         }
1043         @Override @DefinedBy(Api.COMPILER_TREE)
1044         public <R,D> R accept(TreeVisitor<R,D> v, D d) {
1045             return v.visitVariable(this, d);
1046         }
1047 
1048         @Override
1049         public Tag getTag() {
1050             return VARDEF;
1051         }
1052     }
1053 
1054     /**
1055      * A no-op statement ";".
1056      */
1057     public static class JCSkip extends JCStatement implements EmptyStatementTree {
1058         protected JCSkip() {
1059         }
1060         @Override
1061         public void accept(Visitor v) { v.visitSkip(this); }
1062 
1063         @DefinedBy(Api.COMPILER_TREE)
1064         public Kind getKind() { return Kind.EMPTY_STATEMENT; }
1065         @Override @DefinedBy(Api.COMPILER_TREE)
1066         public <R,D> R accept(TreeVisitor<R,D> v, D d) {
1067             return v.visitEmptyStatement(this, d);
1068         }
1069 
1070         @Override
1071         public Tag getTag() {
1072             return SKIP;
1073         }
1074     }
1075 
1076     /**
1077      * A statement block.
1078      */
1079     public static class JCBlock extends JCStatement implements BlockTree {
1080         /** flags */
1081         public long flags;
1082         /** statements */
1083         public List<JCStatement> stats;
1084         /** Position of closing brace, optional. */
1085         public int endpos = Position.NOPOS;
1086         protected JCBlock(long flags, List<JCStatement> stats) {
1087             this.stats = stats;
1088             this.flags = flags;
1089         }
1090         @Override
1091         public void accept(Visitor v) { v.visitBlock(this); }
1092 
1093         @DefinedBy(Api.COMPILER_TREE)
1094         public Kind getKind() { return Kind.BLOCK; }
1095         @DefinedBy(Api.COMPILER_TREE)
1096         public List<JCStatement> getStatements() {
1097             return stats;
1098         }
1099         @DefinedBy(Api.COMPILER_TREE)
1100         public boolean isStatic() { return (flags & Flags.STATIC) != 0; }
1101         @Override @DefinedBy(Api.COMPILER_TREE)
1102         public <R,D> R accept(TreeVisitor<R,D> v, D d) {
1103             return v.visitBlock(this, d);
1104         }
1105 
1106         @Override
1107         public Tag getTag() {
1108             return BLOCK;
1109         }
1110     }
1111 
1112     /**
1113      * A do loop
1114      */
1115     public static class JCDoWhileLoop extends JCStatement implements DoWhileLoopTree {
1116         public JCStatement body;
1117         public JCExpression cond;
1118         protected JCDoWhileLoop(JCStatement body, JCExpression cond) {
1119             this.body = body;
1120             this.cond = cond;
1121         }
1122         @Override
1123         public void accept(Visitor v) { v.visitDoLoop(this); }
1124 
1125         @DefinedBy(Api.COMPILER_TREE)
1126         public Kind getKind() { return Kind.DO_WHILE_LOOP; }
1127         @DefinedBy(Api.COMPILER_TREE)
1128         public JCExpression getCondition() { return cond; }
1129         @DefinedBy(Api.COMPILER_TREE)
1130         public JCStatement getStatement() { return body; }
1131         @Override @DefinedBy(Api.COMPILER_TREE)
1132         public <R,D> R accept(TreeVisitor<R,D> v, D d) {
1133             return v.visitDoWhileLoop(this, d);
1134         }
1135 
1136         @Override
1137         public Tag getTag() {
1138             return DOLOOP;
1139         }
1140     }
1141 
1142     /**
1143      * A while loop
1144      */
1145     public static class JCWhileLoop extends JCStatement implements WhileLoopTree {
1146         public JCExpression cond;
1147         public JCStatement body;
1148         protected JCWhileLoop(JCExpression cond, JCStatement body) {
1149             this.cond = cond;
1150             this.body = body;
1151         }
1152         @Override
1153         public void accept(Visitor v) { v.visitWhileLoop(this); }
1154 
1155         @DefinedBy(Api.COMPILER_TREE)
1156         public Kind getKind() { return Kind.WHILE_LOOP; }
1157         @DefinedBy(Api.COMPILER_TREE)
1158         public JCExpression getCondition() { return cond; }
1159         @DefinedBy(Api.COMPILER_TREE)
1160         public JCStatement getStatement() { return body; }
1161         @Override @DefinedBy(Api.COMPILER_TREE)
1162         public <R,D> R accept(TreeVisitor<R,D> v, D d) {
1163             return v.visitWhileLoop(this, d);
1164         }
1165 
1166         @Override
1167         public Tag getTag() {
1168             return WHILELOOP;
1169         }
1170     }
1171 
1172     /**
1173      * A for loop.
1174      */
1175     public static class JCForLoop extends JCStatement implements ForLoopTree {
1176         public List<JCStatement> init;
1177         public JCExpression cond;
1178         public List<JCExpressionStatement> step;
1179         public JCStatement body;
1180         protected JCForLoop(List<JCStatement> init,
1181                           JCExpression cond,
1182                           List<JCExpressionStatement> update,
1183                           JCStatement body)
1184         {
1185             this.init = init;
1186             this.cond = cond;
1187             this.step = update;
1188             this.body = body;
1189         }
1190         @Override
1191         public void accept(Visitor v) { v.visitForLoop(this); }
1192 
1193         @DefinedBy(Api.COMPILER_TREE)
1194         public Kind getKind() { return Kind.FOR_LOOP; }
1195         @DefinedBy(Api.COMPILER_TREE)
1196         public JCExpression getCondition() { return cond; }
1197         @DefinedBy(Api.COMPILER_TREE)
1198         public JCStatement getStatement() { return body; }
1199         @DefinedBy(Api.COMPILER_TREE)
1200         public List<JCStatement> getInitializer() {
1201             return init;
1202         }
1203         @DefinedBy(Api.COMPILER_TREE)
1204         public List<JCExpressionStatement> getUpdate() {
1205             return step;
1206         }
1207         @Override @DefinedBy(Api.COMPILER_TREE)
1208         public <R,D> R accept(TreeVisitor<R,D> v, D d) {
1209             return v.visitForLoop(this, d);
1210         }
1211 
1212         @Override
1213         public Tag getTag() {
1214             return FORLOOP;
1215         }
1216     }
1217 
1218     /**
1219      * The enhanced for loop.
1220      */
1221     public static class JCEnhancedForLoop extends JCStatement implements EnhancedForLoopTree {
1222         public JCVariableDecl var;
1223         public JCExpression expr;
1224         public JCStatement body;
1225         protected JCEnhancedForLoop(JCVariableDecl var, JCExpression expr, JCStatement body) {
1226             this.var = var;
1227             this.expr = expr;
1228             this.body = body;
1229         }
1230         @Override
1231         public void accept(Visitor v) { v.visitForeachLoop(this); }
1232 
1233         @DefinedBy(Api.COMPILER_TREE)
1234         public Kind getKind() { return Kind.ENHANCED_FOR_LOOP; }
1235         @DefinedBy(Api.COMPILER_TREE)
1236         public JCVariableDecl getVariable() { return var; }
1237         @DefinedBy(Api.COMPILER_TREE)
1238         public JCExpression getExpression() { return expr; }
1239         @DefinedBy(Api.COMPILER_TREE)
1240         public JCStatement getStatement() { return body; }
1241         @Override @DefinedBy(Api.COMPILER_TREE)
1242         public <R,D> R accept(TreeVisitor<R,D> v, D d) {
1243             return v.visitEnhancedForLoop(this, d);
1244         }
1245         @Override
1246         public Tag getTag() {
1247             return FOREACHLOOP;
1248         }
1249     }
1250 
1251     /**
1252      * A labelled expression or statement.
1253      */
1254     public static class JCLabeledStatement extends JCStatement implements LabeledStatementTree {
1255         public Name label;
1256         public JCStatement body;
1257         protected JCLabeledStatement(Name label, JCStatement body) {
1258             this.label = label;
1259             this.body = body;
1260         }
1261         @Override
1262         public void accept(Visitor v) { v.visitLabelled(this); }
1263         @DefinedBy(Api.COMPILER_TREE)
1264         public Kind getKind() { return Kind.LABELED_STATEMENT; }
1265         @DefinedBy(Api.COMPILER_TREE)
1266         public Name getLabel() { return label; }
1267         @DefinedBy(Api.COMPILER_TREE)
1268         public JCStatement getStatement() { return body; }
1269         @Override @DefinedBy(Api.COMPILER_TREE)
1270         public <R,D> R accept(TreeVisitor<R,D> v, D d) {
1271             return v.visitLabeledStatement(this, d);
1272         }
1273         @Override
1274         public Tag getTag() {
1275             return LABELLED;
1276         }
1277     }
1278 
1279     /**
1280      * A "switch ( ) { }" construction.
1281      */
1282     public static class JCSwitch extends JCStatement implements SwitchTree {
1283         public JCExpression selector;
1284         public List<JCCase> cases;
1285         /** Position of closing brace, optional. */
1286         public int endpos = Position.NOPOS;
1287         public boolean hasTotalPattern;
1288         public boolean patternSwitch;
1289         protected JCSwitch(JCExpression selector, List<JCCase> cases) {
1290             this.selector = selector;
1291             this.cases = cases;
1292         }
1293         @Override
1294         public void accept(Visitor v) { v.visitSwitch(this); }
1295 
1296         @DefinedBy(Api.COMPILER_TREE)
1297         public Kind getKind() { return Kind.SWITCH; }
1298         @DefinedBy(Api.COMPILER_TREE)
1299         public JCExpression getExpression() { return selector; }
1300         @DefinedBy(Api.COMPILER_TREE)
1301         public List<JCCase> getCases() { return cases; }
1302         @Override @DefinedBy(Api.COMPILER_TREE)
1303         public <R,D> R accept(TreeVisitor<R,D> v, D d) {
1304             return v.visitSwitch(this, d);
1305         }
1306         @Override
1307         public Tag getTag() {
1308             return SWITCH;
1309         }
1310     }
1311 
1312     /**
1313      * A "case  :" of a switch.
1314      */
1315     public static class JCCase extends JCStatement implements CaseTree {
1316         //as CaseKind is deprecated for removal (as it is part of a preview feature),
1317         //using indirection through these fields to avoid unnecessary @SuppressWarnings:
1318         public static final CaseKind STATEMENT = CaseKind.STATEMENT;
1319         public static final CaseKind RULE = CaseKind.RULE;
1320         public final CaseKind caseKind;
1321         public List<JCCaseLabel> labels;
1322         public List<JCStatement> stats;
1323         public JCTree body;
1324         public boolean completesNormally;
1325         protected JCCase(CaseKind caseKind, List<JCCaseLabel> labels,
1326                          List<JCStatement> stats, JCTree body) {
1327             Assert.checkNonNull(labels);
1328             Assert.check(labels.isEmpty() || labels.head != null);
1329             this.caseKind = caseKind;
1330             this.labels = labels;
1331             this.stats = stats;
1332             this.body = body;
1333         }
1334         @Override
1335         public void accept(Visitor v) { v.visitCase(this); }
1336 
1337         @Override @DefinedBy(Api.COMPILER_TREE)
1338         public Kind getKind() { return Kind.CASE; }
1339         @Override @Deprecated @DefinedBy(Api.COMPILER_TREE)
1340         public JCExpression getExpression() { return getExpressions().head; }
1341         @Override @DefinedBy(Api.COMPILER_TREE)
1342         public List<JCExpression> getExpressions() { return labels.stream().filter(p -> p instanceof JCExpression).map(p -> (JCExpression) p).collect(List.collector()); }
1343         @Override @DefinedBy(Api.COMPILER_TREE)
1344         public List<JCCaseLabel> getLabels() { return labels; }
1345         @Override @DefinedBy(Api.COMPILER_TREE)
1346         public List<JCStatement> getStatements() {
1347             return caseKind == CaseKind.STATEMENT ? stats : null;
1348         }
1349         @Override @DefinedBy(Api.COMPILER_TREE)
1350         public JCTree getBody() { return body; }
1351         @Override @DefinedBy(Api.COMPILER_TREE)
1352         public CaseKind getCaseKind() {
1353             return caseKind;
1354         }
1355         @Override @DefinedBy(Api.COMPILER_TREE)
1356         public <R,D> R accept(TreeVisitor<R,D> v, D d) {
1357             return v.visitCase(this, d);
1358         }
1359         @Override
1360         public Tag getTag() {
1361             return CASE;
1362         }
1363     }
1364 
1365     /**
1366      * A "switch ( ) { }" construction.
1367      */
1368     public static class JCSwitchExpression extends JCPolyExpression implements SwitchExpressionTree {
1369         public JCExpression selector;
1370         public List<JCCase> cases;
1371         /** Position of closing brace, optional. */
1372         public int endpos = Position.NOPOS;
1373         public boolean hasTotalPattern;
1374         public boolean patternSwitch;
1375         protected JCSwitchExpression(JCExpression selector, List<JCCase> cases) {
1376             this.selector = selector;
1377             this.cases = cases;
1378         }
1379         @Override
1380         public void accept(Visitor v) { v.visitSwitchExpression(this); }
1381 
1382         @DefinedBy(Api.COMPILER_TREE)
1383         public Kind getKind() { return Kind.SWITCH_EXPRESSION; }
1384         @DefinedBy(Api.COMPILER_TREE)
1385         public JCExpression getExpression() { return selector; }
1386         @DefinedBy(Api.COMPILER_TREE)
1387         public List<JCCase> getCases() { return cases; }
1388         @Override @DefinedBy(Api.COMPILER_TREE)
1389         public <R,D> R accept(TreeVisitor<R,D> v, D d) {
1390             return v.visitSwitchExpression(this, d);
1391         }
1392         @Override
1393         public Tag getTag() {
1394             return SWITCH_EXPRESSION;
1395         }
1396     }
1397 
1398     /**
1399      * A synchronized block.
1400      */
1401     public static class JCSynchronized extends JCStatement implements SynchronizedTree {
1402         public JCExpression lock;
1403         public JCBlock body;
1404         protected JCSynchronized(JCExpression lock, JCBlock body) {
1405             this.lock = lock;
1406             this.body = body;
1407         }
1408         @Override
1409         public void accept(Visitor v) { v.visitSynchronized(this); }
1410 
1411         @DefinedBy(Api.COMPILER_TREE)
1412         public Kind getKind() { return Kind.SYNCHRONIZED; }
1413         @DefinedBy(Api.COMPILER_TREE)
1414         public JCExpression getExpression() { return lock; }
1415         @DefinedBy(Api.COMPILER_TREE)
1416         public JCBlock getBlock() { return body; }
1417         @Override @DefinedBy(Api.COMPILER_TREE)
1418         public <R,D> R accept(TreeVisitor<R,D> v, D d) {
1419             return v.visitSynchronized(this, d);
1420         }
1421         @Override
1422         public Tag getTag() {
1423             return SYNCHRONIZED;
1424         }
1425     }
1426 
1427     /**
1428      * A "try { } catch ( ) { } finally { }" block.
1429      */
1430     public static class JCTry extends JCStatement implements TryTree {
1431         public JCBlock body;
1432         public List<JCCatch> catchers;
1433         public JCBlock finalizer;
1434         public List<JCTree> resources;
1435         public boolean finallyCanCompleteNormally;
1436         protected JCTry(List<JCTree> resources,
1437                         JCBlock body,
1438                         List<JCCatch> catchers,
1439                         JCBlock finalizer) {
1440             this.body = body;
1441             this.catchers = catchers;
1442             this.finalizer = finalizer;
1443             this.resources = resources;
1444         }
1445         @Override
1446         public void accept(Visitor v) { v.visitTry(this); }
1447 
1448         @DefinedBy(Api.COMPILER_TREE)
1449         public Kind getKind() { return Kind.TRY; }
1450         @DefinedBy(Api.COMPILER_TREE)
1451         public JCBlock getBlock() { return body; }
1452         @DefinedBy(Api.COMPILER_TREE)
1453         public List<JCCatch> getCatches() {
1454             return catchers;
1455         }
1456         @DefinedBy(Api.COMPILER_TREE)
1457         public JCBlock getFinallyBlock() { return finalizer; }
1458         @Override @DefinedBy(Api.COMPILER_TREE)
1459         public <R,D> R accept(TreeVisitor<R,D> v, D d) {
1460             return v.visitTry(this, d);
1461         }
1462         @Override @DefinedBy(Api.COMPILER_TREE)
1463         public List<JCTree> getResources() {
1464             return resources;
1465         }
1466         @Override
1467         public Tag getTag() {
1468             return TRY;
1469         }
1470     }
1471 
1472     /**
1473      * A catch block.
1474      */
1475     public static class JCCatch extends JCTree implements CatchTree {
1476         public JCVariableDecl param;
1477         public JCBlock body;
1478         protected JCCatch(JCVariableDecl param, JCBlock body) {
1479             this.param = param;
1480             this.body = body;
1481         }
1482         @Override
1483         public void accept(Visitor v) { v.visitCatch(this); }
1484 
1485         @DefinedBy(Api.COMPILER_TREE)
1486         public Kind getKind() { return Kind.CATCH; }
1487         @DefinedBy(Api.COMPILER_TREE)
1488         public JCVariableDecl getParameter() { return param; }
1489         @DefinedBy(Api.COMPILER_TREE)
1490         public JCBlock getBlock() { return body; }
1491         @Override @DefinedBy(Api.COMPILER_TREE)
1492         public <R,D> R accept(TreeVisitor<R,D> v, D d) {
1493             return v.visitCatch(this, d);
1494         }
1495         @Override
1496         public Tag getTag() {
1497             return CATCH;
1498         }
1499     }
1500 
1501     /**
1502      * A ( ) ? ( ) : ( ) conditional expression
1503      */
1504     public static class JCConditional extends JCPolyExpression implements ConditionalExpressionTree {
1505         public JCExpression cond;
1506         public JCExpression truepart;
1507         public JCExpression falsepart;
1508         protected JCConditional(JCExpression cond,
1509                               JCExpression truepart,
1510                               JCExpression falsepart)
1511         {
1512             this.cond = cond;
1513             this.truepart = truepart;
1514             this.falsepart = falsepart;
1515         }
1516         @Override
1517         public void accept(Visitor v) { v.visitConditional(this); }
1518 
1519         @DefinedBy(Api.COMPILER_TREE)
1520         public Kind getKind() { return Kind.CONDITIONAL_EXPRESSION; }
1521         @DefinedBy(Api.COMPILER_TREE)
1522         public JCExpression getCondition() { return cond; }
1523         @DefinedBy(Api.COMPILER_TREE)
1524         public JCExpression getTrueExpression() { return truepart; }
1525         @DefinedBy(Api.COMPILER_TREE)
1526         public JCExpression getFalseExpression() { return falsepart; }
1527         @Override @DefinedBy(Api.COMPILER_TREE)
1528         public <R,D> R accept(TreeVisitor<R,D> v, D d) {
1529             return v.visitConditionalExpression(this, d);
1530         }
1531         @Override
1532         public Tag getTag() {
1533             return CONDEXPR;
1534         }
1535     }
1536 
1537     /**
1538      * An "if ( ) { } else { }" block
1539      */
1540     public static class JCIf extends JCStatement implements IfTree {
1541         public JCExpression cond;
1542         public JCStatement thenpart;
1543         public JCStatement elsepart;
1544         protected JCIf(JCExpression cond,
1545                      JCStatement thenpart,
1546                      JCStatement elsepart)
1547         {
1548             this.cond = cond;
1549             this.thenpart = thenpart;
1550             this.elsepart = elsepart;
1551         }
1552         @Override
1553         public void accept(Visitor v) { v.visitIf(this); }
1554 
1555         @DefinedBy(Api.COMPILER_TREE)
1556         public Kind getKind() { return Kind.IF; }
1557         @DefinedBy(Api.COMPILER_TREE)
1558         public JCExpression getCondition() { return cond; }
1559         @DefinedBy(Api.COMPILER_TREE)
1560         public JCStatement getThenStatement() { return thenpart; }
1561         @DefinedBy(Api.COMPILER_TREE)
1562         public JCStatement getElseStatement() { return elsepart; }
1563         @Override @DefinedBy(Api.COMPILER_TREE)
1564         public <R,D> R accept(TreeVisitor<R,D> v, D d) {
1565             return v.visitIf(this, d);
1566         }
1567         @Override
1568         public Tag getTag() {
1569             return IF;
1570         }
1571     }
1572 
1573     /**
1574      * an expression statement
1575      */
1576     public static class JCExpressionStatement extends JCStatement implements ExpressionStatementTree {
1577         /** expression structure */
1578         public JCExpression expr;
1579         protected JCExpressionStatement(JCExpression expr)
1580         {
1581             this.expr = expr;
1582         }
1583         @Override
1584         public void accept(Visitor v) { v.visitExec(this); }
1585 
1586         @DefinedBy(Api.COMPILER_TREE)
1587         public Kind getKind() { return Kind.EXPRESSION_STATEMENT; }
1588         @DefinedBy(Api.COMPILER_TREE)
1589         public JCExpression getExpression() { return expr; }
1590         @Override @DefinedBy(Api.COMPILER_TREE)
1591         public <R,D> R accept(TreeVisitor<R,D> v, D d) {
1592             return v.visitExpressionStatement(this, d);
1593         }
1594         @Override
1595         public Tag getTag() {
1596             return EXEC;
1597         }
1598 
1599         /** Convert a expression-statement tree to a pretty-printed string. */
1600         @Override
1601         public String toString() {
1602             StringWriter s = new StringWriter();
1603             try {
1604                 new Pretty(s, false).printStat(this);
1605             }
1606             catch (IOException e) {
1607                 // should never happen, because StringWriter is defined
1608                 // never to throw any IOExceptions
1609                 throw new AssertionError(e);
1610             }
1611             return s.toString();
1612         }
1613     }
1614 
1615     /**
1616      * A break from a loop or switch.
1617      */
1618     public static class JCBreak extends JCStatement implements BreakTree {
1619         public Name label;
1620         public JCTree target;
1621         protected JCBreak(Name label, JCTree target) {
1622             this.label = label;
1623             this.target = target;
1624         }
1625         @Override
1626         public void accept(Visitor v) { v.visitBreak(this); }
1627         public boolean isValueBreak() {
1628             return target != null && target.hasTag(SWITCH_EXPRESSION);
1629         }
1630 
1631         @DefinedBy(Api.COMPILER_TREE)
1632         public Kind getKind() { return Kind.BREAK; }
1633         @DefinedBy(Api.COMPILER_TREE)
1634         public Name getLabel() {
1635             return label;
1636         }
1637         @Override @DefinedBy(Api.COMPILER_TREE)
1638         public <R,D> R accept(TreeVisitor<R,D> v, D d) {
1639             return v.visitBreak(this, d);
1640         }
1641         @Override
1642         public Tag getTag() {
1643             return BREAK;
1644         }
1645     }
1646 
1647     /**
1648      * A break-with from a switch expression.
1649      */
1650     public static class JCYield extends JCStatement implements YieldTree {
1651         public JCExpression value;
1652         public JCTree target;
1653         protected JCYield(JCExpression value, JCTree target) {
1654             this.value = value;
1655             this.target = target;
1656         }
1657         @Override
1658         public void accept(Visitor v) { v.visitYield(this); }
1659         @DefinedBy(Api.COMPILER_TREE)
1660         public Kind getKind() { return Kind.YIELD; }
1661         @DefinedBy(Api.COMPILER_TREE)
1662         public JCExpression getValue() { return value; }
1663         @Override @DefinedBy(Api.COMPILER_TREE)
1664         public <R,D> R accept(TreeVisitor<R,D> v, D d) {
1665             return v.visitYield(this, d);
1666         }
1667         @Override
1668         public Tag getTag() {
1669             return YIELD;
1670         }
1671     }
1672 
1673     /**
1674      * A continue of a loop.
1675      */
1676     public static class JCContinue extends JCStatement implements ContinueTree {
1677         public Name label;
1678         public JCTree target;
1679         protected JCContinue(Name label, JCTree target) {
1680             this.label = label;
1681             this.target = target;
1682         }
1683         @Override
1684         public void accept(Visitor v) { v.visitContinue(this); }
1685 
1686         @DefinedBy(Api.COMPILER_TREE)
1687         public Kind getKind() { return Kind.CONTINUE; }
1688         @DefinedBy(Api.COMPILER_TREE)
1689         public Name getLabel() { return label; }
1690         @Override @DefinedBy(Api.COMPILER_TREE)
1691         public <R,D> R accept(TreeVisitor<R,D> v, D d) {
1692             return v.visitContinue(this, d);
1693         }
1694         @Override
1695         public Tag getTag() {
1696             return CONTINUE;
1697         }
1698     }
1699 
1700     /**
1701      * A return statement.
1702      */
1703     public static class JCReturn extends JCStatement implements ReturnTree {
1704         public JCExpression expr;
1705         protected JCReturn(JCExpression expr) {
1706             this.expr = expr;
1707         }
1708         @Override
1709         public void accept(Visitor v) { v.visitReturn(this); }
1710 
1711         @DefinedBy(Api.COMPILER_TREE)
1712         public Kind getKind() { return Kind.RETURN; }
1713         @DefinedBy(Api.COMPILER_TREE)
1714         public JCExpression getExpression() { return expr; }
1715         @Override @DefinedBy(Api.COMPILER_TREE)
1716         public <R,D> R accept(TreeVisitor<R,D> v, D d) {
1717             return v.visitReturn(this, d);
1718         }
1719         @Override
1720         public Tag getTag() {
1721             return RETURN;
1722         }
1723     }
1724 
1725     /**
1726      * A throw statement.
1727      */
1728     public static class JCThrow extends JCStatement implements ThrowTree {
1729         public JCExpression expr;
1730         protected JCThrow(JCExpression expr) {
1731             this.expr = expr;
1732         }
1733         @Override
1734         public void accept(Visitor v) { v.visitThrow(this); }
1735 
1736         @DefinedBy(Api.COMPILER_TREE)
1737         public Kind getKind() { return Kind.THROW; }
1738         @DefinedBy(Api.COMPILER_TREE)
1739         public JCExpression getExpression() { return expr; }
1740         @Override @DefinedBy(Api.COMPILER_TREE)
1741         public <R,D> R accept(TreeVisitor<R,D> v, D d) {
1742             return v.visitThrow(this, d);
1743         }
1744         @Override
1745         public Tag getTag() {
1746             return THROW;
1747         }
1748     }
1749 
1750     /**
1751      * An assert statement.
1752      */
1753     public static class JCAssert extends JCStatement implements AssertTree {
1754         public JCExpression cond;
1755         public JCExpression detail;
1756         protected JCAssert(JCExpression cond, JCExpression detail) {
1757             this.cond = cond;
1758             this.detail = detail;
1759         }
1760         @Override
1761         public void accept(Visitor v) { v.visitAssert(this); }
1762 
1763         @DefinedBy(Api.COMPILER_TREE)
1764         public Kind getKind() { return Kind.ASSERT; }
1765         @DefinedBy(Api.COMPILER_TREE)
1766         public JCExpression getCondition() { return cond; }
1767         @DefinedBy(Api.COMPILER_TREE)
1768         public JCExpression getDetail() { return detail; }
1769         @Override @DefinedBy(Api.COMPILER_TREE)
1770         public <R,D> R accept(TreeVisitor<R,D> v, D d) {
1771             return v.visitAssert(this, d);
1772         }
1773         @Override
1774         public Tag getTag() {
1775             return ASSERT;
1776         }
1777     }
1778 
1779     /**
1780      * A method invocation
1781      */
1782     public static class JCMethodInvocation extends JCPolyExpression implements MethodInvocationTree {
1783         public List<JCExpression> typeargs;
1784         public JCExpression meth;
1785         public List<JCExpression> args;
1786         public Type varargsElement;
1787         protected JCMethodInvocation(List<JCExpression> typeargs,
1788                         JCExpression meth,
1789                         List<JCExpression> args)
1790         {
1791             this.typeargs = (typeargs == null) ? List.nil()
1792                                                : typeargs;
1793             this.meth = meth;
1794             this.args = args;
1795         }
1796         @Override
1797         public void accept(Visitor v) { v.visitApply(this); }
1798 
1799         @DefinedBy(Api.COMPILER_TREE)
1800         public Kind getKind() { return Kind.METHOD_INVOCATION; }
1801         @DefinedBy(Api.COMPILER_TREE)
1802         public List<JCExpression> getTypeArguments() {
1803             return typeargs;
1804         }
1805         @DefinedBy(Api.COMPILER_TREE)
1806         public JCExpression getMethodSelect() { return meth; }
1807         @DefinedBy(Api.COMPILER_TREE)
1808         public List<JCExpression> getArguments() {
1809             return args;
1810         }
1811         @Override @DefinedBy(Api.COMPILER_TREE)
1812         public <R,D> R accept(TreeVisitor<R,D> v, D d) {
1813             return v.visitMethodInvocation(this, d);
1814         }
1815         @Override
1816         public JCMethodInvocation setType(Type type) {
1817             super.setType(type);
1818             return this;
1819         }
1820         @Override
1821         public Tag getTag() {
1822             return(APPLY);
1823         }
1824     }
1825 
1826     /**
1827      * A new(...) operation.
1828      */
1829     public static class JCNewClass extends JCPolyExpression implements NewClassTree {
1830         public JCExpression encl;
1831         public List<JCExpression> typeargs;
1832         public JCExpression clazz;
1833         public List<JCExpression> args;
1834         public JCClassDecl def;
1835         public Symbol constructor;
1836         public Type varargsElement;
1837         public Type constructorType;
1838         protected JCNewClass(JCExpression encl,
1839                            List<JCExpression> typeargs,
1840                            JCExpression clazz,
1841                            List<JCExpression> args,
1842                            JCClassDecl def)
1843         {
1844             this.encl = encl;
1845             this.typeargs = (typeargs == null) ? List.nil()
1846                                                : typeargs;
1847             this.clazz = clazz;
1848             this.args = args;
1849             this.def = def;
1850         }
1851         @Override
1852         public void accept(Visitor v) { v.visitNewClass(this); }
1853 
1854         @DefinedBy(Api.COMPILER_TREE)
1855         public Kind getKind() { return Kind.NEW_CLASS; }
1856         @DefinedBy(Api.COMPILER_TREE)
1857         public JCExpression getEnclosingExpression() { // expr.new C< ... > ( ... )
1858             return encl;
1859         }
1860         @DefinedBy(Api.COMPILER_TREE)
1861         public List<JCExpression> getTypeArguments() {
1862             return typeargs;
1863         }
1864         @DefinedBy(Api.COMPILER_TREE)
1865         public JCExpression getIdentifier() { return clazz; }
1866         @DefinedBy(Api.COMPILER_TREE)
1867         public List<JCExpression> getArguments() {
1868             return args;
1869         }
1870         @DefinedBy(Api.COMPILER_TREE)
1871         public JCClassDecl getClassBody() { return def; }
1872         @Override @DefinedBy(Api.COMPILER_TREE)
1873         public <R,D> R accept(TreeVisitor<R,D> v, D d) {
1874             return v.visitNewClass(this, d);
1875         }
1876         @Override
1877         public Tag getTag() {
1878             return NEWCLASS;
1879         }
1880 
1881         public boolean classDeclRemoved() {
1882             return false;
1883         }
1884     }
1885 
1886     /**
1887      * A new[...] operation.
1888      */
1889     public static class JCNewArray extends JCExpression implements NewArrayTree {
1890         public JCExpression elemtype;
1891         public List<JCExpression> dims;
1892         // type annotations on inner-most component
1893         public List<JCAnnotation> annotations;
1894         // type annotations on dimensions
1895         public List<List<JCAnnotation>> dimAnnotations;
1896         public List<JCExpression> elems;
1897         protected JCNewArray(JCExpression elemtype,
1898                            List<JCExpression> dims,
1899                            List<JCExpression> elems)
1900         {
1901             this.elemtype = elemtype;
1902             this.dims = dims;
1903             this.annotations = List.nil();
1904             this.dimAnnotations = List.nil();
1905             this.elems = elems;
1906         }
1907         @Override
1908         public void accept(Visitor v) { v.visitNewArray(this); }
1909 
1910         @DefinedBy(Api.COMPILER_TREE)
1911         public Kind getKind() { return Kind.NEW_ARRAY; }
1912         @DefinedBy(Api.COMPILER_TREE)
1913         public JCExpression getType() { return elemtype; }
1914         @DefinedBy(Api.COMPILER_TREE)
1915         public List<JCExpression> getDimensions() {
1916             return dims;
1917         }
1918         @DefinedBy(Api.COMPILER_TREE)
1919         public List<JCExpression> getInitializers() {
1920             return elems;
1921         }
1922         @Override @DefinedBy(Api.COMPILER_TREE)
1923         public <R,D> R accept(TreeVisitor<R,D> v, D d) {
1924             return v.visitNewArray(this, d);
1925         }
1926         @Override
1927         public Tag getTag() {
1928             return NEWARRAY;
1929         }
1930 
1931         @Override @DefinedBy(Api.COMPILER_TREE)
1932         public List<JCAnnotation> getAnnotations() {
1933             return annotations;
1934         }
1935 
1936         @Override @DefinedBy(Api.COMPILER_TREE)
1937         public List<List<JCAnnotation>> getDimAnnotations() {
1938             return dimAnnotations;
1939         }
1940     }
1941 
1942     /**
1943      * A lambda expression.
1944      */
1945     public static class JCLambda extends JCFunctionalExpression implements LambdaExpressionTree {
1946 
1947         public enum ParameterKind {
1948             IMPLICIT,
1949             EXPLICIT
1950         }
1951 
1952         public List<JCVariableDecl> params;
1953         public JCTree body;
1954         public boolean canCompleteNormally = true;
1955         public ParameterKind paramKind;
1956 
1957         public JCLambda(List<JCVariableDecl> params,
1958                         JCTree body) {
1959             this.params = params;
1960             this.body = body;
1961             if (params.isEmpty() ||
1962                 params.head.vartype != null) {
1963                 paramKind = ParameterKind.EXPLICIT;
1964             } else {
1965                 paramKind = ParameterKind.IMPLICIT;
1966             }
1967         }
1968         @Override
1969         public Tag getTag() {
1970             return LAMBDA;
1971         }
1972         @Override
1973         public void accept(Visitor v) {
1974             v.visitLambda(this);
1975         }
1976         @Override @DefinedBy(Api.COMPILER_TREE)
1977         public <R, D> R accept(TreeVisitor<R, D> v, D d) {
1978             return v.visitLambdaExpression(this, d);
1979         }
1980         @DefinedBy(Api.COMPILER_TREE)
1981         public Kind getKind() {
1982             return Kind.LAMBDA_EXPRESSION;
1983         }
1984         @DefinedBy(Api.COMPILER_TREE)
1985         public JCTree getBody() {
1986             return body;
1987         }
1988         @DefinedBy(Api.COMPILER_TREE)
1989         public java.util.List<? extends VariableTree> getParameters() {
1990             return params;
1991         }
1992         @Override
1993         public JCLambda setType(Type type) {
1994             super.setType(type);
1995             return this;
1996         }
1997         @Override @DefinedBy(Api.COMPILER_TREE)
1998         public BodyKind getBodyKind() {
1999             return body.hasTag(BLOCK) ?
2000                     BodyKind.STATEMENT :
2001                     BodyKind.EXPRESSION;
2002         }
2003     }
2004 
2005     /**
2006      * A parenthesized subexpression ( ... )
2007      */
2008     public static class JCParens extends JCExpression implements ParenthesizedTree {
2009         public JCExpression expr;
2010         protected JCParens(JCExpression expr) {
2011             this.expr = expr;
2012         }
2013         @Override
2014         public void accept(Visitor v) { v.visitParens(this); }
2015 
2016         @DefinedBy(Api.COMPILER_TREE)
2017         public Kind getKind() { return Kind.PARENTHESIZED; }
2018         @DefinedBy(Api.COMPILER_TREE)
2019         public JCExpression getExpression() { return expr; }
2020         @Override @DefinedBy(Api.COMPILER_TREE)
2021         public <R,D> R accept(TreeVisitor<R,D> v, D d) {
2022             return v.visitParenthesized(this, d);
2023         }
2024         @Override
2025         public Tag getTag() {
2026             return PARENS;
2027         }
2028     }
2029 
2030     /**
2031      * A assignment with "=".
2032      */
2033     public static class JCAssign extends JCExpression implements AssignmentTree {
2034         public JCExpression lhs;
2035         public JCExpression rhs;
2036         protected JCAssign(JCExpression lhs, JCExpression rhs) {
2037             this.lhs = lhs;
2038             this.rhs = rhs;
2039         }
2040         @Override
2041         public void accept(Visitor v) { v.visitAssign(this); }
2042 
2043         @DefinedBy(Api.COMPILER_TREE)
2044         public Kind getKind() { return Kind.ASSIGNMENT; }
2045         @DefinedBy(Api.COMPILER_TREE)
2046         public JCExpression getVariable() { return lhs; }
2047         @DefinedBy(Api.COMPILER_TREE)
2048         public JCExpression getExpression() { return rhs; }
2049         @Override @DefinedBy(Api.COMPILER_TREE)
2050         public <R,D> R accept(TreeVisitor<R,D> v, D d) {
2051             return v.visitAssignment(this, d);
2052         }
2053         @Override
2054         public Tag getTag() {
2055             return ASSIGN;
2056         }
2057     }
2058 
2059     public static abstract class JCOperatorExpression extends JCExpression {
2060         public enum OperandPos {
2061             LEFT,
2062             RIGHT
2063         }
2064 
2065         protected Tag opcode;
2066         public OperatorSymbol operator;
2067 
2068         public OperatorSymbol getOperator() {
2069             return operator;
2070         }
2071 
2072         @Override
2073         public Tag getTag() {
2074             return opcode;
2075         }
2076 
2077         public abstract JCExpression getOperand(OperandPos pos);
2078     }
2079 
2080     /**
2081      * An assignment with "+=", "|=" ...
2082      */
2083     public static class JCAssignOp extends JCOperatorExpression implements CompoundAssignmentTree {
2084         public JCExpression lhs;
2085         public JCExpression rhs;
2086         protected JCAssignOp(Tag opcode, JCTree lhs, JCTree rhs, OperatorSymbol operator) {
2087             this.opcode = opcode;
2088             this.lhs = (JCExpression)lhs;
2089             this.rhs = (JCExpression)rhs;
2090             this.operator = operator;
2091         }
2092         @Override
2093         public void accept(Visitor v) { v.visitAssignop(this); }
2094 
2095         @DefinedBy(Api.COMPILER_TREE)
2096         public Kind getKind() { return TreeInfo.tagToKind(getTag()); }
2097         @DefinedBy(Api.COMPILER_TREE)
2098         public JCExpression getVariable() { return lhs; }
2099         @DefinedBy(Api.COMPILER_TREE)
2100         public JCExpression getExpression() { return rhs; }
2101         @Override @DefinedBy(Api.COMPILER_TREE)
2102         public <R,D> R accept(TreeVisitor<R,D> v, D d) {
2103             return v.visitCompoundAssignment(this, d);
2104         }
2105         @Override
2106         public JCExpression getOperand(OperandPos pos) {
2107             return pos == OperandPos.LEFT ? lhs : rhs;
2108         }
2109     }
2110 
2111     /**
2112      * A unary operation.
2113      */
2114     public static class JCUnary extends JCOperatorExpression implements UnaryTree {
2115         public JCExpression arg;
2116         protected JCUnary(Tag opcode, JCExpression arg) {
2117             this.opcode = opcode;
2118             this.arg = arg;
2119         }
2120         @Override
2121         public void accept(Visitor v) { v.visitUnary(this); }
2122 
2123         @DefinedBy(Api.COMPILER_TREE)
2124         public Kind getKind() { return TreeInfo.tagToKind(getTag()); }
2125         @DefinedBy(Api.COMPILER_TREE)
2126         public JCExpression getExpression() { return arg; }
2127         @Override @DefinedBy(Api.COMPILER_TREE)
2128         public <R,D> R accept(TreeVisitor<R,D> v, D d) {
2129             return v.visitUnary(this, d);
2130         }
2131         public void setTag(Tag tag) {
2132             opcode = tag;
2133         }
2134         @Override
2135         public JCExpression getOperand(OperandPos pos) {
2136             return arg;
2137         }
2138     }
2139 
2140     /**
2141      * A binary operation.
2142      */
2143     public static class JCBinary extends JCOperatorExpression implements BinaryTree {
2144         public JCExpression lhs;
2145         public JCExpression rhs;
2146         protected JCBinary(Tag opcode,
2147                          JCExpression lhs,
2148                          JCExpression rhs,
2149                          OperatorSymbol operator) {
2150             this.opcode = opcode;
2151             this.lhs = lhs;
2152             this.rhs = rhs;
2153             this.operator = operator;
2154         }
2155         @Override
2156         public void accept(Visitor v) { v.visitBinary(this); }
2157 
2158         @DefinedBy(Api.COMPILER_TREE)
2159         public Kind getKind() { return TreeInfo.tagToKind(getTag()); }
2160         @DefinedBy(Api.COMPILER_TREE)
2161         public JCExpression getLeftOperand() { return lhs; }
2162         @DefinedBy(Api.COMPILER_TREE)
2163         public JCExpression getRightOperand() { return rhs; }
2164         @Override @DefinedBy(Api.COMPILER_TREE)
2165         public <R,D> R accept(TreeVisitor<R,D> v, D d) {
2166             return v.visitBinary(this, d);
2167         }
2168         @Override
2169         public JCExpression getOperand(OperandPos pos) {
2170             return pos == OperandPos.LEFT ? lhs : rhs;
2171         }
2172     }
2173 
2174     /**
2175      * A type cast.
2176      */
2177     public static class JCTypeCast extends JCExpression implements TypeCastTree {
2178         public JCTree clazz;
2179         public JCExpression expr;
2180         protected JCTypeCast(JCTree clazz, JCExpression expr) {
2181             this.clazz = clazz;
2182             this.expr = expr;
2183         }
2184         @Override
2185         public void accept(Visitor v) { v.visitTypeCast(this); }
2186 
2187         @DefinedBy(Api.COMPILER_TREE)
2188         public Kind getKind() { return Kind.TYPE_CAST; }
2189         @DefinedBy(Api.COMPILER_TREE)
2190         public JCTree getType() { return clazz; }
2191         @DefinedBy(Api.COMPILER_TREE)
2192         public JCExpression getExpression() { return expr; }
2193         @Override @DefinedBy(Api.COMPILER_TREE)
2194         public <R,D> R accept(TreeVisitor<R,D> v, D d) {
2195             return v.visitTypeCast(this, d);
2196         }
2197         @Override
2198         public Tag getTag() {
2199             return TYPECAST;
2200         }
2201     }
2202 
2203     /**
2204      * A type test.
2205      */
2206     public static class JCInstanceOf extends JCExpression implements InstanceOfTree {
2207         public JCExpression expr;
2208         public JCTree pattern;
2209         protected JCInstanceOf(JCExpression expr, JCTree pattern) {
2210             this.expr = expr;
2211             this.pattern = pattern;
2212         }
2213         @Override
2214         public void accept(Visitor v) { v.visitTypeTest(this); }
2215 
2216         @DefinedBy(Api.COMPILER_TREE)
2217         public Kind getKind() { return Kind.INSTANCE_OF; }
2218         @DefinedBy(Api.COMPILER_TREE)
2219         public JCTree getType() { return pattern instanceof JCPattern ? pattern.hasTag(BINDINGPATTERN) ? ((JCBindingPattern) pattern).var.vartype : null : pattern; }
2220 
2221         @Override @DefinedBy(Api.COMPILER_TREE)
2222         public JCPattern getPattern() {
2223             return pattern instanceof JCPattern jcPattern ? jcPattern : null;
2224         }
2225 
2226         @DefinedBy(Api.COMPILER_TREE)
2227         public JCExpression getExpression() { return expr; }
2228         @Override @DefinedBy(Api.COMPILER_TREE)
2229         public <R,D> R accept(TreeVisitor<R,D> v, D d) {
2230             return v.visitInstanceOf(this, d);
2231         }
2232         @Override
2233         public Tag getTag() {
2234             return TYPETEST;
2235         }
2236     }
2237 
2238     /**
2239      * Pattern matching forms.
2240      */
2241     public static abstract class JCPattern extends JCCaseLabel
2242             implements PatternTree {
2243 
2244         @Override
2245         public boolean isExpression() {
2246             return false;
2247         }
2248 
2249         @Override
2250         public boolean isPattern() {
2251             return true;
2252         }
2253     }
2254 
2255     public static class JCBindingPattern extends JCPattern
2256             implements BindingPatternTree {
2257         public JCVariableDecl var;
2258 
2259         protected JCBindingPattern(JCVariableDecl var) {
2260             this.var = var;
2261         }
2262 
2263         @Override @DefinedBy(Api.COMPILER_TREE)
2264         public VariableTree getVariable() {
2265             return var;
2266         }
2267 
2268         @Override
2269         public void accept(Visitor v) {
2270             v.visitBindingPattern(this);
2271         }
2272 
2273         @DefinedBy(Api.COMPILER_TREE)
2274         public Kind getKind() {
2275             return Kind.BINDING_PATTERN;
2276         }
2277 
2278         @Override
2279         @DefinedBy(Api.COMPILER_TREE)
2280         public <R, D> R accept(TreeVisitor<R, D> v, D d) {
2281             return v.visitBindingPattern(this, d);
2282         }
2283 
2284         @Override
2285         public Tag getTag() {
2286             return BINDINGPATTERN;
2287         }
2288     }
2289 
2290     public static class JCDefaultCaseLabel extends JCCaseLabel
2291             implements DefaultCaseLabelTree {
2292 
2293         protected JCDefaultCaseLabel() {
2294         }
2295 
2296         @Override
2297         public void accept(Visitor v) {
2298             v.visitDefaultCaseLabel(this);
2299         }
2300 
2301         @DefinedBy(Api.COMPILER_TREE)
2302         public Kind getKind() {
2303             return Kind.DEFAULT_CASE_LABEL;
2304         }
2305 
2306         @Override
2307         @DefinedBy(Api.COMPILER_TREE)
2308         public <R, D> R accept(TreeVisitor<R, D> v, D d) {
2309             return v.visitDefaultCaseLabel(this, d);
2310         }
2311 
2312         @Override
2313         public Tag getTag() {
2314             return DEFAULTCASELABEL;
2315         }
2316 
2317         @Override
2318         public boolean isExpression() {
2319             return false;
2320         }
2321 
2322         @Override
2323         public boolean isPattern() {
2324             return false;
2325         }
2326     }
2327 
2328     public static class JCParenthesizedPattern extends JCPattern
2329             implements ParenthesizedPatternTree {
2330         public JCPattern pattern;
2331 
2332         public JCParenthesizedPattern(JCPattern pattern) {
2333             this.pattern = pattern;
2334         }
2335 
2336         @Override @DefinedBy(Api.COMPILER_TREE)
2337         public PatternTree getPattern() {
2338             return pattern;
2339         }
2340 
2341         @Override
2342         public void accept(Visitor v) {
2343             v.visitParenthesizedPattern(this);
2344         }
2345 
2346         @DefinedBy(Api.COMPILER_TREE)
2347         public Kind getKind() {
2348             return Kind.PARENTHESIZED_PATTERN;
2349         }
2350 
2351         @Override
2352         @DefinedBy(Api.COMPILER_TREE)
2353         public <R, D> R accept(TreeVisitor<R, D> v, D d) {
2354             return v.visitParenthesizedPattern(this, d);
2355         }
2356 
2357         @Override
2358         public Tag getTag() {
2359             return PARENTHESIZEDPATTERN;
2360         }
2361     }
2362 
2363     public static class JCGuardPattern extends JCPattern
2364             implements GuardedPatternTree {
2365         public JCPattern patt;
2366         public JCExpression expr;
2367 
2368         public JCGuardPattern(JCPattern patt, JCExpression expr) {
2369             this.patt = patt;
2370             this.expr = expr;
2371         }
2372 
2373         @Override @DefinedBy(Api.COMPILER_TREE)
2374         public PatternTree getPattern() {
2375             return patt;
2376         }
2377 
2378         @Override @DefinedBy(Api.COMPILER_TREE)
2379         public ExpressionTree getExpression() {
2380             return expr;
2381         }
2382 
2383         @Override
2384         public void accept(Visitor v) {
2385             v.visitGuardPattern(this);
2386         }
2387 
2388         @DefinedBy(Api.COMPILER_TREE)
2389         public Kind getKind() {
2390             return Kind.GUARDED_PATTERN;
2391         }
2392 
2393         @Override
2394         @DefinedBy(Api.COMPILER_TREE)
2395         public <R, D> R accept(TreeVisitor<R, D> v, D d) {
2396             return v.visitGuardedPattern(this, d);
2397         }
2398 
2399         @Override
2400         public Tag getTag() {
2401             return Tag.GUARDPATTERN;
2402         }
2403     }
2404 
2405     /**
2406      * An array selection
2407      */
2408     public static class JCArrayAccess extends JCExpression implements ArrayAccessTree {
2409         public JCExpression indexed;
2410         public JCExpression index;
2411         protected JCArrayAccess(JCExpression indexed, JCExpression index) {
2412             this.indexed = indexed;
2413             this.index = index;
2414         }
2415         @Override
2416         public void accept(Visitor v) { v.visitIndexed(this); }
2417 
2418         @DefinedBy(Api.COMPILER_TREE)
2419         public Kind getKind() { return Kind.ARRAY_ACCESS; }
2420         @DefinedBy(Api.COMPILER_TREE)
2421         public JCExpression getExpression() { return indexed; }
2422         @DefinedBy(Api.COMPILER_TREE)
2423         public JCExpression getIndex() { return index; }
2424         @Override @DefinedBy(Api.COMPILER_TREE)
2425         public <R,D> R accept(TreeVisitor<R,D> v, D d) {
2426             return v.visitArrayAccess(this, d);
2427         }
2428         @Override
2429         public Tag getTag() {
2430             return INDEXED;
2431         }
2432     }
2433 
2434     /**
2435      * Selects through packages and classes
2436      */
2437     public static class JCFieldAccess extends JCExpression implements MemberSelectTree {
2438         /** selected Tree hierarchy */
2439         public JCExpression selected;
2440         /** name of field to select thru */
2441         public Name name;
2442         /** symbol of the selected class */
2443         public Symbol sym;
2444         protected JCFieldAccess(JCExpression selected, Name name, Symbol sym) {
2445             this.selected = selected;
2446             this.name = name;
2447             this.sym = sym;
2448         }
2449         @Override
2450         public void accept(Visitor v) { v.visitSelect(this); }
2451 
2452         @DefinedBy(Api.COMPILER_TREE)
2453         public Kind getKind() { return Kind.MEMBER_SELECT; }
2454         @DefinedBy(Api.COMPILER_TREE)
2455         public JCExpression getExpression() { return selected; }
2456         @Override @DefinedBy(Api.COMPILER_TREE)
2457         public <R,D> R accept(TreeVisitor<R,D> v, D d) {
2458             return v.visitMemberSelect(this, d);
2459         }
2460         @DefinedBy(Api.COMPILER_TREE)
2461         public Name getIdentifier() { return name; }
2462         @Override
2463         public Tag getTag() {
2464             return SELECT;
2465         }
2466     }
2467 
2468     /**
2469      * Selects a member expression.
2470      */
2471     public static class JCMemberReference extends JCFunctionalExpression implements MemberReferenceTree {
2472 
2473         public ReferenceMode mode;
2474         public ReferenceKind kind;
2475         public Name name;
2476         public JCExpression expr;
2477         public List<JCExpression> typeargs;
2478         public Symbol sym;
2479         public Type varargsElement;
2480         public PolyKind refPolyKind;
2481         public boolean ownerAccessible;
2482         private OverloadKind overloadKind;
2483         public Type referentType;
2484 
2485         public enum OverloadKind {
2486             OVERLOADED,
2487             UNOVERLOADED,
2488             ERROR
2489         }
2490 
2491         /**
2492          * Javac-dependent classification for member references, based
2493          * on relevant properties w.r.t. code-generation
2494          */
2495         public enum ReferenceKind {
2496             /** super # instMethod */
2497             SUPER(ReferenceMode.INVOKE, false),
2498             /** Type # instMethod */
2499             UNBOUND(ReferenceMode.INVOKE, true),
2500             /** Type # staticMethod */
2501             STATIC(ReferenceMode.INVOKE, false),
2502             /** Expr # instMethod */
2503             BOUND(ReferenceMode.INVOKE, false),
2504             /** Inner # new */
2505             IMPLICIT_INNER(ReferenceMode.NEW, false),
2506             /** Toplevel # new */
2507             TOPLEVEL(ReferenceMode.NEW, false),
2508             /** ArrayType # new */
2509             ARRAY_CTOR(ReferenceMode.NEW, false);
2510 
2511             final ReferenceMode mode;
2512             final boolean unbound;
2513 
2514             private ReferenceKind(ReferenceMode mode, boolean unbound) {
2515                 this.mode = mode;
2516                 this.unbound = unbound;
2517             }
2518 
2519             public boolean isUnbound() {
2520                 return unbound;
2521             }
2522         }
2523 
2524         public JCMemberReference(ReferenceMode mode, Name name, JCExpression expr, List<JCExpression> typeargs) {
2525             this.mode = mode;
2526             this.name = name;
2527             this.expr = expr;
2528             this.typeargs = typeargs;
2529         }
2530         @Override
2531         public void accept(Visitor v) { v.visitReference(this); }
2532 
2533         @DefinedBy(Api.COMPILER_TREE)
2534         public Kind getKind() { return Kind.MEMBER_REFERENCE; }
2535         @Override @DefinedBy(Api.COMPILER_TREE)
2536         public ReferenceMode getMode() { return mode; }
2537         @Override @DefinedBy(Api.COMPILER_TREE)
2538         public JCExpression getQualifierExpression() { return expr; }
2539         @Override @DefinedBy(Api.COMPILER_TREE)
2540         public Name getName() { return name; }
2541         @Override @DefinedBy(Api.COMPILER_TREE)
2542         public List<JCExpression> getTypeArguments() { return typeargs; }
2543 
2544         @Override @DefinedBy(Api.COMPILER_TREE)
2545         public <R,D> R accept(TreeVisitor<R,D> v, D d) {
2546             return v.visitMemberReference(this, d);
2547         }
2548         @Override
2549         public Tag getTag() {
2550             return REFERENCE;
2551         }
2552         public boolean hasKind(ReferenceKind kind) {
2553             return this.kind == kind;
2554         }
2555 
2556         /**
2557          * @return the overloadKind
2558          */
2559         public OverloadKind getOverloadKind() {
2560             return overloadKind;
2561         }
2562 
2563         /**
2564          * @param overloadKind the overloadKind to set
2565          */
2566         public void setOverloadKind(OverloadKind overloadKind) {
2567             this.overloadKind = overloadKind;
2568         }
2569     }
2570 
2571     /**
2572      * An identifier
2573      */
2574     public static class JCIdent extends JCExpression implements IdentifierTree {
2575         /** the name */
2576         public Name name;
2577         /** the symbol */
2578         public Symbol sym;
2579         protected JCIdent(Name name, Symbol sym) {
2580             this.name = name;
2581             this.sym = sym;
2582         }
2583         @Override
2584         public void accept(Visitor v) { v.visitIdent(this); }
2585 
2586         @DefinedBy(Api.COMPILER_TREE)
2587         public Kind getKind() { return Kind.IDENTIFIER; }
2588         @DefinedBy(Api.COMPILER_TREE)
2589         public Name getName() { return name; }
2590         @Override @DefinedBy(Api.COMPILER_TREE)
2591         public <R,D> R accept(TreeVisitor<R,D> v, D d) {
2592             return v.visitIdentifier(this, d);
2593         }
2594         @Override
2595         public Tag getTag() {
2596             return IDENT;
2597         }
2598     }
2599 
2600     /**
2601      * A constant value given literally.
2602      */
2603     public static class JCLiteral extends JCExpression implements LiteralTree {
2604         public TypeTag typetag;
2605         /** value representation */
2606         public Object value;
2607         protected JCLiteral(TypeTag typetag, Object value) {
2608             this.typetag = typetag;
2609             this.value = value;
2610         }
2611         @Override
2612         public void accept(Visitor v) { v.visitLiteral(this); }
2613 
2614         @DefinedBy(Api.COMPILER_TREE)
2615         public Kind getKind() {
2616             return typetag.getKindLiteral();
2617         }
2618 
2619         @DefinedBy(Api.COMPILER_TREE)
2620         public Object getValue() {
2621             switch (typetag) {
2622                 case BOOLEAN:
2623                     int bi = (Integer) value;
2624                     return (bi != 0);
2625                 case CHAR:
2626                     int ci = (Integer) value;
2627                     char c = (char) ci;
2628                     if (c != ci)
2629                         throw new AssertionError("bad value for char literal");
2630                     return c;
2631                 default:
2632                     return value;
2633             }
2634         }
2635         @Override @DefinedBy(Api.COMPILER_TREE)
2636         public <R,D> R accept(TreeVisitor<R,D> v, D d) {
2637             return v.visitLiteral(this, d);
2638         }
2639         @Override
2640         public JCLiteral setType(Type type) {
2641             super.setType(type);
2642             return this;
2643         }
2644         @Override
2645         public Tag getTag() {
2646             return LITERAL;
2647         }
2648     }
2649 
2650     /**
2651      * Identifies a basic type.
2652      * @see TypeTag
2653      */
2654     public static class JCPrimitiveTypeTree extends JCExpression implements PrimitiveTypeTree {
2655         /** the basic type id */
2656         public TypeTag typetag;
2657         protected JCPrimitiveTypeTree(TypeTag typetag) {
2658             this.typetag = typetag;
2659         }
2660         @Override
2661         public void accept(Visitor v) { v.visitTypeIdent(this); }
2662 
2663         @DefinedBy(Api.COMPILER_TREE)
2664         public Kind getKind() { return Kind.PRIMITIVE_TYPE; }
2665         @DefinedBy(Api.COMPILER_TREE)
2666         public TypeKind getPrimitiveTypeKind() {
2667             return typetag.getPrimitiveTypeKind();
2668         }
2669 
2670         @Override @DefinedBy(Api.COMPILER_TREE)
2671         public <R,D> R accept(TreeVisitor<R,D> v, D d) {
2672             return v.visitPrimitiveType(this, d);
2673         }
2674         @Override
2675         public Tag getTag() {
2676             return TYPEIDENT;
2677         }
2678     }
2679 
2680     /**
2681      * An array type, A[]
2682      */
2683     public static class JCArrayTypeTree extends JCExpression implements ArrayTypeTree {
2684         public JCExpression elemtype;
2685         protected JCArrayTypeTree(JCExpression elemtype) {
2686             this.elemtype = elemtype;
2687         }
2688         @Override
2689         public void accept(Visitor v) { v.visitTypeArray(this); }
2690 
2691         @DefinedBy(Api.COMPILER_TREE)
2692         public Kind getKind() { return Kind.ARRAY_TYPE; }
2693         @DefinedBy(Api.COMPILER_TREE)
2694         public JCTree getType() { return elemtype; }
2695         @Override @DefinedBy(Api.COMPILER_TREE)
2696         public <R,D> R accept(TreeVisitor<R,D> v, D d) {
2697             return v.visitArrayType(this, d);
2698         }
2699         @Override
2700         public Tag getTag() {
2701             return TYPEARRAY;
2702         }
2703     }
2704 
2705     /**
2706      * A parameterized type, {@literal T<...>}
2707      */
2708     public static class JCTypeApply extends JCExpression implements ParameterizedTypeTree {
2709         public JCExpression clazz;
2710         public List<JCExpression> arguments;
2711         protected JCTypeApply(JCExpression clazz, List<JCExpression> arguments) {
2712             this.clazz = clazz;
2713             this.arguments = arguments;
2714         }
2715         @Override
2716         public void accept(Visitor v) { v.visitTypeApply(this); }
2717 
2718         @DefinedBy(Api.COMPILER_TREE)
2719         public Kind getKind() { return Kind.PARAMETERIZED_TYPE; }
2720         @DefinedBy(Api.COMPILER_TREE)
2721         public JCTree getType() { return clazz; }
2722         @DefinedBy(Api.COMPILER_TREE)
2723         public List<JCExpression> getTypeArguments() {
2724             return arguments;
2725         }
2726         @Override @DefinedBy(Api.COMPILER_TREE)
2727         public <R,D> R accept(TreeVisitor<R,D> v, D d) {
2728             return v.visitParameterizedType(this, d);
2729         }
2730         @Override
2731         public Tag getTag() {
2732             return TYPEAPPLY;
2733         }
2734     }
2735 
2736     /**
2737      * A union type, T1 | T2 | ... Tn (used in multicatch statements)
2738      */
2739     public static class JCTypeUnion extends JCExpression implements UnionTypeTree {
2740 
2741         public List<JCExpression> alternatives;
2742 
2743         protected JCTypeUnion(List<JCExpression> components) {
2744             this.alternatives = components;
2745         }
2746         @Override
2747         public void accept(Visitor v) { v.visitTypeUnion(this); }
2748 
2749         @DefinedBy(Api.COMPILER_TREE)
2750         public Kind getKind() { return Kind.UNION_TYPE; }
2751 
2752         @DefinedBy(Api.COMPILER_TREE)
2753         public List<JCExpression> getTypeAlternatives() {
2754             return alternatives;
2755         }
2756         @Override @DefinedBy(Api.COMPILER_TREE)
2757         public <R,D> R accept(TreeVisitor<R,D> v, D d) {
2758             return v.visitUnionType(this, d);
2759         }
2760         @Override
2761         public Tag getTag() {
2762             return TYPEUNION;
2763         }
2764     }
2765 
2766     /**
2767      * An intersection type, {@code T1 & T2 & ... Tn} (used in cast expressions)
2768      */
2769     public static class JCTypeIntersection extends JCExpression implements IntersectionTypeTree {
2770 
2771         public List<JCExpression> bounds;
2772 
2773         protected JCTypeIntersection(List<JCExpression> bounds) {
2774             this.bounds = bounds;
2775         }
2776         @Override
2777         public void accept(Visitor v) { v.visitTypeIntersection(this); }
2778 
2779         @DefinedBy(Api.COMPILER_TREE)
2780         public Kind getKind() { return Kind.INTERSECTION_TYPE; }
2781 
2782         @DefinedBy(Api.COMPILER_TREE)
2783         public List<JCExpression> getBounds() {
2784             return bounds;
2785         }
2786         @Override @DefinedBy(Api.COMPILER_TREE)
2787         public <R,D> R accept(TreeVisitor<R,D> v, D d) {
2788             return v.visitIntersectionType(this, d);
2789         }
2790         @Override
2791         public Tag getTag() {
2792             return TYPEINTERSECTION;
2793         }
2794     }
2795 
2796     /**
2797      * A formal class parameter.
2798      */
2799     public static class JCTypeParameter extends JCTree implements TypeParameterTree {
2800         /** name */
2801         public Name name;
2802         /** bounds */
2803         public List<JCExpression> bounds;
2804         /** type annotations on type parameter */
2805         public List<JCAnnotation> annotations;
2806         protected JCTypeParameter(Name name, List<JCExpression> bounds, List<JCAnnotation> annotations) {
2807             this.name = name;
2808             this.bounds = bounds;
2809             this.annotations = annotations;
2810         }
2811         @Override
2812         public void accept(Visitor v) { v.visitTypeParameter(this); }
2813 
2814         @DefinedBy(Api.COMPILER_TREE)
2815         public Kind getKind() { return Kind.TYPE_PARAMETER; }
2816         @DefinedBy(Api.COMPILER_TREE)
2817         public Name getName() { return name; }
2818         @DefinedBy(Api.COMPILER_TREE)
2819         public List<JCExpression> getBounds() {
2820             return bounds;
2821         }
2822         @DefinedBy(Api.COMPILER_TREE)
2823         public List<JCAnnotation> getAnnotations() {
2824             return annotations;
2825         }
2826         @Override @DefinedBy(Api.COMPILER_TREE)
2827         public <R,D> R accept(TreeVisitor<R,D> v, D d) {
2828             return v.visitTypeParameter(this, d);
2829         }
2830         @Override
2831         public Tag getTag() {
2832             return TYPEPARAMETER;
2833         }
2834     }
2835 
2836     public static class JCWildcard extends JCExpression implements WildcardTree {
2837         public TypeBoundKind kind;
2838         public JCTree inner;
2839         protected JCWildcard(TypeBoundKind kind, JCTree inner) {
2840             this.kind = Assert.checkNonNull(kind);
2841             this.inner = inner;
2842         }
2843         @Override
2844         public void accept(Visitor v) { v.visitWildcard(this); }
2845 
2846         @DefinedBy(Api.COMPILER_TREE)
2847         public Kind getKind() {
2848             switch (kind.kind) {
2849             case UNBOUND:
2850                 return Kind.UNBOUNDED_WILDCARD;
2851             case EXTENDS:
2852                 return Kind.EXTENDS_WILDCARD;
2853             case SUPER:
2854                 return Kind.SUPER_WILDCARD;
2855             default:
2856                 throw new AssertionError("Unknown wildcard bound " + kind);
2857             }
2858         }
2859         @DefinedBy(Api.COMPILER_TREE)
2860         public JCTree getBound() { return inner; }
2861         @Override @DefinedBy(Api.COMPILER_TREE)
2862         public <R,D> R accept(TreeVisitor<R,D> v, D d) {
2863             return v.visitWildcard(this, d);
2864         }
2865         @Override
2866         public Tag getTag() {
2867             return Tag.WILDCARD;
2868         }
2869     }
2870 
2871     public static class TypeBoundKind extends JCTree {
2872         public BoundKind kind;
2873         protected TypeBoundKind(BoundKind kind) {
2874             this.kind = kind;
2875         }
2876         @Override
2877         public void accept(Visitor v) { v.visitTypeBoundKind(this); }
2878 
2879         @DefinedBy(Api.COMPILER_TREE)
2880         public Kind getKind() {
2881             throw new AssertionError("TypeBoundKind is not part of a public API");
2882         }
2883         @Override @DefinedBy(Api.COMPILER_TREE)
2884         public <R,D> R accept(TreeVisitor<R,D> v, D d) {
2885             throw new AssertionError("TypeBoundKind is not part of a public API");
2886         }
2887         @Override
2888         public Tag getTag() {
2889             return TYPEBOUNDKIND;
2890         }
2891     }
2892 
2893     public static class JCAnnotation extends JCExpression implements AnnotationTree {
2894         // Either Tag.ANNOTATION or Tag.TYPE_ANNOTATION
2895         private Tag tag;
2896 
2897         public JCTree annotationType;
2898         public List<JCExpression> args;
2899         public Attribute.Compound attribute;
2900 
2901         protected JCAnnotation(Tag tag, JCTree annotationType, List<JCExpression> args) {
2902             this.tag = tag;
2903             this.annotationType = annotationType;
2904             this.args = args;
2905         }
2906 
2907         @Override
2908         public void accept(Visitor v) { v.visitAnnotation(this); }
2909 
2910         @DefinedBy(Api.COMPILER_TREE)
2911         public Kind getKind() { return TreeInfo.tagToKind(getTag()); }
2912 
2913         @DefinedBy(Api.COMPILER_TREE)
2914         public JCTree getAnnotationType() { return annotationType; }
2915         @DefinedBy(Api.COMPILER_TREE)
2916         public List<JCExpression> getArguments() {
2917             return args;
2918         }
2919         @Override @DefinedBy(Api.COMPILER_TREE)
2920         public <R,D> R accept(TreeVisitor<R,D> v, D d) {
2921             return v.visitAnnotation(this, d);
2922         }
2923         @Override
2924         public Tag getTag() {
2925             return tag;
2926         }
2927     }
2928 
2929     public static class JCModifiers extends JCTree implements com.sun.source.tree.ModifiersTree {
2930         public long flags;
2931         public List<JCAnnotation> annotations;
2932         protected JCModifiers(long flags, List<JCAnnotation> annotations) {
2933             this.flags = flags;
2934             this.annotations = annotations;
2935         }
2936         @Override
2937         public void accept(Visitor v) { v.visitModifiers(this); }
2938 
2939         @DefinedBy(Api.COMPILER_TREE)
2940         public Kind getKind() { return Kind.MODIFIERS; }
2941         @DefinedBy(Api.COMPILER_TREE)
2942         public Set<Modifier> getFlags() {
2943             return Flags.asModifierSet(flags);
2944         }
2945         @DefinedBy(Api.COMPILER_TREE)
2946         public List<JCAnnotation> getAnnotations() {
2947             return annotations;
2948         }
2949         @Override @DefinedBy(Api.COMPILER_TREE)
2950         public <R,D> R accept(TreeVisitor<R,D> v, D d) {
2951             return v.visitModifiers(this, d);
2952         }
2953         @Override
2954         public Tag getTag() {
2955             return MODIFIERS;
2956         }
2957     }
2958 
2959     public static class JCAnnotatedType extends JCExpression implements com.sun.source.tree.AnnotatedTypeTree {
2960         // type annotations
2961         public List<JCAnnotation> annotations;
2962         public JCExpression underlyingType;
2963 
2964         protected JCAnnotatedType(List<JCAnnotation> annotations, JCExpression underlyingType) {
2965             Assert.check(annotations != null && annotations.nonEmpty());
2966             this.annotations = annotations;
2967             this.underlyingType = underlyingType;
2968         }
2969         @Override
2970         public void accept(Visitor v) { v.visitAnnotatedType(this); }
2971 
2972         @DefinedBy(Api.COMPILER_TREE)
2973         public Kind getKind() { return Kind.ANNOTATED_TYPE; }
2974         @DefinedBy(Api.COMPILER_TREE)
2975         public List<JCAnnotation> getAnnotations() {
2976             return annotations;
2977         }
2978         @DefinedBy(Api.COMPILER_TREE)
2979         public JCExpression getUnderlyingType() {
2980             return underlyingType;
2981         }
2982         @Override @DefinedBy(Api.COMPILER_TREE)
2983         public <R,D> R accept(TreeVisitor<R,D> v, D d) {
2984             return v.visitAnnotatedType(this, d);
2985         }
2986         @Override
2987         public Tag getTag() {
2988             return ANNOTATED_TYPE;
2989         }
2990     }
2991 
2992     public static abstract class JCDirective extends JCTree
2993         implements DirectiveTree {
2994     }
2995 
2996     public static class JCModuleDecl extends JCTree implements ModuleTree {
2997         public JCModifiers mods;
2998         public ModuleType type;
2999         private final ModuleKind kind;
3000         public JCExpression qualId;
3001         public List<JCDirective> directives;
3002         public ModuleSymbol sym;
3003 
3004         protected JCModuleDecl(JCModifiers mods, ModuleKind kind,
3005                 JCExpression qualId, List<JCDirective> directives) {
3006             this.mods = mods;
3007             this.kind = kind;
3008             this.qualId = qualId;
3009             this.directives = directives;
3010         }
3011 
3012         @Override
3013         public void accept(Visitor v) { v.visitModuleDef(this); }
3014 
3015         @Override @DefinedBy(Api.COMPILER_TREE)
3016         public Kind getKind() {
3017             return Kind.MODULE;
3018         }
3019 
3020         @Override @DefinedBy(Api.COMPILER_TREE)
3021         public List<? extends AnnotationTree> getAnnotations() {
3022             return mods.annotations;
3023         }
3024 
3025         @Override @DefinedBy(Api.COMPILER_TREE)
3026         public ModuleKind getModuleType() {
3027             return kind;
3028         }
3029 
3030         @Override @DefinedBy(Api.COMPILER_TREE)
3031         public JCExpression getName() {
3032             return qualId;
3033         }
3034 
3035         @Override @DefinedBy(Api.COMPILER_TREE)
3036         public List<JCDirective> getDirectives() {
3037             return directives;
3038         }
3039 
3040         @Override @DefinedBy(Api.COMPILER_TREE)
3041         public <R, D> R accept(TreeVisitor<R, D> v, D d) {
3042             return v.visitModule(this, d);
3043         }
3044 
3045         @Override
3046         public Tag getTag() {
3047             return MODULEDEF;
3048         }
3049     }
3050 
3051     public static class JCExports extends JCDirective
3052             implements ExportsTree {
3053         public JCExpression qualid;
3054         public List<JCExpression> moduleNames;
3055         public ExportsDirective directive;
3056 
3057         protected JCExports(JCExpression qualId, List<JCExpression> moduleNames) {
3058             this.qualid = qualId;
3059             this.moduleNames = moduleNames;
3060         }
3061 
3062         @Override
3063         public void accept(Visitor v) { v.visitExports(this); }
3064 
3065         @Override @DefinedBy(Api.COMPILER_TREE)
3066         public Kind getKind() {
3067             return Kind.EXPORTS;
3068         }
3069 
3070         @Override @DefinedBy(Api.COMPILER_TREE)
3071         public JCExpression getPackageName() {
3072             return qualid;
3073         }
3074 
3075         @Override @DefinedBy(Api.COMPILER_TREE)
3076         public List<JCExpression> getModuleNames() {
3077             return moduleNames;
3078         }
3079 
3080         @Override @DefinedBy(Api.COMPILER_TREE)
3081         public <R, D> R accept(TreeVisitor<R, D> v, D d) {
3082             return v.visitExports(this, d);
3083         }
3084 
3085         @Override
3086         public Tag getTag() {
3087             return Tag.EXPORTS;
3088         }
3089     }
3090 
3091     public static class JCOpens extends JCDirective
3092             implements OpensTree {
3093         public JCExpression qualid;
3094         public List<JCExpression> moduleNames;
3095         public OpensDirective directive;
3096 
3097         protected JCOpens(JCExpression qualId, List<JCExpression> moduleNames) {
3098             this.qualid = qualId;
3099             this.moduleNames = moduleNames;
3100         }
3101 
3102         @Override
3103         public void accept(Visitor v) { v.visitOpens(this); }
3104 
3105         @Override @DefinedBy(Api.COMPILER_TREE)
3106         public Kind getKind() {
3107             return Kind.OPENS;
3108         }
3109 
3110         @Override @DefinedBy(Api.COMPILER_TREE)
3111         public JCExpression getPackageName() {
3112             return qualid;
3113         }
3114 
3115         @Override @DefinedBy(Api.COMPILER_TREE)
3116         public List<JCExpression> getModuleNames() {
3117             return moduleNames;
3118         }
3119 
3120         @Override @DefinedBy(Api.COMPILER_TREE)
3121         public <R, D> R accept(TreeVisitor<R, D> v, D d) {
3122             return v.visitOpens(this, d);
3123         }
3124 
3125         @Override
3126         public Tag getTag() {
3127             return Tag.OPENS;
3128         }
3129     }
3130 
3131     public static class JCProvides extends JCDirective
3132             implements ProvidesTree {
3133         public JCExpression serviceName;
3134         public List<JCExpression> implNames;
3135 
3136         protected JCProvides(JCExpression serviceName, List<JCExpression> implNames) {
3137             this.serviceName = serviceName;
3138             this.implNames = implNames;
3139         }
3140 
3141         @Override
3142         public void accept(Visitor v) { v.visitProvides(this); }
3143 
3144         @Override @DefinedBy(Api.COMPILER_TREE)
3145         public Kind getKind() {
3146             return Kind.PROVIDES;
3147         }
3148 
3149         @Override @DefinedBy(Api.COMPILER_TREE)
3150         public <R, D> R accept(TreeVisitor<R, D> v, D d) {
3151             return v.visitProvides(this, d);
3152         }
3153 
3154         @Override @DefinedBy(Api.COMPILER_TREE)
3155         public JCExpression getServiceName() {
3156             return serviceName;
3157         }
3158 
3159         @Override @DefinedBy(Api.COMPILER_TREE)
3160         public List<JCExpression> getImplementationNames() {
3161             return implNames;
3162         }
3163 
3164         @Override
3165         public Tag getTag() {
3166             return PROVIDES;
3167         }
3168     }
3169 
3170     public static class JCRequires extends JCDirective
3171             implements RequiresTree {
3172         public boolean isTransitive;
3173         public boolean isStaticPhase;
3174         public JCExpression moduleName;
3175         public RequiresDirective directive;
3176 
3177         protected JCRequires(boolean isTransitive, boolean isStaticPhase, JCExpression moduleName) {
3178             this.isTransitive = isTransitive;
3179             this.isStaticPhase = isStaticPhase;
3180             this.moduleName = moduleName;
3181         }
3182 
3183         @Override
3184         public void accept(Visitor v) { v.visitRequires(this); }
3185 
3186         @Override @DefinedBy(Api.COMPILER_TREE)
3187         public Kind getKind() {
3188             return Kind.REQUIRES;
3189         }
3190 
3191         @Override @DefinedBy(Api.COMPILER_TREE)
3192         public <R, D> R accept(TreeVisitor<R, D> v, D d) {
3193             return v.visitRequires(this, d);
3194         }
3195 
3196         @Override @DefinedBy(Api.COMPILER_TREE)
3197         public boolean isTransitive() {
3198             return isTransitive;
3199         }
3200 
3201         @Override @DefinedBy(Api.COMPILER_TREE)
3202         public boolean isStatic() {
3203             return isStaticPhase;
3204         }
3205 
3206         @Override @DefinedBy(Api.COMPILER_TREE)
3207         public JCExpression getModuleName() {
3208             return moduleName;
3209         }
3210 
3211         @Override
3212         public Tag getTag() {
3213             return REQUIRES;
3214         }
3215     }
3216 
3217     public static class JCUses extends JCDirective
3218             implements UsesTree {
3219         public JCExpression qualid;
3220 
3221         protected JCUses(JCExpression qualId) {
3222             this.qualid = qualId;
3223         }
3224 
3225         @Override
3226         public void accept(Visitor v) { v.visitUses(this); }
3227 
3228         @Override @DefinedBy(Api.COMPILER_TREE)
3229         public Kind getKind() {
3230             return Kind.USES;
3231         }
3232 
3233         @Override @DefinedBy(Api.COMPILER_TREE)
3234         public JCExpression getServiceName() {
3235             return qualid;
3236         }
3237 
3238         @Override @DefinedBy(Api.COMPILER_TREE)
3239         public <R, D> R accept(TreeVisitor<R, D> v, D d) {
3240             return v.visitUses(this, d);
3241         }
3242 
3243         @Override
3244         public Tag getTag() {
3245             return USES;
3246         }
3247     }
3248 
3249     public static class JCErroneous extends JCExpression
3250             implements ErroneousTree {
3251         public List<? extends JCTree> errs;
3252         protected JCErroneous(List<? extends JCTree> errs) {
3253             this.errs = errs;
3254         }
3255         @Override
3256         public void accept(Visitor v) { v.visitErroneous(this); }
3257 
3258         @DefinedBy(Api.COMPILER_TREE)
3259         public Kind getKind() { return Kind.ERRONEOUS; }
3260 
3261         @DefinedBy(Api.COMPILER_TREE)
3262         public List<? extends JCTree> getErrorTrees() {
3263             return errs;
3264         }
3265 
3266         @Override @DefinedBy(Api.COMPILER_TREE)
3267         public <R,D> R accept(TreeVisitor<R,D> v, D d) {
3268             return v.visitErroneous(this, d);
3269         }
3270         @Override
3271         public Tag getTag() {
3272             return ERRONEOUS;
3273         }
3274     }
3275 
3276     /** (let int x = 3; in x+2) */
3277     public static class LetExpr extends JCExpression {
3278         public List<JCStatement> defs;
3279         public JCExpression expr;
3280         /**true if a expr should be run through Gen.genCond:*/
3281         public boolean needsCond;
3282         protected LetExpr(List<JCStatement> defs, JCExpression expr) {
3283             this.defs = defs;
3284             this.expr = expr;
3285         }
3286         @Override
3287         public void accept(Visitor v) { v.visitLetExpr(this); }
3288 
3289         @DefinedBy(Api.COMPILER_TREE)
3290         public Kind getKind() {
3291             throw new AssertionError("LetExpr is not part of a public API");
3292         }
3293         @Override @DefinedBy(Api.COMPILER_TREE)
3294         public <R,D> R accept(TreeVisitor<R,D> v, D d) {
3295             throw new AssertionError("LetExpr is not part of a public API");
3296         }
3297         @Override
3298         public Tag getTag() {
3299             return LETEXPR;
3300         }
3301     }
3302 
3303     /** An interface for tree factories
3304      */
3305     public interface Factory {
3306         JCCompilationUnit TopLevel(List<JCTree> defs);
3307         JCPackageDecl PackageDecl(List<JCAnnotation> annotations,
3308                                   JCExpression pid);
3309         JCImport Import(JCTree qualid, boolean staticImport);
3310         JCClassDecl ClassDef(JCModifiers mods,
3311                           Name name,
3312                           List<JCTypeParameter> typarams,
3313                           JCExpression extending,
3314                           List<JCExpression> implementing,
3315                           List<JCTree> defs);
3316         JCMethodDecl MethodDef(JCModifiers mods,
3317                             Name name,
3318                             JCExpression restype,
3319                             List<JCTypeParameter> typarams,
3320                             JCVariableDecl recvparam,
3321                             List<JCVariableDecl> params,
3322                             List<JCExpression> thrown,
3323                             JCBlock body,
3324                             JCExpression defaultValue);
3325         JCVariableDecl VarDef(JCModifiers mods,
3326                       Name name,
3327                       JCExpression vartype,
3328                       JCExpression init);
3329         JCSkip Skip();
3330         JCBlock Block(long flags, List<JCStatement> stats);
3331         JCDoWhileLoop DoLoop(JCStatement body, JCExpression cond);
3332         JCWhileLoop WhileLoop(JCExpression cond, JCStatement body);
3333         JCForLoop ForLoop(List<JCStatement> init,
3334                         JCExpression cond,
3335                         List<JCExpressionStatement> step,
3336                         JCStatement body);
3337         JCEnhancedForLoop ForeachLoop(JCVariableDecl var, JCExpression expr, JCStatement body);
3338         JCLabeledStatement Labelled(Name label, JCStatement body);
3339         JCSwitch Switch(JCExpression selector, List<JCCase> cases);
3340         JCSwitchExpression SwitchExpression(JCExpression selector, List<JCCase> cases);
3341         JCCase Case(CaseTree.CaseKind caseKind, List<JCCaseLabel> labels,
3342                     List<JCStatement> stats, JCTree body);
3343         JCSynchronized Synchronized(JCExpression lock, JCBlock body);
3344         JCTry Try(JCBlock body, List<JCCatch> catchers, JCBlock finalizer);
3345         JCTry Try(List<JCTree> resources,
3346                   JCBlock body,
3347                   List<JCCatch> catchers,
3348                   JCBlock finalizer);
3349         JCCatch Catch(JCVariableDecl param, JCBlock body);
3350         JCConditional Conditional(JCExpression cond,
3351                                 JCExpression thenpart,
3352                                 JCExpression elsepart);
3353         JCIf If(JCExpression cond, JCStatement thenpart, JCStatement elsepart);
3354         JCExpressionStatement Exec(JCExpression expr);
3355         JCBreak Break(Name label);
3356         JCYield Yield(JCExpression value);
3357         JCContinue Continue(Name label);
3358         JCReturn Return(JCExpression expr);
3359         JCThrow Throw(JCExpression expr);
3360         JCAssert Assert(JCExpression cond, JCExpression detail);
3361         JCMethodInvocation Apply(List<JCExpression> typeargs,
3362                     JCExpression fn,
3363                     List<JCExpression> args);
3364         JCNewClass NewClass(JCExpression encl,
3365                           List<JCExpression> typeargs,
3366                           JCExpression clazz,
3367                           List<JCExpression> args,
3368                           JCClassDecl def);
3369         JCNewArray NewArray(JCExpression elemtype,
3370                           List<JCExpression> dims,
3371                           List<JCExpression> elems);
3372         JCParens Parens(JCExpression expr);
3373         JCAssign Assign(JCExpression lhs, JCExpression rhs);
3374         JCAssignOp Assignop(Tag opcode, JCTree lhs, JCTree rhs);
3375         JCUnary Unary(Tag opcode, JCExpression arg);
3376         JCBinary Binary(Tag opcode, JCExpression lhs, JCExpression rhs);
3377         JCTypeCast TypeCast(JCTree expr, JCExpression type);
3378         JCInstanceOf TypeTest(JCExpression expr, JCTree clazz);
3379         JCBindingPattern BindingPattern(JCVariableDecl var);
3380         JCArrayAccess Indexed(JCExpression indexed, JCExpression index);
3381         JCFieldAccess Select(JCExpression selected, Name selector);
3382         JCIdent Ident(Name idname);
3383         JCLiteral Literal(TypeTag tag, Object value);
3384         JCPrimitiveTypeTree TypeIdent(TypeTag typetag);
3385         JCArrayTypeTree TypeArray(JCExpression elemtype);
3386         JCTypeApply TypeApply(JCExpression clazz, List<JCExpression> arguments);
3387         JCTypeParameter TypeParameter(Name name, List<JCExpression> bounds);
3388         JCWildcard Wildcard(TypeBoundKind kind, JCTree type);
3389         TypeBoundKind TypeBoundKind(BoundKind kind);
3390         JCAnnotation Annotation(JCTree annotationType, List<JCExpression> args);
3391         JCModifiers Modifiers(long flags, List<JCAnnotation> annotations);
3392         JCErroneous Erroneous(List<? extends JCTree> errs);
3393         JCModuleDecl ModuleDef(JCModifiers mods, ModuleKind kind, JCExpression qualId, List<JCDirective> directives);
3394         JCExports Exports(JCExpression qualId, List<JCExpression> moduleNames);
3395         JCOpens Opens(JCExpression qualId, List<JCExpression> moduleNames);
3396         JCProvides Provides(JCExpression serviceName, List<JCExpression> implNames);
3397         JCRequires Requires(boolean isTransitive, boolean isStaticPhase, JCExpression qualId);
3398         JCUses Uses(JCExpression qualId);
3399         LetExpr LetExpr(List<JCStatement> defs, JCExpression expr);
3400     }
3401 
3402     /** A generic visitor class for trees.
3403      */
3404     public static abstract class Visitor {
3405         public void visitTopLevel(JCCompilationUnit that)    { visitTree(that); }
3406         public void visitPackageDef(JCPackageDecl that)      { visitTree(that); }
3407         public void visitImport(JCImport that)               { visitTree(that); }
3408         public void visitClassDef(JCClassDecl that)          { visitTree(that); }
3409         public void visitMethodDef(JCMethodDecl that)        { visitTree(that); }
3410         public void visitVarDef(JCVariableDecl that)         { visitTree(that); }
3411         public void visitSkip(JCSkip that)                   { visitTree(that); }
3412         public void visitBlock(JCBlock that)                 { visitTree(that); }
3413         public void visitDoLoop(JCDoWhileLoop that)          { visitTree(that); }
3414         public void visitWhileLoop(JCWhileLoop that)         { visitTree(that); }
3415         public void visitForLoop(JCForLoop that)             { visitTree(that); }
3416         public void visitForeachLoop(JCEnhancedForLoop that) { visitTree(that); }
3417         public void visitLabelled(JCLabeledStatement that)   { visitTree(that); }
3418         public void visitSwitch(JCSwitch that)               { visitTree(that); }
3419         public void visitCase(JCCase that)                   { visitTree(that); }
3420         public void visitSwitchExpression(JCSwitchExpression that)               { visitTree(that); }
3421         public void visitSynchronized(JCSynchronized that)   { visitTree(that); }
3422         public void visitTry(JCTry that)                     { visitTree(that); }
3423         public void visitCatch(JCCatch that)                 { visitTree(that); }
3424         public void visitConditional(JCConditional that)     { visitTree(that); }
3425         public void visitIf(JCIf that)                       { visitTree(that); }
3426         public void visitExec(JCExpressionStatement that)    { visitTree(that); }
3427         public void visitBreak(JCBreak that)                 { visitTree(that); }
3428         public void visitYield(JCYield that)                 { visitTree(that); }
3429         public void visitContinue(JCContinue that)           { visitTree(that); }
3430         public void visitReturn(JCReturn that)               { visitTree(that); }
3431         public void visitThrow(JCThrow that)                 { visitTree(that); }
3432         public void visitAssert(JCAssert that)               { visitTree(that); }
3433         public void visitApply(JCMethodInvocation that)      { visitTree(that); }
3434         public void visitNewClass(JCNewClass that)           { visitTree(that); }
3435         public void visitNewArray(JCNewArray that)           { visitTree(that); }
3436         public void visitLambda(JCLambda that)               { visitTree(that); }
3437         public void visitParens(JCParens that)               { visitTree(that); }
3438         public void visitAssign(JCAssign that)               { visitTree(that); }
3439         public void visitAssignop(JCAssignOp that)           { visitTree(that); }
3440         public void visitUnary(JCUnary that)                 { visitTree(that); }
3441         public void visitBinary(JCBinary that)               { visitTree(that); }
3442         public void visitTypeCast(JCTypeCast that)           { visitTree(that); }
3443         public void visitTypeTest(JCInstanceOf that)         { visitTree(that); }
3444         public void visitBindingPattern(JCBindingPattern that) { visitTree(that); }
3445         public void visitDefaultCaseLabel(JCDefaultCaseLabel that) { visitTree(that); }
3446         public void visitParenthesizedPattern(JCParenthesizedPattern that) { visitTree(that); }
3447         public void visitGuardPattern(JCGuardPattern that) { visitTree(that); }
3448         public void visitIndexed(JCArrayAccess that)         { visitTree(that); }
3449         public void visitSelect(JCFieldAccess that)          { visitTree(that); }
3450         public void visitReference(JCMemberReference that)   { visitTree(that); }
3451         public void visitIdent(JCIdent that)                 { visitTree(that); }
3452         public void visitLiteral(JCLiteral that)             { visitTree(that); }
3453         public void visitTypeIdent(JCPrimitiveTypeTree that) { visitTree(that); }
3454         public void visitTypeArray(JCArrayTypeTree that)     { visitTree(that); }
3455         public void visitTypeApply(JCTypeApply that)         { visitTree(that); }
3456         public void visitTypeUnion(JCTypeUnion that)         { visitTree(that); }
3457         public void visitTypeIntersection(JCTypeIntersection that)  { visitTree(that); }
3458         public void visitTypeParameter(JCTypeParameter that) { visitTree(that); }
3459         public void visitWildcard(JCWildcard that)           { visitTree(that); }
3460         public void visitTypeBoundKind(TypeBoundKind that)   { visitTree(that); }
3461         public void visitAnnotation(JCAnnotation that)       { visitTree(that); }
3462         public void visitModifiers(JCModifiers that)         { visitTree(that); }
3463         public void visitAnnotatedType(JCAnnotatedType that) { visitTree(that); }
3464         public void visitErroneous(JCErroneous that)         { visitTree(that); }
3465         public void visitModuleDef(JCModuleDecl that)        { visitTree(that); }
3466         public void visitExports(JCExports that)             { visitTree(that); }
3467         public void visitOpens(JCOpens that)                 { visitTree(that); }
3468         public void visitProvides(JCProvides that)           { visitTree(that); }
3469         public void visitRequires(JCRequires that)           { visitTree(that); }
3470         public void visitUses(JCUses that)                   { visitTree(that); }
3471         public void visitLetExpr(LetExpr that)               { visitTree(that); }
3472 
3473         public void visitTree(JCTree that)                   { Assert.error(); }
3474     }
3475 
3476 }