langtools/src/share/classes/com/sun/tools/javac/tree/JCTree.java
changeset 10950 e87b50888909
parent 10636 56289804f311
child 11055 ec1418effa77
equal deleted inserted replaced
10949:42f7cc0468dd 10950:e87b50888909
    40 import com.sun.tools.javac.code.Scope.*;
    40 import com.sun.tools.javac.code.Scope.*;
    41 import com.sun.tools.javac.code.Symbol.*;
    41 import com.sun.tools.javac.code.Symbol.*;
    42 import com.sun.source.tree.*;
    42 import com.sun.source.tree.*;
    43 
    43 
    44 import static com.sun.tools.javac.code.BoundKind.*;
    44 import static com.sun.tools.javac.code.BoundKind.*;
       
    45 import static com.sun.tools.javac.tree.JCTree.Tag.*;
    45 
    46 
    46 /**
    47 /**
    47  * Root class for abstract syntax tree nodes. It provides definitions
    48  * Root class for abstract syntax tree nodes. It provides definitions
    48  * for specific tree nodes as subclasses nested inside.
    49  * for specific tree nodes as subclasses nested inside.
    49  *
    50  *
    77  * @see Pretty
    78  * @see Pretty
    78  */
    79  */
    79 public abstract class JCTree implements Tree, Cloneable, DiagnosticPosition {
    80 public abstract class JCTree implements Tree, Cloneable, DiagnosticPosition {
    80 
    81 
    81     /* Tree tag values, identifying kinds of trees */
    82     /* Tree tag values, identifying kinds of trees */
    82 
    83     public enum Tag{
    83     /** Toplevel nodes, of type TopLevel, representing entire source files.
    84         /** For methods that return an invalid tag if a given condition is not met
    84      */
    85          */
    85     public static final int  TOPLEVEL = 1;
    86         NO_TAG,
    86 
    87 
    87     /** Import clauses, of type Import.
    88         /** Toplevel nodes, of type TopLevel, representing entire source files.
    88      */
    89         */
    89     public static final int IMPORT = TOPLEVEL + 1;
    90         TOPLEVEL,
    90 
    91 
    91     /** Class definitions, of type ClassDef.
    92         /** Import clauses, of type Import.
    92      */
    93          */
    93     public static final int CLASSDEF = IMPORT + 1;
    94         IMPORT,
    94 
    95 
    95     /** Method definitions, of type MethodDef.
    96         /** Class definitions, of type ClassDef.
    96      */
    97          */
    97     public static final int METHODDEF = CLASSDEF + 1;
    98         CLASSDEF,
    98 
    99 
    99     /** Variable definitions, of type VarDef.
   100         /** Method definitions, of type MethodDef.
   100      */
   101          */
   101     public static final int VARDEF = METHODDEF + 1;
   102         METHODDEF,
   102 
   103 
   103     /** The no-op statement ";", of type Skip
   104         /** Variable definitions, of type VarDef.
   104      */
   105          */
   105     public static final int SKIP = VARDEF + 1;
   106         VARDEF,
   106 
   107 
   107     /** Blocks, of type Block.
   108         /** The no-op statement ";", of type Skip
   108      */
   109          */
   109     public static final int BLOCK = SKIP + 1;
   110         SKIP,
   110 
   111 
   111     /** Do-while loops, of type DoLoop.
   112         /** Blocks, of type Block.
   112      */
   113          */
   113     public static final int DOLOOP = BLOCK + 1;
   114         BLOCK,
   114 
   115 
   115     /** While-loops, of type WhileLoop.
   116         /** Do-while loops, of type DoLoop.
   116      */
   117          */
   117     public static final int WHILELOOP = DOLOOP + 1;
   118         DOLOOP,
   118 
   119 
   119     /** For-loops, of type ForLoop.
   120         /** While-loops, of type WhileLoop.
   120      */
   121          */
   121     public static final int FORLOOP = WHILELOOP + 1;
   122         WHILELOOP,
   122 
   123 
   123     /** Foreach-loops, of type ForeachLoop.
   124         /** For-loops, of type ForLoop.
   124      */
   125          */
   125     public static final int FOREACHLOOP = FORLOOP + 1;
   126         FORLOOP,
   126 
   127 
   127     /** Labelled statements, of type Labelled.
   128         /** Foreach-loops, of type ForeachLoop.
   128      */
   129          */
   129     public static final int LABELLED = FOREACHLOOP + 1;
   130         FOREACHLOOP,
   130 
   131 
   131     /** Switch statements, of type Switch.
   132         /** Labelled statements, of type Labelled.
   132      */
   133          */
   133     public static final int SWITCH = LABELLED + 1;
   134         LABELLED,
   134 
   135 
   135     /** Case parts in switch statements, of type Case.
   136         /** Switch statements, of type Switch.
   136      */
   137          */
   137     public static final int CASE = SWITCH + 1;
   138         SWITCH,
   138 
   139 
   139     /** Synchronized statements, of type Synchonized.
   140         /** Case parts in switch statements, of type Case.
   140      */
   141          */
   141     public static final int SYNCHRONIZED = CASE + 1;
   142         CASE,
   142 
   143 
   143     /** Try statements, of type Try.
   144         /** Synchronized statements, of type Synchonized.
   144      */
   145          */
   145     public static final int TRY = SYNCHRONIZED + 1;
   146         SYNCHRONIZED,
   146 
   147 
   147     /** Catch clauses in try statements, of type Catch.
   148         /** Try statements, of type Try.
   148      */
   149          */
   149     public static final int CATCH = TRY + 1;
   150         TRY,
   150 
   151 
   151     /** Conditional expressions, of type Conditional.
   152         /** Catch clauses in try statements, of type Catch.
   152      */
   153          */
   153     public static final int CONDEXPR = CATCH + 1;
   154         CATCH,
   154 
   155 
   155     /** Conditional statements, of type If.
   156         /** Conditional expressions, of type Conditional.
   156      */
   157          */
   157     public static final int IF = CONDEXPR + 1;
   158         CONDEXPR,
   158 
   159 
   159     /** Expression statements, of type Exec.
   160         /** Conditional statements, of type If.
   160      */
   161          */
   161     public static final int EXEC = IF + 1;
   162         IF,
   162 
   163 
   163     /** Break statements, of type Break.
   164         /** Expression statements, of type Exec.
   164      */
   165          */
   165     public static final int BREAK = EXEC + 1;
   166         EXEC,
   166 
   167 
   167     /** Continue statements, of type Continue.
   168         /** Break statements, of type Break.
   168      */
   169          */
   169     public static final int CONTINUE = BREAK + 1;
   170         BREAK,
   170 
   171 
   171     /** Return statements, of type Return.
   172         /** Continue statements, of type Continue.
   172      */
   173          */
   173     public static final int RETURN = CONTINUE + 1;
   174         CONTINUE,
   174 
   175 
   175     /** Throw statements, of type Throw.
   176         /** Return statements, of type Return.
   176      */
   177          */
   177     public static final int THROW = RETURN + 1;
   178         RETURN,
   178 
   179 
   179     /** Assert statements, of type Assert.
   180         /** Throw statements, of type Throw.
   180      */
   181          */
   181     public static final int ASSERT = THROW + 1;
   182         THROW,
   182 
   183 
   183     /** Method invocation expressions, of type Apply.
   184         /** Assert statements, of type Assert.
   184      */
   185          */
   185     public static final int APPLY = ASSERT + 1;
   186         ASSERT,
   186 
   187 
   187     /** Class instance creation expressions, of type NewClass.
   188         /** Method invocation expressions, of type Apply.
   188      */
   189          */
   189     public static final int NEWCLASS = APPLY + 1;
   190         APPLY,
   190 
   191 
   191     /** Array creation expressions, of type NewArray.
   192         /** Class instance creation expressions, of type NewClass.
   192      */
   193          */
   193     public static final int NEWARRAY = NEWCLASS + 1;
   194         NEWCLASS,
   194 
   195 
   195     /** Parenthesized subexpressions, of type Parens.
   196         /** Array creation expressions, of type NewArray.
   196      */
   197          */
   197     public static final int PARENS = NEWARRAY + 1;
   198         NEWARRAY,
   198 
   199 
   199     /** Assignment expressions, of type Assign.
   200         /** Parenthesized subexpressions, of type Parens.
   200      */
   201          */
   201     public static final int ASSIGN = PARENS + 1;
   202         PARENS,
   202 
   203 
   203     /** Type cast expressions, of type TypeCast.
   204         /** Assignment expressions, of type Assign.
   204      */
   205          */
   205     public static final int TYPECAST = ASSIGN + 1;
   206         ASSIGN,
   206 
   207 
   207     /** Type test expressions, of type TypeTest.
   208         /** Type cast expressions, of type TypeCast.
   208      */
   209          */
   209     public static final int TYPETEST = TYPECAST + 1;
   210         TYPECAST,
   210 
   211 
   211     /** Indexed array expressions, of type Indexed.
   212         /** Type test expressions, of type TypeTest.
   212      */
   213          */
   213     public static final int INDEXED = TYPETEST + 1;
   214         TYPETEST,
   214 
   215 
   215     /** Selections, of type Select.
   216         /** Indexed array expressions, of type Indexed.
   216      */
   217          */
   217     public static final int SELECT = INDEXED + 1;
   218         INDEXED,
   218 
   219 
   219     /** Simple identifiers, of type Ident.
   220         /** Selections, of type Select.
   220      */
   221          */
   221     public static final int IDENT = SELECT + 1;
   222         SELECT,
   222 
   223 
   223     /** Literals, of type Literal.
   224         /** Simple identifiers, of type Ident.
   224      */
   225          */
   225     public static final int LITERAL = IDENT + 1;
   226         IDENT,
   226 
   227 
   227     /** Basic type identifiers, of type TypeIdent.
   228         /** Literals, of type Literal.
   228      */
   229          */
   229     public static final int TYPEIDENT = LITERAL + 1;
   230         LITERAL,
   230 
   231 
   231     /** Array types, of type TypeArray.
   232         /** Basic type identifiers, of type TypeIdent.
   232      */
   233          */
   233     public static final int TYPEARRAY = TYPEIDENT + 1;
   234         TYPEIDENT,
   234 
   235 
   235     /** Parameterized types, of type TypeApply.
   236         /** Array types, of type TypeArray.
   236      */
   237          */
   237     public static final int TYPEAPPLY = TYPEARRAY + 1;
   238         TYPEARRAY,
   238 
   239 
   239     /** Union types, of type TypeUnion
   240         /** Parameterized types, of type TypeApply.
   240      */
   241          */
   241     public static final int TYPEUNION = TYPEAPPLY + 1;
   242         TYPEAPPLY,
   242 
   243 
   243     /** Formal type parameters, of type TypeParameter.
   244         /** Union types, of type TypeUnion
   244      */
   245          */
   245     public static final int TYPEPARAMETER = TYPEUNION + 1;
   246         TYPEUNION,
   246 
   247 
   247     /** Type argument.
   248         /** Formal type parameters, of type TypeParameter.
   248      */
   249          */
   249     public static final int WILDCARD = TYPEPARAMETER + 1;
   250         TYPEPARAMETER,
   250 
   251 
   251     /** Bound kind: extends, super, exact, or unbound
   252         /** Type argument.
   252      */
   253          */
   253     public static final int TYPEBOUNDKIND = WILDCARD + 1;
   254         WILDCARD,
   254 
   255 
   255     /** metadata: Annotation.
   256         /** Bound kind: extends, super, exact, or unbound
   256      */
   257          */
   257     public static final int ANNOTATION = TYPEBOUNDKIND + 1;
   258         TYPEBOUNDKIND,
   258 
   259 
   259     /** metadata: Modifiers
   260         /** metadata: Annotation.
   260      */
   261          */
   261     public static final int MODIFIERS = ANNOTATION + 1;
   262         ANNOTATION,
   262 
   263 
   263     public static final int ANNOTATED_TYPE = MODIFIERS + 1;
   264         /** metadata: Modifiers
   264 
   265          */
   265     /** Error trees, of type Erroneous.
   266         MODIFIERS,
   266      */
   267 
   267     public static final int ERRONEOUS = ANNOTATED_TYPE + 1;
   268         ANNOTATED_TYPE,
   268 
   269 
   269     /** Unary operators, of type Unary.
   270         /** Error trees, of type Erroneous.
   270      */
   271          */
   271     public static final int POS = ERRONEOUS + 1;             // +
   272         ERRONEOUS,
   272     public static final int NEG = POS + 1;                   // -
   273 
   273     public static final int NOT = NEG + 1;                   // !
   274         /** Unary operators, of type Unary.
   274     public static final int COMPL = NOT + 1;                 // ~
   275          */
   275     public static final int PREINC = COMPL + 1;              // ++ _
   276         POS,                             // +
   276     public static final int PREDEC = PREINC + 1;             // -- _
   277         NEG,                             // -
   277     public static final int POSTINC = PREDEC + 1;            // _ ++
   278         NOT,                             // !
   278     public static final int POSTDEC = POSTINC + 1;           // _ --
   279         COMPL,                           // ~
   279 
   280         PREINC,                          // ++ _
   280     /** unary operator for null reference checks, only used internally.
   281         PREDEC,                          // -- _
   281      */
   282         POSTINC,                         // _ ++
   282     public static final int NULLCHK = POSTDEC + 1;
   283         POSTDEC,                         // _ --
   283 
   284 
   284     /** Binary operators, of type Binary.
   285         /** unary operator for null reference checks, only used internally.
   285      */
   286          */
   286     public static final int OR = NULLCHK + 1;                // ||
   287         NULLCHK,
   287     public static final int AND = OR + 1;                    // &&
   288 
   288     public static final int BITOR = AND + 1;                 // |
   289         /** Binary operators, of type Binary.
   289     public static final int BITXOR = BITOR + 1;              // ^
   290          */
   290     public static final int BITAND = BITXOR + 1;             // &
   291         OR,                              // ||
   291     public static final int EQ = BITAND + 1;                 // ==
   292         AND,                             // &&
   292     public static final int NE = EQ + 1;                     // !=
   293         BITOR,                           // |
   293     public static final int LT = NE + 1;                     // <
   294         BITXOR,                          // ^
   294     public static final int GT = LT + 1;                     // >
   295         BITAND,                          // &
   295     public static final int LE = GT + 1;                     // <=
   296         EQ,                              // ==
   296     public static final int GE = LE + 1;                     // >=
   297         NE,                              // !=
   297     public static final int SL = GE + 1;                     // <<
   298         LT,                              // <
   298     public static final int SR = SL + 1;                     // >>
   299         GT,                              // >
   299     public static final int USR = SR + 1;                    // >>>
   300         LE,                              // <=
   300     public static final int PLUS = USR + 1;                  // +
   301         GE,                              // >=
   301     public static final int MINUS = PLUS + 1;                // -
   302         SL,                              // <<
   302     public static final int MUL = MINUS + 1;                 // *
   303         SR,                              // >>
   303     public static final int DIV = MUL + 1;                   // /
   304         USR,                             // >>>
   304     public static final int MOD = DIV + 1;                   // %
   305         PLUS,                            // +
   305 
   306         MINUS,                           // -
   306     /** Assignment operators, of type Assignop.
   307         MUL,                             // *
   307      */
   308         DIV,                             // /
   308     public static final int BITOR_ASG = MOD + 1;             // |=
   309         MOD,                             // %
   309     public static final int BITXOR_ASG = BITOR_ASG + 1;      // ^=
   310 
   310     public static final int BITAND_ASG = BITXOR_ASG + 1;     // &=
   311         /** Assignment operators, of type Assignop.
   311 
   312          */
   312     public static final int SL_ASG = SL + BITOR_ASG - BITOR; // <<=
   313         BITOR_ASG(BITOR),                // |=
   313     public static final int SR_ASG = SL_ASG + 1;             // >>=
   314         BITXOR_ASG(BITXOR),              // ^=
   314     public static final int USR_ASG = SR_ASG + 1;            // >>>=
   315         BITAND_ASG(BITAND),              // &=
   315     public static final int PLUS_ASG = USR_ASG + 1;          // +=
   316 
   316     public static final int MINUS_ASG = PLUS_ASG + 1;        // -=
   317         SL_ASG(SL),                      // <<=
   317     public static final int MUL_ASG = MINUS_ASG + 1;         // *=
   318         SR_ASG(SR),                      // >>=
   318     public static final int DIV_ASG = MUL_ASG + 1;           // /=
   319         USR_ASG(USR),                    // >>>=
   319     public static final int MOD_ASG = DIV_ASG + 1;           // %=
   320         PLUS_ASG(PLUS),                  // +=
   320 
   321         MINUS_ASG(MINUS),                // -=
   321     /** A synthetic let expression, of type LetExpr.
   322         MUL_ASG(MUL),                    // *=
   322      */
   323         DIV_ASG(DIV),                    // /=
   323     public static final int LETEXPR = MOD_ASG + 1;           // ala scheme
   324         MOD_ASG(MOD),                    // %=
   324 
   325 
   325 
   326         /** A synthetic let expression, of type LetExpr.
   326     /** The offset between assignment operators and normal operators.
   327          */
   327      */
   328         LETEXPR;                         // ala scheme
   328     public static final int ASGOffset = BITOR_ASG - BITOR;
   329 
       
   330         private Tag noAssignTag;
       
   331 
       
   332         private static int numberOfOperators = MOD.ordinal() - POS.ordinal() + 1;
       
   333 
       
   334         private Tag(Tag noAssignTag) {
       
   335             this.noAssignTag = noAssignTag;
       
   336         }
       
   337 
       
   338         private Tag() { }
       
   339 
       
   340         public static int getNumberOfOperators() {
       
   341             return numberOfOperators;
       
   342         }
       
   343 
       
   344         public Tag noAssignOp() {
       
   345             if (noAssignTag != null)
       
   346                 return noAssignTag;
       
   347             throw new AssertionError("noAssignOp() method is not available for non assignment tags");
       
   348         }
       
   349 
       
   350         public boolean isPostUnaryOp() {
       
   351             return (this == POSTINC || this == POSTDEC);
       
   352         }
       
   353 
       
   354         public boolean isIncOrDecUnaryOp() {
       
   355             return (this == PREINC || this == PREDEC || this == POSTINC || this == POSTDEC);
       
   356         }
       
   357 
       
   358         public boolean isAssignop() {
       
   359             return noAssignTag != null;
       
   360         }
       
   361 
       
   362         public int operatorIndex() {
       
   363             return (this.ordinal() - POS.ordinal());
       
   364         }
       
   365     }
   329 
   366 
   330     /* The (encoded) position in the source file. @see util.Position.
   367     /* The (encoded) position in the source file. @see util.Position.
   331      */
   368      */
   332     public int pos;
   369     public int pos;
   333 
   370 
   335      */
   372      */
   336     public Type type;
   373     public Type type;
   337 
   374 
   338     /* The tag of this node -- one of the constants declared above.
   375     /* The tag of this node -- one of the constants declared above.
   339      */
   376      */
   340     public abstract int getTag();
   377     public abstract Tag getTag();
       
   378 
       
   379     /* Returns true if the tag of this node is equals to tag.
       
   380      */
       
   381     public boolean hasTag(Tag tag) {
       
   382         return tag == getTag();
       
   383     }
   341 
   384 
   342     /** Convert a tree to a pretty-printed string. */
   385     /** Convert a tree to a pretty-printed string. */
   343     @Override
   386     @Override
   344     public String toString() {
   387     public String toString() {
   345         StringWriter s = new StringWriter();
   388         StringWriter s = new StringWriter();
   462             return packageAnnotations;
   505             return packageAnnotations;
   463         }
   506         }
   464         public List<JCImport> getImports() {
   507         public List<JCImport> getImports() {
   465             ListBuffer<JCImport> imports = new ListBuffer<JCImport>();
   508             ListBuffer<JCImport> imports = new ListBuffer<JCImport>();
   466             for (JCTree tree : defs) {
   509             for (JCTree tree : defs) {
   467                 int tag = tree.getTag();
   510                 if (tree.hasTag(IMPORT))
   468                 if (tag == IMPORT)
       
   469                     imports.append((JCImport)tree);
   511                     imports.append((JCImport)tree);
   470                 else if (tag != SKIP)
   512                 else if (!tree.hasTag(SKIP))
   471                     break;
   513                     break;
   472             }
   514             }
   473             return imports.toList();
   515             return imports.toList();
   474         }
   516         }
   475         public JCExpression getPackageName() { return pid; }
   517         public JCExpression getPackageName() { return pid; }
   480             return lineMap;
   522             return lineMap;
   481         }
   523         }
   482         public List<JCTree> getTypeDecls() {
   524         public List<JCTree> getTypeDecls() {
   483             List<JCTree> typeDefs;
   525             List<JCTree> typeDefs;
   484             for (typeDefs = defs; !typeDefs.isEmpty(); typeDefs = typeDefs.tail)
   526             for (typeDefs = defs; !typeDefs.isEmpty(); typeDefs = typeDefs.tail)
   485                 if (typeDefs.head.getTag() != IMPORT)
   527                 if (!typeDefs.head.hasTag(IMPORT))
   486                     break;
   528                     break;
   487             return typeDefs;
   529             return typeDefs;
   488         }
   530         }
   489         @Override
   531         @Override
   490         public <R,D> R accept(TreeVisitor<R,D> v, D d) {
   532         public <R,D> R accept(TreeVisitor<R,D> v, D d) {
   491             return v.visitCompilationUnit(this, d);
   533             return v.visitCompilationUnit(this, d);
   492         }
   534         }
   493 
   535 
   494         @Override
   536         @Override
   495         public int getTag() {
   537         public Tag getTag() {
   496             return TOPLEVEL;
   538             return TOPLEVEL;
   497         }
   539         }
   498     }
   540     }
   499 
   541 
   500     /**
   542     /**
   519         public <R,D> R accept(TreeVisitor<R,D> v, D d) {
   561         public <R,D> R accept(TreeVisitor<R,D> v, D d) {
   520             return v.visitImport(this, d);
   562             return v.visitImport(this, d);
   521         }
   563         }
   522 
   564 
   523         @Override
   565         @Override
   524         public int getTag() {
   566         public Tag getTag() {
   525             return IMPORT;
   567             return IMPORT;
   526         }
   568         }
   527     }
   569     }
   528 
   570 
   529     public static abstract class JCStatement extends JCTree implements StatementTree {
   571     public static abstract class JCStatement extends JCTree implements StatementTree {
   616         public <R,D> R accept(TreeVisitor<R,D> v, D d) {
   658         public <R,D> R accept(TreeVisitor<R,D> v, D d) {
   617             return v.visitClass(this, d);
   659             return v.visitClass(this, d);
   618         }
   660         }
   619 
   661 
   620         @Override
   662         @Override
   621         public int getTag() {
   663         public Tag getTag() {
   622             return CLASSDEF;
   664             return CLASSDEF;
   623         }
   665         }
   624     }
   666     }
   625 
   667 
   626     /**
   668     /**
   688         public <R,D> R accept(TreeVisitor<R,D> v, D d) {
   730         public <R,D> R accept(TreeVisitor<R,D> v, D d) {
   689             return v.visitMethod(this, d);
   731             return v.visitMethod(this, d);
   690         }
   732         }
   691 
   733 
   692         @Override
   734         @Override
   693         public int getTag() {
   735         public Tag getTag() {
   694             return METHODDEF;
   736             return METHODDEF;
   695         }
   737         }
   696   }
   738   }
   697 
   739 
   698     /**
   740     /**
   734         public <R,D> R accept(TreeVisitor<R,D> v, D d) {
   776         public <R,D> R accept(TreeVisitor<R,D> v, D d) {
   735             return v.visitVariable(this, d);
   777             return v.visitVariable(this, d);
   736         }
   778         }
   737 
   779 
   738         @Override
   780         @Override
   739         public int getTag() {
   781         public Tag getTag() {
   740             return VARDEF;
   782             return VARDEF;
   741         }
   783         }
   742     }
   784     }
   743 
   785 
   744       /**
   786       /**
   755         public <R,D> R accept(TreeVisitor<R,D> v, D d) {
   797         public <R,D> R accept(TreeVisitor<R,D> v, D d) {
   756             return v.visitEmptyStatement(this, d);
   798             return v.visitEmptyStatement(this, d);
   757         }
   799         }
   758 
   800 
   759         @Override
   801         @Override
   760         public int getTag() {
   802         public Tag getTag() {
   761             return SKIP;
   803             return SKIP;
   762         }
   804         }
   763     }
   805     }
   764 
   806 
   765     /**
   807     /**
   788         public <R,D> R accept(TreeVisitor<R,D> v, D d) {
   830         public <R,D> R accept(TreeVisitor<R,D> v, D d) {
   789             return v.visitBlock(this, d);
   831             return v.visitBlock(this, d);
   790         }
   832         }
   791 
   833 
   792         @Override
   834         @Override
   793         public int getTag() {
   835         public Tag getTag() {
   794             return BLOCK;
   836             return BLOCK;
   795         }
   837         }
   796     }
   838     }
   797 
   839 
   798     /**
   840     /**
   815         public <R,D> R accept(TreeVisitor<R,D> v, D d) {
   857         public <R,D> R accept(TreeVisitor<R,D> v, D d) {
   816             return v.visitDoWhileLoop(this, d);
   858             return v.visitDoWhileLoop(this, d);
   817         }
   859         }
   818 
   860 
   819         @Override
   861         @Override
   820         public int getTag() {
   862         public Tag getTag() {
   821             return DOLOOP;
   863             return DOLOOP;
   822         }
   864         }
   823     }
   865     }
   824 
   866 
   825     /**
   867     /**
   842         public <R,D> R accept(TreeVisitor<R,D> v, D d) {
   884         public <R,D> R accept(TreeVisitor<R,D> v, D d) {
   843             return v.visitWhileLoop(this, d);
   885             return v.visitWhileLoop(this, d);
   844         }
   886         }
   845 
   887 
   846         @Override
   888         @Override
   847         public int getTag() {
   889         public Tag getTag() {
   848             return WHILELOOP;
   890             return WHILELOOP;
   849         }
   891         }
   850     }
   892     }
   851 
   893 
   852     /**
   894     /**
   883         public <R,D> R accept(TreeVisitor<R,D> v, D d) {
   925         public <R,D> R accept(TreeVisitor<R,D> v, D d) {
   884             return v.visitForLoop(this, d);
   926             return v.visitForLoop(this, d);
   885         }
   927         }
   886 
   928 
   887         @Override
   929         @Override
   888         public int getTag() {
   930         public Tag getTag() {
   889             return FORLOOP;
   931             return FORLOOP;
   890         }
   932         }
   891     }
   933     }
   892 
   934 
   893     /**
   935     /**
   912         @Override
   954         @Override
   913         public <R,D> R accept(TreeVisitor<R,D> v, D d) {
   955         public <R,D> R accept(TreeVisitor<R,D> v, D d) {
   914             return v.visitEnhancedForLoop(this, d);
   956             return v.visitEnhancedForLoop(this, d);
   915         }
   957         }
   916         @Override
   958         @Override
   917         public int getTag() {
   959         public Tag getTag() {
   918             return FOREACHLOOP;
   960             return FOREACHLOOP;
   919         }
   961         }
   920     }
   962     }
   921 
   963 
   922     /**
   964     /**
   937         @Override
   979         @Override
   938         public <R,D> R accept(TreeVisitor<R,D> v, D d) {
   980         public <R,D> R accept(TreeVisitor<R,D> v, D d) {
   939             return v.visitLabeledStatement(this, d);
   981             return v.visitLabeledStatement(this, d);
   940         }
   982         }
   941         @Override
   983         @Override
   942         public int getTag() {
   984         public Tag getTag() {
   943             return LABELLED;
   985             return LABELLED;
   944         }
   986         }
   945     }
   987     }
   946 
   988 
   947     /**
   989     /**
   963         @Override
  1005         @Override
   964         public <R,D> R accept(TreeVisitor<R,D> v, D d) {
  1006         public <R,D> R accept(TreeVisitor<R,D> v, D d) {
   965             return v.visitSwitch(this, d);
  1007             return v.visitSwitch(this, d);
   966         }
  1008         }
   967         @Override
  1009         @Override
   968         public int getTag() {
  1010         public Tag getTag() {
   969             return SWITCH;
  1011             return SWITCH;
   970         }
  1012         }
   971     }
  1013     }
   972 
  1014 
   973     /**
  1015     /**
   989         @Override
  1031         @Override
   990         public <R,D> R accept(TreeVisitor<R,D> v, D d) {
  1032         public <R,D> R accept(TreeVisitor<R,D> v, D d) {
   991             return v.visitCase(this, d);
  1033             return v.visitCase(this, d);
   992         }
  1034         }
   993         @Override
  1035         @Override
   994         public int getTag() {
  1036         public Tag getTag() {
   995             return CASE;
  1037             return CASE;
   996         }
  1038         }
   997     }
  1039     }
   998 
  1040 
   999     /**
  1041     /**
  1015         @Override
  1057         @Override
  1016         public <R,D> R accept(TreeVisitor<R,D> v, D d) {
  1058         public <R,D> R accept(TreeVisitor<R,D> v, D d) {
  1017             return v.visitSynchronized(this, d);
  1059             return v.visitSynchronized(this, d);
  1018         }
  1060         }
  1019         @Override
  1061         @Override
  1020         public int getTag() {
  1062         public Tag getTag() {
  1021             return SYNCHRONIZED;
  1063             return SYNCHRONIZED;
  1022         }
  1064         }
  1023     }
  1065     }
  1024 
  1066 
  1025     /**
  1067     /**
  1055         @Override
  1097         @Override
  1056         public List<? extends JCTree> getResources() {
  1098         public List<? extends JCTree> getResources() {
  1057             return resources;
  1099             return resources;
  1058         }
  1100         }
  1059         @Override
  1101         @Override
  1060         public int getTag() {
  1102         public Tag getTag() {
  1061             return TRY;
  1103             return TRY;
  1062         }
  1104         }
  1063     }
  1105     }
  1064 
  1106 
  1065     /**
  1107     /**
  1081         @Override
  1123         @Override
  1082         public <R,D> R accept(TreeVisitor<R,D> v, D d) {
  1124         public <R,D> R accept(TreeVisitor<R,D> v, D d) {
  1083             return v.visitCatch(this, d);
  1125             return v.visitCatch(this, d);
  1084         }
  1126         }
  1085         @Override
  1127         @Override
  1086         public int getTag() {
  1128         public Tag getTag() {
  1087             return CATCH;
  1129             return CATCH;
  1088         }
  1130         }
  1089     }
  1131     }
  1090 
  1132 
  1091     /**
  1133     /**
  1113         @Override
  1155         @Override
  1114         public <R,D> R accept(TreeVisitor<R,D> v, D d) {
  1156         public <R,D> R accept(TreeVisitor<R,D> v, D d) {
  1115             return v.visitConditionalExpression(this, d);
  1157             return v.visitConditionalExpression(this, d);
  1116         }
  1158         }
  1117         @Override
  1159         @Override
  1118         public int getTag() {
  1160         public Tag getTag() {
  1119             return CONDEXPR;
  1161             return CONDEXPR;
  1120         }
  1162         }
  1121     }
  1163     }
  1122 
  1164 
  1123     /**
  1165     /**
  1145         @Override
  1187         @Override
  1146         public <R,D> R accept(TreeVisitor<R,D> v, D d) {
  1188         public <R,D> R accept(TreeVisitor<R,D> v, D d) {
  1147             return v.visitIf(this, d);
  1189             return v.visitIf(this, d);
  1148         }
  1190         }
  1149         @Override
  1191         @Override
  1150         public int getTag() {
  1192         public Tag getTag() {
  1151             return IF;
  1193             return IF;
  1152         }
  1194         }
  1153     }
  1195     }
  1154 
  1196 
  1155     /**
  1197     /**
  1170         @Override
  1212         @Override
  1171         public <R,D> R accept(TreeVisitor<R,D> v, D d) {
  1213         public <R,D> R accept(TreeVisitor<R,D> v, D d) {
  1172             return v.visitExpressionStatement(this, d);
  1214             return v.visitExpressionStatement(this, d);
  1173         }
  1215         }
  1174         @Override
  1216         @Override
  1175         public int getTag() {
  1217         public Tag getTag() {
  1176             return EXEC;
  1218             return EXEC;
  1177         }
  1219         }
  1178 
  1220 
  1179         /** Convert a expression-statement tree to a pretty-printed string. */
  1221         /** Convert a expression-statement tree to a pretty-printed string. */
  1180         @Override
  1222         @Override
  1210         @Override
  1252         @Override
  1211         public <R,D> R accept(TreeVisitor<R,D> v, D d) {
  1253         public <R,D> R accept(TreeVisitor<R,D> v, D d) {
  1212             return v.visitBreak(this, d);
  1254             return v.visitBreak(this, d);
  1213         }
  1255         }
  1214         @Override
  1256         @Override
  1215         public int getTag() {
  1257         public Tag getTag() {
  1216             return BREAK;
  1258             return BREAK;
  1217         }
  1259         }
  1218     }
  1260     }
  1219 
  1261 
  1220     /**
  1262     /**
  1235         @Override
  1277         @Override
  1236         public <R,D> R accept(TreeVisitor<R,D> v, D d) {
  1278         public <R,D> R accept(TreeVisitor<R,D> v, D d) {
  1237             return v.visitContinue(this, d);
  1279             return v.visitContinue(this, d);
  1238         }
  1280         }
  1239         @Override
  1281         @Override
  1240         public int getTag() {
  1282         public Tag getTag() {
  1241             return CONTINUE;
  1283             return CONTINUE;
  1242         }
  1284         }
  1243     }
  1285     }
  1244 
  1286 
  1245     /**
  1287     /**
  1258         @Override
  1300         @Override
  1259         public <R,D> R accept(TreeVisitor<R,D> v, D d) {
  1301         public <R,D> R accept(TreeVisitor<R,D> v, D d) {
  1260             return v.visitReturn(this, d);
  1302             return v.visitReturn(this, d);
  1261         }
  1303         }
  1262         @Override
  1304         @Override
  1263         public int getTag() {
  1305         public Tag getTag() {
  1264             return RETURN;
  1306             return RETURN;
  1265         }
  1307         }
  1266     }
  1308     }
  1267 
  1309 
  1268     /**
  1310     /**
  1281         @Override
  1323         @Override
  1282         public <R,D> R accept(TreeVisitor<R,D> v, D d) {
  1324         public <R,D> R accept(TreeVisitor<R,D> v, D d) {
  1283             return v.visitThrow(this, d);
  1325             return v.visitThrow(this, d);
  1284         }
  1326         }
  1285         @Override
  1327         @Override
  1286         public int getTag() {
  1328         public Tag getTag() {
  1287             return THROW;
  1329             return THROW;
  1288         }
  1330         }
  1289     }
  1331     }
  1290 
  1332 
  1291     /**
  1333     /**
  1307         @Override
  1349         @Override
  1308         public <R,D> R accept(TreeVisitor<R,D> v, D d) {
  1350         public <R,D> R accept(TreeVisitor<R,D> v, D d) {
  1309             return v.visitAssert(this, d);
  1351             return v.visitAssert(this, d);
  1310         }
  1352         }
  1311         @Override
  1353         @Override
  1312         public int getTag() {
  1354         public Tag getTag() {
  1313             return ASSERT;
  1355             return ASSERT;
  1314         }
  1356         }
  1315     }
  1357     }
  1316 
  1358 
  1317     /**
  1359     /**
  1350         public JCMethodInvocation setType(Type type) {
  1392         public JCMethodInvocation setType(Type type) {
  1351             super.setType(type);
  1393             super.setType(type);
  1352             return this;
  1394             return this;
  1353         }
  1395         }
  1354         @Override
  1396         @Override
  1355         public int getTag() {
  1397         public Tag getTag() {
  1356             return(APPLY);
  1398             return(APPLY);
  1357         }
  1399         }
  1358     }
  1400     }
  1359 
  1401 
  1360     /**
  1402     /**
  1400         @Override
  1442         @Override
  1401         public <R,D> R accept(TreeVisitor<R,D> v, D d) {
  1443         public <R,D> R accept(TreeVisitor<R,D> v, D d) {
  1402             return v.visitNewClass(this, d);
  1444             return v.visitNewClass(this, d);
  1403         }
  1445         }
  1404         @Override
  1446         @Override
  1405         public int getTag() {
  1447         public Tag getTag() {
  1406             return NEWCLASS;
  1448             return NEWCLASS;
  1407         }
  1449         }
  1408     }
  1450     }
  1409 
  1451 
  1410     /**
  1452     /**
  1436         @Override
  1478         @Override
  1437         public <R,D> R accept(TreeVisitor<R,D> v, D d) {
  1479         public <R,D> R accept(TreeVisitor<R,D> v, D d) {
  1438             return v.visitNewArray(this, d);
  1480             return v.visitNewArray(this, d);
  1439         }
  1481         }
  1440         @Override
  1482         @Override
  1441         public int getTag() {
  1483         public Tag getTag() {
  1442             return NEWARRAY;
  1484             return NEWARRAY;
  1443         }
  1485         }
  1444     }
  1486     }
  1445 
  1487 
  1446     /**
  1488     /**
  1459         @Override
  1501         @Override
  1460         public <R,D> R accept(TreeVisitor<R,D> v, D d) {
  1502         public <R,D> R accept(TreeVisitor<R,D> v, D d) {
  1461             return v.visitParenthesized(this, d);
  1503             return v.visitParenthesized(this, d);
  1462         }
  1504         }
  1463         @Override
  1505         @Override
  1464         public int getTag() {
  1506         public Tag getTag() {
  1465             return PARENS;
  1507             return PARENS;
  1466         }
  1508         }
  1467     }
  1509     }
  1468 
  1510 
  1469     /**
  1511     /**
  1485         @Override
  1527         @Override
  1486         public <R,D> R accept(TreeVisitor<R,D> v, D d) {
  1528         public <R,D> R accept(TreeVisitor<R,D> v, D d) {
  1487             return v.visitAssignment(this, d);
  1529             return v.visitAssignment(this, d);
  1488         }
  1530         }
  1489         @Override
  1531         @Override
  1490         public int getTag() {
  1532         public Tag getTag() {
  1491             return ASSIGN;
  1533             return ASSIGN;
  1492         }
  1534         }
  1493     }
  1535     }
  1494 
  1536 
  1495     /**
  1537     /**
  1496      * An assignment with "+=", "|=" ...
  1538      * An assignment with "+=", "|=" ...
  1497      */
  1539      */
  1498     public static class JCAssignOp extends JCExpression implements CompoundAssignmentTree {
  1540     public static class JCAssignOp extends JCExpression implements CompoundAssignmentTree {
  1499         private int opcode;
  1541         private Tag opcode;
  1500         public JCExpression lhs;
  1542         public JCExpression lhs;
  1501         public JCExpression rhs;
  1543         public JCExpression rhs;
  1502         public Symbol operator;
  1544         public Symbol operator;
  1503         protected JCAssignOp(int opcode, JCTree lhs, JCTree rhs, Symbol operator) {
  1545         protected JCAssignOp(Tag opcode, JCTree lhs, JCTree rhs, Symbol operator) {
  1504             this.opcode = opcode;
  1546             this.opcode = opcode;
  1505             this.lhs = (JCExpression)lhs;
  1547             this.lhs = (JCExpression)lhs;
  1506             this.rhs = (JCExpression)rhs;
  1548             this.rhs = (JCExpression)rhs;
  1507             this.operator = operator;
  1549             this.operator = operator;
  1508         }
  1550         }
  1518         @Override
  1560         @Override
  1519         public <R,D> R accept(TreeVisitor<R,D> v, D d) {
  1561         public <R,D> R accept(TreeVisitor<R,D> v, D d) {
  1520             return v.visitCompoundAssignment(this, d);
  1562             return v.visitCompoundAssignment(this, d);
  1521         }
  1563         }
  1522         @Override
  1564         @Override
  1523         public int getTag() {
  1565         public Tag getTag() {
  1524             return opcode;
  1566             return opcode;
  1525         }
  1567         }
  1526     }
  1568     }
  1527 
  1569 
  1528     /**
  1570     /**
  1529      * A unary operation.
  1571      * A unary operation.
  1530      */
  1572      */
  1531     public static class JCUnary extends JCExpression implements UnaryTree {
  1573     public static class JCUnary extends JCExpression implements UnaryTree {
  1532         private int opcode;
  1574         private Tag opcode;
  1533         public JCExpression arg;
  1575         public JCExpression arg;
  1534         public Symbol operator;
  1576         public Symbol operator;
  1535         protected JCUnary(int opcode, JCExpression arg) {
  1577         protected JCUnary(Tag opcode, JCExpression arg) {
  1536             this.opcode = opcode;
  1578             this.opcode = opcode;
  1537             this.arg = arg;
  1579             this.arg = arg;
  1538         }
  1580         }
  1539         @Override
  1581         @Override
  1540         public void accept(Visitor v) { v.visitUnary(this); }
  1582         public void accept(Visitor v) { v.visitUnary(this); }
  1547         @Override
  1589         @Override
  1548         public <R,D> R accept(TreeVisitor<R,D> v, D d) {
  1590         public <R,D> R accept(TreeVisitor<R,D> v, D d) {
  1549             return v.visitUnary(this, d);
  1591             return v.visitUnary(this, d);
  1550         }
  1592         }
  1551         @Override
  1593         @Override
  1552         public int getTag() {
  1594         public Tag getTag() {
  1553             return opcode;
  1595             return opcode;
  1554         }
  1596         }
  1555 
  1597 
  1556         public void setTag(int tag) {
  1598         public void setTag(Tag tag) {
  1557             opcode = tag;
  1599             opcode = tag;
  1558         }
  1600         }
  1559     }
  1601     }
  1560 
  1602 
  1561     /**
  1603     /**
  1562      * A binary operation.
  1604      * A binary operation.
  1563      */
  1605      */
  1564     public static class JCBinary extends JCExpression implements BinaryTree {
  1606     public static class JCBinary extends JCExpression implements BinaryTree {
  1565         private int opcode;
  1607         private Tag opcode;
  1566         public JCExpression lhs;
  1608         public JCExpression lhs;
  1567         public JCExpression rhs;
  1609         public JCExpression rhs;
  1568         public Symbol operator;
  1610         public Symbol operator;
  1569         protected JCBinary(int opcode,
  1611         protected JCBinary(Tag opcode,
  1570                          JCExpression lhs,
  1612                          JCExpression lhs,
  1571                          JCExpression rhs,
  1613                          JCExpression rhs,
  1572                          Symbol operator) {
  1614                          Symbol operator) {
  1573             this.opcode = opcode;
  1615             this.opcode = opcode;
  1574             this.lhs = lhs;
  1616             this.lhs = lhs;
  1587         @Override
  1629         @Override
  1588         public <R,D> R accept(TreeVisitor<R,D> v, D d) {
  1630         public <R,D> R accept(TreeVisitor<R,D> v, D d) {
  1589             return v.visitBinary(this, d);
  1631             return v.visitBinary(this, d);
  1590         }
  1632         }
  1591         @Override
  1633         @Override
  1592         public int getTag() {
  1634         public Tag getTag() {
  1593             return opcode;
  1635             return opcode;
  1594         }
  1636         }
  1595     }
  1637     }
  1596 
  1638 
  1597     /**
  1639     /**
  1613         @Override
  1655         @Override
  1614         public <R,D> R accept(TreeVisitor<R,D> v, D d) {
  1656         public <R,D> R accept(TreeVisitor<R,D> v, D d) {
  1615             return v.visitTypeCast(this, d);
  1657             return v.visitTypeCast(this, d);
  1616         }
  1658         }
  1617         @Override
  1659         @Override
  1618         public int getTag() {
  1660         public Tag getTag() {
  1619             return TYPECAST;
  1661             return TYPECAST;
  1620         }
  1662         }
  1621     }
  1663     }
  1622 
  1664 
  1623     /**
  1665     /**
  1639         @Override
  1681         @Override
  1640         public <R,D> R accept(TreeVisitor<R,D> v, D d) {
  1682         public <R,D> R accept(TreeVisitor<R,D> v, D d) {
  1641             return v.visitInstanceOf(this, d);
  1683             return v.visitInstanceOf(this, d);
  1642         }
  1684         }
  1643         @Override
  1685         @Override
  1644         public int getTag() {
  1686         public Tag getTag() {
  1645             return TYPETEST;
  1687             return TYPETEST;
  1646         }
  1688         }
  1647     }
  1689     }
  1648 
  1690 
  1649     /**
  1691     /**
  1665         @Override
  1707         @Override
  1666         public <R,D> R accept(TreeVisitor<R,D> v, D d) {
  1708         public <R,D> R accept(TreeVisitor<R,D> v, D d) {
  1667             return v.visitArrayAccess(this, d);
  1709             return v.visitArrayAccess(this, d);
  1668         }
  1710         }
  1669         @Override
  1711         @Override
  1670         public int getTag() {
  1712         public Tag getTag() {
  1671             return INDEXED;
  1713             return INDEXED;
  1672         }
  1714         }
  1673     }
  1715     }
  1674 
  1716 
  1675     /**
  1717     /**
  1696         public <R,D> R accept(TreeVisitor<R,D> v, D d) {
  1738         public <R,D> R accept(TreeVisitor<R,D> v, D d) {
  1697             return v.visitMemberSelect(this, d);
  1739             return v.visitMemberSelect(this, d);
  1698         }
  1740         }
  1699         public Name getIdentifier() { return name; }
  1741         public Name getIdentifier() { return name; }
  1700         @Override
  1742         @Override
  1701         public int getTag() {
  1743         public Tag getTag() {
  1702             return SELECT;
  1744             return SELECT;
  1703         }
  1745         }
  1704     }
  1746     }
  1705 
  1747 
  1706     /**
  1748     /**
  1722         public Name getName() { return name; }
  1764         public Name getName() { return name; }
  1723         @Override
  1765         @Override
  1724         public <R,D> R accept(TreeVisitor<R,D> v, D d) {
  1766         public <R,D> R accept(TreeVisitor<R,D> v, D d) {
  1725             return v.visitIdentifier(this, d);
  1767             return v.visitIdentifier(this, d);
  1726         }
  1768         }
  1727         public int getTag() {
  1769         @Override
       
  1770         public Tag getTag() {
  1728             return IDENT;
  1771             return IDENT;
  1729         }
  1772         }
  1730     }
  1773     }
  1731 
  1774 
  1732     /**
  1775     /**
  1788         public JCLiteral setType(Type type) {
  1831         public JCLiteral setType(Type type) {
  1789             super.setType(type);
  1832             super.setType(type);
  1790             return this;
  1833             return this;
  1791         }
  1834         }
  1792         @Override
  1835         @Override
  1793         public int getTag() {
  1836         public Tag getTag() {
  1794             return LITERAL;
  1837             return LITERAL;
  1795         }
  1838         }
  1796     }
  1839     }
  1797 
  1840 
  1798     /**
  1841     /**
  1836         @Override
  1879         @Override
  1837         public <R,D> R accept(TreeVisitor<R,D> v, D d) {
  1880         public <R,D> R accept(TreeVisitor<R,D> v, D d) {
  1838             return v.visitPrimitiveType(this, d);
  1881             return v.visitPrimitiveType(this, d);
  1839         }
  1882         }
  1840         @Override
  1883         @Override
  1841         public int getTag() {
  1884         public Tag getTag() {
  1842             return TYPEIDENT;
  1885             return TYPEIDENT;
  1843         }
  1886         }
  1844     }
  1887     }
  1845 
  1888 
  1846     /**
  1889     /**
  1859         @Override
  1902         @Override
  1860         public <R,D> R accept(TreeVisitor<R,D> v, D d) {
  1903         public <R,D> R accept(TreeVisitor<R,D> v, D d) {
  1861             return v.visitArrayType(this, d);
  1904             return v.visitArrayType(this, d);
  1862         }
  1905         }
  1863         @Override
  1906         @Override
  1864         public int getTag() {
  1907         public Tag getTag() {
  1865             return TYPEARRAY;
  1908             return TYPEARRAY;
  1866         }
  1909         }
  1867     }
  1910     }
  1868 
  1911 
  1869     /**
  1912     /**
  1887         @Override
  1930         @Override
  1888         public <R,D> R accept(TreeVisitor<R,D> v, D d) {
  1931         public <R,D> R accept(TreeVisitor<R,D> v, D d) {
  1889             return v.visitParameterizedType(this, d);
  1932             return v.visitParameterizedType(this, d);
  1890         }
  1933         }
  1891         @Override
  1934         @Override
  1892         public int getTag() {
  1935         public Tag getTag() {
  1893             return TYPEAPPLY;
  1936             return TYPEAPPLY;
  1894         }
  1937         }
  1895     }
  1938     }
  1896 
  1939 
  1897     /**
  1940     /**
  1915         @Override
  1958         @Override
  1916         public <R,D> R accept(TreeVisitor<R,D> v, D d) {
  1959         public <R,D> R accept(TreeVisitor<R,D> v, D d) {
  1917             return v.visitUnionType(this, d);
  1960             return v.visitUnionType(this, d);
  1918         }
  1961         }
  1919         @Override
  1962         @Override
  1920         public int getTag() {
  1963         public Tag getTag() {
  1921             return TYPEUNION;
  1964             return TYPEUNION;
  1922         }
  1965         }
  1923     }
  1966     }
  1924 
  1967 
  1925     /**
  1968     /**
  1945         @Override
  1988         @Override
  1946         public <R,D> R accept(TreeVisitor<R,D> v, D d) {
  1989         public <R,D> R accept(TreeVisitor<R,D> v, D d) {
  1947             return v.visitTypeParameter(this, d);
  1990             return v.visitTypeParameter(this, d);
  1948         }
  1991         }
  1949         @Override
  1992         @Override
  1950         public int getTag() {
  1993         public Tag getTag() {
  1951             return TYPEPARAMETER;
  1994             return TYPEPARAMETER;
  1952         }
  1995         }
  1953     }
  1996     }
  1954 
  1997 
  1955     public static class JCWildcard extends JCExpression implements WildcardTree {
  1998     public static class JCWildcard extends JCExpression implements WildcardTree {
  1979         @Override
  2022         @Override
  1980         public <R,D> R accept(TreeVisitor<R,D> v, D d) {
  2023         public <R,D> R accept(TreeVisitor<R,D> v, D d) {
  1981             return v.visitWildcard(this, d);
  2024             return v.visitWildcard(this, d);
  1982         }
  2025         }
  1983         @Override
  2026         @Override
  1984         public int getTag() {
  2027         public Tag getTag() {
  1985             return WILDCARD;
  2028             return WILDCARD;
  1986         }
  2029         }
  1987     }
  2030     }
  1988 
  2031 
  1989     public static class TypeBoundKind extends JCTree {
  2032     public static class TypeBoundKind extends JCTree {
  2000         @Override
  2043         @Override
  2001         public <R,D> R accept(TreeVisitor<R,D> v, D d) {
  2044         public <R,D> R accept(TreeVisitor<R,D> v, D d) {
  2002             throw new AssertionError("TypeBoundKind is not part of a public API");
  2045             throw new AssertionError("TypeBoundKind is not part of a public API");
  2003         }
  2046         }
  2004         @Override
  2047         @Override
  2005         public int getTag() {
  2048         public Tag getTag() {
  2006             return TYPEBOUNDKIND;
  2049             return TYPEBOUNDKIND;
  2007         }
  2050         }
  2008     }
  2051     }
  2009 
  2052 
  2010     public static class JCAnnotation extends JCExpression implements AnnotationTree {
  2053     public static class JCAnnotation extends JCExpression implements AnnotationTree {
  2025         @Override
  2068         @Override
  2026         public <R,D> R accept(TreeVisitor<R,D> v, D d) {
  2069         public <R,D> R accept(TreeVisitor<R,D> v, D d) {
  2027             return v.visitAnnotation(this, d);
  2070             return v.visitAnnotation(this, d);
  2028         }
  2071         }
  2029         @Override
  2072         @Override
  2030         public int getTag() {
  2073         public Tag getTag() {
  2031             return ANNOTATION;
  2074             return ANNOTATION;
  2032         }
  2075         }
  2033     }
  2076     }
  2034 
  2077 
  2035     public static class JCModifiers extends JCTree implements com.sun.source.tree.ModifiersTree {
  2078     public static class JCModifiers extends JCTree implements com.sun.source.tree.ModifiersTree {
  2052         @Override
  2095         @Override
  2053         public <R,D> R accept(TreeVisitor<R,D> v, D d) {
  2096         public <R,D> R accept(TreeVisitor<R,D> v, D d) {
  2054             return v.visitModifiers(this, d);
  2097             return v.visitModifiers(this, d);
  2055         }
  2098         }
  2056         @Override
  2099         @Override
  2057         public int getTag() {
  2100         public Tag getTag() {
  2058             return MODIFIERS;
  2101             return MODIFIERS;
  2059         }
  2102         }
  2060     }
  2103     }
  2061 
  2104 
  2062     public static class JCErroneous extends JCExpression
  2105     public static class JCErroneous extends JCExpression
  2077         @Override
  2120         @Override
  2078         public <R,D> R accept(TreeVisitor<R,D> v, D d) {
  2121         public <R,D> R accept(TreeVisitor<R,D> v, D d) {
  2079             return v.visitErroneous(this, d);
  2122             return v.visitErroneous(this, d);
  2080         }
  2123         }
  2081         @Override
  2124         @Override
  2082         public int getTag() {
  2125         public Tag getTag() {
  2083             return ERRONEOUS;
  2126             return ERRONEOUS;
  2084         }
  2127         }
  2085     }
  2128     }
  2086 
  2129 
  2087     /** (let int x = 3; in x+2) */
  2130     /** (let int x = 3; in x+2) */
  2101         @Override
  2144         @Override
  2102         public <R,D> R accept(TreeVisitor<R,D> v, D d) {
  2145         public <R,D> R accept(TreeVisitor<R,D> v, D d) {
  2103             throw new AssertionError("LetExpr is not part of a public API");
  2146             throw new AssertionError("LetExpr is not part of a public API");
  2104         }
  2147         }
  2105         @Override
  2148         @Override
  2106         public int getTag() {
  2149         public Tag getTag() {
  2107             return LETEXPR;
  2150             return LETEXPR;
  2108         }
  2151         }
  2109     }
  2152     }
  2110 
  2153 
  2111     /** An interface for tree factories
  2154     /** An interface for tree factories
  2173         JCNewArray NewArray(JCExpression elemtype,
  2216         JCNewArray NewArray(JCExpression elemtype,
  2174                           List<JCExpression> dims,
  2217                           List<JCExpression> dims,
  2175                           List<JCExpression> elems);
  2218                           List<JCExpression> elems);
  2176         JCParens Parens(JCExpression expr);
  2219         JCParens Parens(JCExpression expr);
  2177         JCAssign Assign(JCExpression lhs, JCExpression rhs);
  2220         JCAssign Assign(JCExpression lhs, JCExpression rhs);
  2178         JCAssignOp Assignop(int opcode, JCTree lhs, JCTree rhs);
  2221         JCAssignOp Assignop(Tag opcode, JCTree lhs, JCTree rhs);
  2179         JCUnary Unary(int opcode, JCExpression arg);
  2222         JCUnary Unary(Tag opcode, JCExpression arg);
  2180         JCBinary Binary(int opcode, JCExpression lhs, JCExpression rhs);
  2223         JCBinary Binary(Tag opcode, JCExpression lhs, JCExpression rhs);
  2181         JCTypeCast TypeCast(JCTree expr, JCExpression type);
  2224         JCTypeCast TypeCast(JCTree expr, JCExpression type);
  2182         JCInstanceOf TypeTest(JCExpression expr, JCTree clazz);
  2225         JCInstanceOf TypeTest(JCExpression expr, JCTree clazz);
  2183         JCArrayAccess Indexed(JCExpression indexed, JCExpression index);
  2226         JCArrayAccess Indexed(JCExpression indexed, JCExpression index);
  2184         JCFieldAccess Select(JCExpression selected, Name selector);
  2227         JCFieldAccess Select(JCExpression selected, Name selector);
  2185         JCIdent Ident(Name idname);
  2228         JCIdent Ident(Name idname);