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