src/share/classes/com/sun/tools/javac/tree/JCTree.java

Mon, 10 Jan 2011 15:08:31 -0800

author
jjg
date
Mon, 10 Jan 2011 15:08:31 -0800
changeset 816
7c537f4298fb
parent 815
d17f37522154
child 837
73ab0b128918
permissions
-rw-r--r--

6396503: javac should not require assertions enabled
Reviewed-by: mcimadamore

     1 /*
     2  * Copyright (c) 1999, 2011, 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  */
    26 package com.sun.tools.javac.tree;
    28 import java.util.*;
    30 import java.io.IOException;
    31 import java.io.StringWriter;
    32 import javax.lang.model.element.Modifier;
    33 import javax.lang.model.type.TypeKind;
    34 import javax.tools.JavaFileObject;
    36 import com.sun.tools.javac.util.*;
    37 import com.sun.tools.javac.util.JCDiagnostic.DiagnosticPosition;
    38 import com.sun.tools.javac.util.List;
    39 import com.sun.tools.javac.code.*;
    40 import com.sun.tools.javac.code.Scope.*;
    41 import com.sun.tools.javac.code.Symbol.*;
    42 import com.sun.source.tree.*;
    44 import static com.sun.tools.javac.code.BoundKind.*;
    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  */
    79 public abstract class JCTree implements Tree, Cloneable, DiagnosticPosition {
    81     /* Tree tag values, identifying kinds of trees */
    83     /** Toplevel nodes, of type TopLevel, representing entire source files.
    84      */
    85     public static final int  TOPLEVEL = 1;
    87     /** Import clauses, of type Import.
    88      */
    89     public static final int IMPORT = TOPLEVEL + 1;
    91     /** Class definitions, of type ClassDef.
    92      */
    93     public static final int CLASSDEF = IMPORT + 1;
    95     /** Method definitions, of type MethodDef.
    96      */
    97     public static final int METHODDEF = CLASSDEF + 1;
    99     /** Variable definitions, of type VarDef.
   100      */
   101     public static final int VARDEF = METHODDEF + 1;
   103     /** The no-op statement ";", of type Skip
   104      */
   105     public static final int SKIP = VARDEF + 1;
   107     /** Blocks, of type Block.
   108      */
   109     public static final int BLOCK = SKIP + 1;
   111     /** Do-while loops, of type DoLoop.
   112      */
   113     public static final int DOLOOP = BLOCK + 1;
   115     /** While-loops, of type WhileLoop.
   116      */
   117     public static final int WHILELOOP = DOLOOP + 1;
   119     /** For-loops, of type ForLoop.
   120      */
   121     public static final int FORLOOP = WHILELOOP + 1;
   123     /** Foreach-loops, of type ForeachLoop.
   124      */
   125     public static final int FOREACHLOOP = FORLOOP + 1;
   127     /** Labelled statements, of type Labelled.
   128      */
   129     public static final int LABELLED = FOREACHLOOP + 1;
   131     /** Switch statements, of type Switch.
   132      */
   133     public static final int SWITCH = LABELLED + 1;
   135     /** Case parts in switch statements, of type Case.
   136      */
   137     public static final int CASE = SWITCH + 1;
   139     /** Synchronized statements, of type Synchonized.
   140      */
   141     public static final int SYNCHRONIZED = CASE + 1;
   143     /** Try statements, of type Try.
   144      */
   145     public static final int TRY = SYNCHRONIZED + 1;
   147     /** Catch clauses in try statements, of type Catch.
   148      */
   149     public static final int CATCH = TRY + 1;
   151     /** Conditional expressions, of type Conditional.
   152      */
   153     public static final int CONDEXPR = CATCH + 1;
   155     /** Conditional statements, of type If.
   156      */
   157     public static final int IF = CONDEXPR + 1;
   159     /** Expression statements, of type Exec.
   160      */
   161     public static final int EXEC = IF + 1;
   163     /** Break statements, of type Break.
   164      */
   165     public static final int BREAK = EXEC + 1;
   167     /** Continue statements, of type Continue.
   168      */
   169     public static final int CONTINUE = BREAK + 1;
   171     /** Return statements, of type Return.
   172      */
   173     public static final int RETURN = CONTINUE + 1;
   175     /** Throw statements, of type Throw.
   176      */
   177     public static final int THROW = RETURN + 1;
   179     /** Assert statements, of type Assert.
   180      */
   181     public static final int ASSERT = THROW + 1;
   183     /** Method invocation expressions, of type Apply.
   184      */
   185     public static final int APPLY = ASSERT + 1;
   187     /** Class instance creation expressions, of type NewClass.
   188      */
   189     public static final int NEWCLASS = APPLY + 1;
   191     /** Array creation expressions, of type NewArray.
   192      */
   193     public static final int NEWARRAY = NEWCLASS + 1;
   195     /** Parenthesized subexpressions, of type Parens.
   196      */
   197     public static final int PARENS = NEWARRAY + 1;
   199     /** Assignment expressions, of type Assign.
   200      */
   201     public static final int ASSIGN = PARENS + 1;
   203     /** Type cast expressions, of type TypeCast.
   204      */
   205     public static final int TYPECAST = ASSIGN + 1;
   207     /** Type test expressions, of type TypeTest.
   208      */
   209     public static final int TYPETEST = TYPECAST + 1;
   211     /** Indexed array expressions, of type Indexed.
   212      */
   213     public static final int INDEXED = TYPETEST + 1;
   215     /** Selections, of type Select.
   216      */
   217     public static final int SELECT = INDEXED + 1;
   219     /** Simple identifiers, of type Ident.
   220      */
   221     public static final int IDENT = SELECT + 1;
   223     /** Literals, of type Literal.
   224      */
   225     public static final int LITERAL = IDENT + 1;
   227     /** Basic type identifiers, of type TypeIdent.
   228      */
   229     public static final int TYPEIDENT = LITERAL + 1;
   231     /** Array types, of type TypeArray.
   232      */
   233     public static final int TYPEARRAY = TYPEIDENT + 1;
   235     /** Parameterized types, of type TypeApply.
   236      */
   237     public static final int TYPEAPPLY = TYPEARRAY + 1;
   239     /** Disjunction types, of type TypeDisjunction
   240      */
   241     public static final int TYPEDISJUNCTION = TYPEAPPLY + 1;
   243     /** Formal type parameters, of type TypeParameter.
   244      */
   245     public static final int TYPEPARAMETER = TYPEDISJUNCTION + 1;
   247     /** Type argument.
   248      */
   249     public static final int WILDCARD = TYPEPARAMETER + 1;
   251     /** Bound kind: extends, super, exact, or unbound
   252      */
   253     public static final int TYPEBOUNDKIND = WILDCARD + 1;
   255     /** metadata: Annotation.
   256      */
   257     public static final int ANNOTATION = TYPEBOUNDKIND + 1;
   259     /** metadata: Modifiers
   260      */
   261     public static final int MODIFIERS = ANNOTATION + 1;
   263     public static final int ANNOTATED_TYPE = MODIFIERS + 1;
   265     /** Error trees, of type Erroneous.
   266      */
   267     public static final int ERRONEOUS = ANNOTATED_TYPE + 1;
   269     /** Unary operators, of type Unary.
   270      */
   271     public static final int POS = ERRONEOUS + 1;             // +
   272     public static final int NEG = POS + 1;                   // -
   273     public static final int NOT = NEG + 1;                   // !
   274     public static final int COMPL = NOT + 1;                 // ~
   275     public static final int PREINC = COMPL + 1;              // ++ _
   276     public static final int PREDEC = PREINC + 1;             // -- _
   277     public static final int POSTINC = PREDEC + 1;            // _ ++
   278     public static final int POSTDEC = POSTINC + 1;           // _ --
   280     /** unary operator for null reference checks, only used internally.
   281      */
   282     public static final int NULLCHK = POSTDEC + 1;
   284     /** Binary operators, of type Binary.
   285      */
   286     public static final int OR = NULLCHK + 1;                // ||
   287     public static final int AND = OR + 1;                    // &&
   288     public static final int BITOR = AND + 1;                 // |
   289     public static final int BITXOR = BITOR + 1;              // ^
   290     public static final int BITAND = BITXOR + 1;             // &
   291     public static final int EQ = BITAND + 1;                 // ==
   292     public static final int NE = EQ + 1;                     // !=
   293     public static final int LT = NE + 1;                     // <
   294     public static final int GT = LT + 1;                     // >
   295     public static final int LE = GT + 1;                     // <=
   296     public static final int GE = LE + 1;                     // >=
   297     public static final int SL = GE + 1;                     // <<
   298     public static final int SR = SL + 1;                     // >>
   299     public static final int USR = SR + 1;                    // >>>
   300     public static final int PLUS = USR + 1;                  // +
   301     public static final int MINUS = PLUS + 1;                // -
   302     public static final int MUL = MINUS + 1;                 // *
   303     public static final int DIV = MUL + 1;                   // /
   304     public static final int MOD = DIV + 1;                   // %
   306     /** Assignment operators, of type Assignop.
   307      */
   308     public static final int BITOR_ASG = MOD + 1;             // |=
   309     public static final int BITXOR_ASG = BITOR_ASG + 1;      // ^=
   310     public static final int BITAND_ASG = BITXOR_ASG + 1;     // &=
   312     public static final int SL_ASG = SL + BITOR_ASG - BITOR; // <<=
   313     public static final int SR_ASG = SL_ASG + 1;             // >>=
   314     public static final int USR_ASG = SR_ASG + 1;            // >>>=
   315     public static final int PLUS_ASG = USR_ASG + 1;          // +=
   316     public static final int MINUS_ASG = PLUS_ASG + 1;        // -=
   317     public static final int MUL_ASG = MINUS_ASG + 1;         // *=
   318     public static final int DIV_ASG = MUL_ASG + 1;           // /=
   319     public static final int MOD_ASG = DIV_ASG + 1;           // %=
   321     /** A synthetic let expression, of type LetExpr.
   322      */
   323     public static final int LETEXPR = MOD_ASG + 1;           // ala scheme
   326     /** The offset between assignment operators and normal operators.
   327      */
   328     public static final int ASGOffset = BITOR_ASG - BITOR;
   330     /* The (encoded) position in the source file. @see util.Position.
   331      */
   332     public int pos;
   334     /* The type of this node.
   335      */
   336     public Type type;
   338     /* The tag of this node -- one of the constants declared above.
   339      */
   340     public abstract int getTag();
   342     /** Convert a tree to a pretty-printed string. */
   343     @Override
   344     public String toString() {
   345         StringWriter s = new StringWriter();
   346         try {
   347             new Pretty(s, false).printExpr(this);
   348         }
   349         catch (IOException e) {
   350             // should never happen, because StringWriter is defined
   351             // never to throw any IOExceptions
   352             throw new AssertionError(e);
   353         }
   354         return s.toString();
   355     }
   357     /** Set position field and return this tree.
   358      */
   359     public JCTree setPos(int pos) {
   360         this.pos = pos;
   361         return this;
   362     }
   364     /** Set type field and return this tree.
   365      */
   366     public JCTree setType(Type type) {
   367         this.type = type;
   368         return this;
   369     }
   371     /** Visit this tree with a given visitor.
   372      */
   373     public abstract void accept(Visitor v);
   375     public abstract <R,D> R accept(TreeVisitor<R,D> v, D d);
   377     /** Return a shallow copy of this tree.
   378      */
   379     @Override
   380     public Object clone() {
   381         try {
   382             return super.clone();
   383         } catch(CloneNotSupportedException e) {
   384             throw new RuntimeException(e);
   385         }
   386     }
   388     /** Get a default position for this tree node.
   389      */
   390     public DiagnosticPosition pos() {
   391         return this;
   392     }
   394     // for default DiagnosticPosition
   395     public JCTree getTree() {
   396         return this;
   397     }
   399     // for default DiagnosticPosition
   400     public int getStartPosition() {
   401         return TreeInfo.getStartPos(this);
   402     }
   404     // for default DiagnosticPosition
   405     public int getPreferredPosition() {
   406         return pos;
   407     }
   409     // for default DiagnosticPosition
   410     public int getEndPosition(Map<JCTree, Integer> endPosTable) {
   411         return TreeInfo.getEndPos(this, endPosTable);
   412     }
   414     /**
   415      * Everything in one source file is kept in a TopLevel structure.
   416      * @param pid              The tree representing the package clause.
   417      * @param sourcefile       The source file name.
   418      * @param defs             All definitions in this file (ClassDef, Import, and Skip)
   419      * @param packge           The package it belongs to.
   420      * @param namedImportScope A scope for all named imports.
   421      * @param starImportScope  A scope for all import-on-demands.
   422      * @param lineMap          Line starting positions, defined only
   423      *                         if option -g is set.
   424      * @param docComments      A hashtable that stores all documentation comments
   425      *                         indexed by the tree nodes they refer to.
   426      *                         defined only if option -s is set.
   427      * @param endPositions     A hashtable that stores ending positions of source
   428      *                         ranges indexed by the tree nodes they belong to.
   429      *                         Defined only if option -Xjcov is set.
   430      */
   431     public static class JCCompilationUnit extends JCTree implements CompilationUnitTree {
   432         public List<JCAnnotation> packageAnnotations;
   433         public JCExpression pid;
   434         public List<JCTree> defs;
   435         public JavaFileObject sourcefile;
   436         public PackageSymbol packge;
   437         public ImportScope namedImportScope;
   438         public StarImportScope starImportScope;
   439         public long flags;
   440         public Position.LineMap lineMap = null;
   441         public Map<JCTree, String> docComments = null;
   442         public Map<JCTree, Integer> endPositions = null;
   443         protected JCCompilationUnit(List<JCAnnotation> packageAnnotations,
   444                         JCExpression pid,
   445                         List<JCTree> defs,
   446                         JavaFileObject sourcefile,
   447                         PackageSymbol packge,
   448                         ImportScope namedImportScope,
   449                         StarImportScope starImportScope) {
   450             this.packageAnnotations = packageAnnotations;
   451             this.pid = pid;
   452             this.defs = defs;
   453             this.sourcefile = sourcefile;
   454             this.packge = packge;
   455             this.namedImportScope = namedImportScope;
   456             this.starImportScope = starImportScope;
   457         }
   458         @Override
   459         public void accept(Visitor v) { v.visitTopLevel(this); }
   461         public Kind getKind() { return Kind.COMPILATION_UNIT; }
   462         public List<JCAnnotation> getPackageAnnotations() {
   463             return packageAnnotations;
   464         }
   465         public List<JCImport> getImports() {
   466             ListBuffer<JCImport> imports = new ListBuffer<JCImport>();
   467             for (JCTree tree : defs) {
   468                 if (tree.getTag() == IMPORT)
   469                     imports.append((JCImport)tree);
   470                 else
   471                     break;
   472             }
   473             return imports.toList();
   474         }
   475         public JCExpression getPackageName() { return pid; }
   476         public JavaFileObject getSourceFile() {
   477             return sourcefile;
   478         }
   479         public Position.LineMap getLineMap() {
   480             return lineMap;
   481         }
   482         public List<JCTree> getTypeDecls() {
   483             List<JCTree> typeDefs;
   484             for (typeDefs = defs; !typeDefs.isEmpty(); typeDefs = typeDefs.tail)
   485                 if (typeDefs.head.getTag() != IMPORT)
   486                     break;
   487             return typeDefs;
   488         }
   489         @Override
   490         public <R,D> R accept(TreeVisitor<R,D> v, D d) {
   491             return v.visitCompilationUnit(this, d);
   492         }
   494         @Override
   495         public int getTag() {
   496             return TOPLEVEL;
   497         }
   498     }
   500     /**
   501      * An import clause.
   502      * @param qualid    The imported class(es).
   503      */
   504     public static class JCImport extends JCTree implements ImportTree {
   505         public boolean staticImport;
   506         public JCTree qualid;
   507         protected JCImport(JCTree qualid, boolean importStatic) {
   508             this.qualid = qualid;
   509             this.staticImport = importStatic;
   510         }
   511         @Override
   512         public void accept(Visitor v) { v.visitImport(this); }
   514         public boolean isStatic() { return staticImport; }
   515         public JCTree getQualifiedIdentifier() { return qualid; }
   517         public Kind getKind() { return Kind.IMPORT; }
   518         @Override
   519         public <R,D> R accept(TreeVisitor<R,D> v, D d) {
   520             return v.visitImport(this, d);
   521         }
   523         @Override
   524         public int getTag() {
   525             return IMPORT;
   526         }
   527     }
   529     public static abstract class JCStatement extends JCTree implements StatementTree {
   530         @Override
   531         public JCStatement setType(Type type) {
   532             super.setType(type);
   533             return this;
   534         }
   535         @Override
   536         public JCStatement setPos(int pos) {
   537             super.setPos(pos);
   538             return this;
   539         }
   540     }
   542     public static abstract class JCExpression extends JCTree implements ExpressionTree {
   543         @Override
   544         public JCExpression setType(Type type) {
   545             super.setType(type);
   546             return this;
   547         }
   548         @Override
   549         public JCExpression setPos(int pos) {
   550             super.setPos(pos);
   551             return this;
   552         }
   553     }
   555     /**
   556      * A class definition.
   557      * @param modifiers the modifiers
   558      * @param name the name of the class
   559      * @param typarams formal class parameters
   560      * @param extending the classes this class extends
   561      * @param implementing the interfaces implemented by this class
   562      * @param defs all variables and methods defined in this class
   563      * @param sym the symbol
   564      */
   565     public static class JCClassDecl extends JCStatement implements ClassTree {
   566         public JCModifiers mods;
   567         public Name name;
   568         public List<JCTypeParameter> typarams;
   569         public JCTree extending;
   570         public List<JCExpression> implementing;
   571         public List<JCTree> defs;
   572         public ClassSymbol sym;
   573         protected JCClassDecl(JCModifiers mods,
   574                            Name name,
   575                            List<JCTypeParameter> typarams,
   576                            JCTree extending,
   577                            List<JCExpression> implementing,
   578                            List<JCTree> defs,
   579                            ClassSymbol sym)
   580         {
   581             this.mods = mods;
   582             this.name = name;
   583             this.typarams = typarams;
   584             this.extending = extending;
   585             this.implementing = implementing;
   586             this.defs = defs;
   587             this.sym = sym;
   588         }
   589         @Override
   590         public void accept(Visitor v) { v.visitClassDef(this); }
   592         public Kind getKind() {
   593             if ((mods.flags & Flags.ANNOTATION) != 0)
   594                 return Kind.ANNOTATION_TYPE;
   595             else if ((mods.flags & Flags.INTERFACE) != 0)
   596                 return Kind.INTERFACE;
   597             else if ((mods.flags & Flags.ENUM) != 0)
   598                 return Kind.ENUM;
   599             else
   600                 return Kind.CLASS;
   601         }
   603         public JCModifiers getModifiers() { return mods; }
   604         public Name getSimpleName() { return name; }
   605         public List<JCTypeParameter> getTypeParameters() {
   606             return typarams;
   607         }
   608         public JCTree getExtendsClause() { return extending; }
   609         public List<JCExpression> getImplementsClause() {
   610             return implementing;
   611         }
   612         public List<JCTree> getMembers() {
   613             return defs;
   614         }
   615         @Override
   616         public <R,D> R accept(TreeVisitor<R,D> v, D d) {
   617             return v.visitClass(this, d);
   618         }
   620         @Override
   621         public int getTag() {
   622             return CLASSDEF;
   623         }
   624     }
   626     /**
   627      * A method definition.
   628      * @param modifiers method modifiers
   629      * @param name method name
   630      * @param restype type of method return value
   631      * @param typarams type parameters
   632      * @param params value parameters
   633      * @param thrown exceptions thrown by this method
   634      * @param stats statements in the method
   635      * @param sym method symbol
   636      */
   637     public static class JCMethodDecl extends JCTree implements MethodTree {
   638         public JCModifiers mods;
   639         public Name name;
   640         public JCExpression restype;
   641         public List<JCTypeParameter> typarams;
   642         public List<JCVariableDecl> params;
   643         public List<JCExpression> thrown;
   644         public JCBlock body;
   645         public JCExpression defaultValue; // for annotation types
   646         public MethodSymbol sym;
   647         protected JCMethodDecl(JCModifiers mods,
   648                             Name name,
   649                             JCExpression restype,
   650                             List<JCTypeParameter> typarams,
   651                             List<JCVariableDecl> params,
   652                             List<JCExpression> thrown,
   653                             JCBlock body,
   654                             JCExpression defaultValue,
   655                             MethodSymbol sym)
   656         {
   657             this.mods = mods;
   658             this.name = name;
   659             this.restype = restype;
   660             this.typarams = typarams;
   661             this.params = params;
   662             this.thrown = thrown;
   663             this.body = body;
   664             this.defaultValue = defaultValue;
   665             this.sym = sym;
   666         }
   667         @Override
   668         public void accept(Visitor v) { v.visitMethodDef(this); }
   670         public Kind getKind() { return Kind.METHOD; }
   671         public JCModifiers getModifiers() { return mods; }
   672         public Name getName() { return name; }
   673         public JCTree getReturnType() { return restype; }
   674         public List<JCTypeParameter> getTypeParameters() {
   675             return typarams;
   676         }
   677         public List<JCVariableDecl> getParameters() {
   678             return params;
   679         }
   680         public List<JCExpression> getThrows() {
   681             return thrown;
   682         }
   683         public JCBlock getBody() { return body; }
   684         public JCTree getDefaultValue() { // for annotation types
   685             return defaultValue;
   686         }
   687         @Override
   688         public <R,D> R accept(TreeVisitor<R,D> v, D d) {
   689             return v.visitMethod(this, d);
   690         }
   692         @Override
   693         public int getTag() {
   694             return METHODDEF;
   695         }
   696   }
   698     /**
   699      * A variable definition.
   700      * @param modifiers variable modifiers
   701      * @param name variable name
   702      * @param vartype type of the variable
   703      * @param init variables initial value
   704      * @param sym symbol
   705      */
   706     public static class JCVariableDecl extends JCStatement implements VariableTree {
   707         public JCModifiers mods;
   708         public Name name;
   709         public JCExpression vartype;
   710         public JCExpression init;
   711         public VarSymbol sym;
   712         protected JCVariableDecl(JCModifiers mods,
   713                          Name name,
   714                          JCExpression vartype,
   715                          JCExpression init,
   716                          VarSymbol sym) {
   717             this.mods = mods;
   718             this.name = name;
   719             this.vartype = vartype;
   720             this.init = init;
   721             this.sym = sym;
   722         }
   723         @Override
   724         public void accept(Visitor v) { v.visitVarDef(this); }
   726         public Kind getKind() { return Kind.VARIABLE; }
   727         public JCModifiers getModifiers() { return mods; }
   728         public Name getName() { return name; }
   729         public JCTree getType() { return vartype; }
   730         public JCExpression getInitializer() {
   731             return init;
   732         }
   733         @Override
   734         public <R,D> R accept(TreeVisitor<R,D> v, D d) {
   735             return v.visitVariable(this, d);
   736         }
   738         @Override
   739         public int getTag() {
   740             return VARDEF;
   741         }
   742     }
   744       /**
   745      * A no-op statement ";".
   746      */
   747     public static class JCSkip extends JCStatement implements EmptyStatementTree {
   748         protected JCSkip() {
   749         }
   750         @Override
   751         public void accept(Visitor v) { v.visitSkip(this); }
   753         public Kind getKind() { return Kind.EMPTY_STATEMENT; }
   754         @Override
   755         public <R,D> R accept(TreeVisitor<R,D> v, D d) {
   756             return v.visitEmptyStatement(this, d);
   757         }
   759         @Override
   760         public int getTag() {
   761             return SKIP;
   762         }
   763     }
   765     /**
   766      * A statement block.
   767      * @param stats statements
   768      * @param flags flags
   769      */
   770     public static class JCBlock extends JCStatement implements BlockTree {
   771         public long flags;
   772         public List<JCStatement> stats;
   773         /** Position of closing brace, optional. */
   774         public int endpos = Position.NOPOS;
   775         protected JCBlock(long flags, List<JCStatement> stats) {
   776             this.stats = stats;
   777             this.flags = flags;
   778         }
   779         @Override
   780         public void accept(Visitor v) { v.visitBlock(this); }
   782         public Kind getKind() { return Kind.BLOCK; }
   783         public List<JCStatement> getStatements() {
   784             return stats;
   785         }
   786         public boolean isStatic() { return (flags & Flags.STATIC) != 0; }
   787         @Override
   788         public <R,D> R accept(TreeVisitor<R,D> v, D d) {
   789             return v.visitBlock(this, d);
   790         }
   792         @Override
   793         public int getTag() {
   794             return BLOCK;
   795         }
   796     }
   798     /**
   799      * A do loop
   800      */
   801     public static class JCDoWhileLoop extends JCStatement implements DoWhileLoopTree {
   802         public JCStatement body;
   803         public JCExpression cond;
   804         protected JCDoWhileLoop(JCStatement body, JCExpression cond) {
   805             this.body = body;
   806             this.cond = cond;
   807         }
   808         @Override
   809         public void accept(Visitor v) { v.visitDoLoop(this); }
   811         public Kind getKind() { return Kind.DO_WHILE_LOOP; }
   812         public JCExpression getCondition() { return cond; }
   813         public JCStatement getStatement() { return body; }
   814         @Override
   815         public <R,D> R accept(TreeVisitor<R,D> v, D d) {
   816             return v.visitDoWhileLoop(this, d);
   817         }
   819         @Override
   820         public int getTag() {
   821             return DOLOOP;
   822         }
   823     }
   825     /**
   826      * A while loop
   827      */
   828     public static class JCWhileLoop extends JCStatement implements WhileLoopTree {
   829         public JCExpression cond;
   830         public JCStatement body;
   831         protected JCWhileLoop(JCExpression cond, JCStatement body) {
   832             this.cond = cond;
   833             this.body = body;
   834         }
   835         @Override
   836         public void accept(Visitor v) { v.visitWhileLoop(this); }
   838         public Kind getKind() { return Kind.WHILE_LOOP; }
   839         public JCExpression getCondition() { return cond; }
   840         public JCStatement getStatement() { return body; }
   841         @Override
   842         public <R,D> R accept(TreeVisitor<R,D> v, D d) {
   843             return v.visitWhileLoop(this, d);
   844         }
   846         @Override
   847         public int getTag() {
   848             return WHILELOOP;
   849         }
   850     }
   852     /**
   853      * A for loop.
   854      */
   855     public static class JCForLoop extends JCStatement implements ForLoopTree {
   856         public List<JCStatement> init;
   857         public JCExpression cond;
   858         public List<JCExpressionStatement> step;
   859         public JCStatement body;
   860         protected JCForLoop(List<JCStatement> init,
   861                           JCExpression cond,
   862                           List<JCExpressionStatement> update,
   863                           JCStatement body)
   864         {
   865             this.init = init;
   866             this.cond = cond;
   867             this.step = update;
   868             this.body = body;
   869         }
   870         @Override
   871         public void accept(Visitor v) { v.visitForLoop(this); }
   873         public Kind getKind() { return Kind.FOR_LOOP; }
   874         public JCExpression getCondition() { return cond; }
   875         public JCStatement getStatement() { return body; }
   876         public List<JCStatement> getInitializer() {
   877             return init;
   878         }
   879         public List<JCExpressionStatement> getUpdate() {
   880             return step;
   881         }
   882         @Override
   883         public <R,D> R accept(TreeVisitor<R,D> v, D d) {
   884             return v.visitForLoop(this, d);
   885         }
   887         @Override
   888         public int getTag() {
   889             return FORLOOP;
   890         }
   891     }
   893     /**
   894      * The enhanced for loop.
   895      */
   896     public static class JCEnhancedForLoop extends JCStatement implements EnhancedForLoopTree {
   897         public JCVariableDecl var;
   898         public JCExpression expr;
   899         public JCStatement body;
   900         protected JCEnhancedForLoop(JCVariableDecl var, JCExpression expr, JCStatement body) {
   901             this.var = var;
   902             this.expr = expr;
   903             this.body = body;
   904         }
   905         @Override
   906         public void accept(Visitor v) { v.visitForeachLoop(this); }
   908         public Kind getKind() { return Kind.ENHANCED_FOR_LOOP; }
   909         public JCVariableDecl getVariable() { return var; }
   910         public JCExpression getExpression() { return expr; }
   911         public JCStatement getStatement() { return body; }
   912         @Override
   913         public <R,D> R accept(TreeVisitor<R,D> v, D d) {
   914             return v.visitEnhancedForLoop(this, d);
   915         }
   916         @Override
   917         public int getTag() {
   918             return FOREACHLOOP;
   919         }
   920     }
   922     /**
   923      * A labelled expression or statement.
   924      */
   925     public static class JCLabeledStatement extends JCStatement implements LabeledStatementTree {
   926         public Name label;
   927         public JCStatement body;
   928         protected JCLabeledStatement(Name label, JCStatement body) {
   929             this.label = label;
   930             this.body = body;
   931         }
   932         @Override
   933         public void accept(Visitor v) { v.visitLabelled(this); }
   934         public Kind getKind() { return Kind.LABELED_STATEMENT; }
   935         public Name getLabel() { return label; }
   936         public JCStatement getStatement() { return body; }
   937         @Override
   938         public <R,D> R accept(TreeVisitor<R,D> v, D d) {
   939             return v.visitLabeledStatement(this, d);
   940         }
   941         @Override
   942         public int getTag() {
   943             return LABELLED;
   944         }
   945     }
   947     /**
   948      * A "switch ( ) { }" construction.
   949      */
   950     public static class JCSwitch extends JCStatement implements SwitchTree {
   951         public JCExpression selector;
   952         public List<JCCase> cases;
   953         protected JCSwitch(JCExpression selector, List<JCCase> cases) {
   954             this.selector = selector;
   955             this.cases = cases;
   956         }
   957         @Override
   958         public void accept(Visitor v) { v.visitSwitch(this); }
   960         public Kind getKind() { return Kind.SWITCH; }
   961         public JCExpression getExpression() { return selector; }
   962         public List<JCCase> getCases() { return cases; }
   963         @Override
   964         public <R,D> R accept(TreeVisitor<R,D> v, D d) {
   965             return v.visitSwitch(this, d);
   966         }
   967         @Override
   968         public int getTag() {
   969             return SWITCH;
   970         }
   971     }
   973     /**
   974      * A "case  :" of a switch.
   975      */
   976     public static class JCCase extends JCStatement implements CaseTree {
   977         public JCExpression pat;
   978         public List<JCStatement> stats;
   979         protected JCCase(JCExpression pat, List<JCStatement> stats) {
   980             this.pat = pat;
   981             this.stats = stats;
   982         }
   983         @Override
   984         public void accept(Visitor v) { v.visitCase(this); }
   986         public Kind getKind() { return Kind.CASE; }
   987         public JCExpression getExpression() { return pat; }
   988         public List<JCStatement> getStatements() { return stats; }
   989         @Override
   990         public <R,D> R accept(TreeVisitor<R,D> v, D d) {
   991             return v.visitCase(this, d);
   992         }
   993         @Override
   994         public int getTag() {
   995             return CASE;
   996         }
   997     }
   999     /**
  1000      * A synchronized block.
  1001      */
  1002     public static class JCSynchronized extends JCStatement implements SynchronizedTree {
  1003         public JCExpression lock;
  1004         public JCBlock body;
  1005         protected JCSynchronized(JCExpression lock, JCBlock body) {
  1006             this.lock = lock;
  1007             this.body = body;
  1009         @Override
  1010         public void accept(Visitor v) { v.visitSynchronized(this); }
  1012         public Kind getKind() { return Kind.SYNCHRONIZED; }
  1013         public JCExpression getExpression() { return lock; }
  1014         public JCBlock getBlock() { return body; }
  1015         @Override
  1016         public <R,D> R accept(TreeVisitor<R,D> v, D d) {
  1017             return v.visitSynchronized(this, d);
  1019         @Override
  1020         public int getTag() {
  1021             return SYNCHRONIZED;
  1025     /**
  1026      * A "try { } catch ( ) { } finally { }" block.
  1027      */
  1028     public static class JCTry extends JCStatement implements TryTree {
  1029         public JCBlock body;
  1030         public List<JCCatch> catchers;
  1031         public JCBlock finalizer;
  1032         public List<JCTree> resources;
  1033         protected JCTry(List<JCTree> resources,
  1034                         JCBlock body,
  1035                         List<JCCatch> catchers,
  1036                         JCBlock finalizer) {
  1037             this.body = body;
  1038             this.catchers = catchers;
  1039             this.finalizer = finalizer;
  1040             this.resources = resources;
  1042         @Override
  1043         public void accept(Visitor v) { v.visitTry(this); }
  1045         public Kind getKind() { return Kind.TRY; }
  1046         public JCBlock getBlock() { return body; }
  1047         public List<JCCatch> getCatches() {
  1048             return catchers;
  1050         public JCBlock getFinallyBlock() { return finalizer; }
  1051         @Override
  1052         public <R,D> R accept(TreeVisitor<R,D> v, D d) {
  1053             return v.visitTry(this, d);
  1055         @Override
  1056         public List<? extends JCTree> getResources() {
  1057             return resources;
  1059         @Override
  1060         public int getTag() {
  1061             return TRY;
  1065     /**
  1066      * A catch block.
  1067      */
  1068     public static class JCCatch extends JCTree implements CatchTree {
  1069         public JCVariableDecl param;
  1070         public JCBlock body;
  1071         protected JCCatch(JCVariableDecl param, JCBlock body) {
  1072             this.param = param;
  1073             this.body = body;
  1075         @Override
  1076         public void accept(Visitor v) { v.visitCatch(this); }
  1078         public Kind getKind() { return Kind.CATCH; }
  1079         public JCVariableDecl getParameter() { return param; }
  1080         public JCBlock getBlock() { return body; }
  1081         @Override
  1082         public <R,D> R accept(TreeVisitor<R,D> v, D d) {
  1083             return v.visitCatch(this, d);
  1085         @Override
  1086         public int getTag() {
  1087             return CATCH;
  1091     /**
  1092      * A ( ) ? ( ) : ( ) conditional expression
  1093      */
  1094     public static class JCConditional extends JCExpression implements ConditionalExpressionTree {
  1095         public JCExpression cond;
  1096         public JCExpression truepart;
  1097         public JCExpression falsepart;
  1098         protected JCConditional(JCExpression cond,
  1099                               JCExpression truepart,
  1100                               JCExpression falsepart)
  1102             this.cond = cond;
  1103             this.truepart = truepart;
  1104             this.falsepart = falsepart;
  1106         @Override
  1107         public void accept(Visitor v) { v.visitConditional(this); }
  1109         public Kind getKind() { return Kind.CONDITIONAL_EXPRESSION; }
  1110         public JCExpression getCondition() { return cond; }
  1111         public JCExpression getTrueExpression() { return truepart; }
  1112         public JCExpression getFalseExpression() { return falsepart; }
  1113         @Override
  1114         public <R,D> R accept(TreeVisitor<R,D> v, D d) {
  1115             return v.visitConditionalExpression(this, d);
  1117         @Override
  1118         public int getTag() {
  1119             return CONDEXPR;
  1123     /**
  1124      * An "if ( ) { } else { }" block
  1125      */
  1126     public static class JCIf extends JCStatement implements IfTree {
  1127         public JCExpression cond;
  1128         public JCStatement thenpart;
  1129         public JCStatement elsepart;
  1130         protected JCIf(JCExpression cond,
  1131                      JCStatement thenpart,
  1132                      JCStatement elsepart)
  1134             this.cond = cond;
  1135             this.thenpart = thenpart;
  1136             this.elsepart = elsepart;
  1138         @Override
  1139         public void accept(Visitor v) { v.visitIf(this); }
  1141         public Kind getKind() { return Kind.IF; }
  1142         public JCExpression getCondition() { return cond; }
  1143         public JCStatement getThenStatement() { return thenpart; }
  1144         public JCStatement getElseStatement() { return elsepart; }
  1145         @Override
  1146         public <R,D> R accept(TreeVisitor<R,D> v, D d) {
  1147             return v.visitIf(this, d);
  1149         @Override
  1150         public int getTag() {
  1151             return IF;
  1155     /**
  1156      * an expression statement
  1157      * @param expr expression structure
  1158      */
  1159     public static class JCExpressionStatement extends JCStatement implements ExpressionStatementTree {
  1160         public JCExpression expr;
  1161         protected JCExpressionStatement(JCExpression expr)
  1163             this.expr = expr;
  1165         @Override
  1166         public void accept(Visitor v) { v.visitExec(this); }
  1168         public Kind getKind() { return Kind.EXPRESSION_STATEMENT; }
  1169         public JCExpression getExpression() { return expr; }
  1170         @Override
  1171         public <R,D> R accept(TreeVisitor<R,D> v, D d) {
  1172             return v.visitExpressionStatement(this, d);
  1174         @Override
  1175         public int getTag() {
  1176             return EXEC;
  1180     /**
  1181      * A break from a loop or switch.
  1182      */
  1183     public static class JCBreak extends JCStatement implements BreakTree {
  1184         public Name label;
  1185         public JCTree target;
  1186         protected JCBreak(Name label, JCTree target) {
  1187             this.label = label;
  1188             this.target = target;
  1190         @Override
  1191         public void accept(Visitor v) { v.visitBreak(this); }
  1193         public Kind getKind() { return Kind.BREAK; }
  1194         public Name getLabel() { return label; }
  1195         @Override
  1196         public <R,D> R accept(TreeVisitor<R,D> v, D d) {
  1197             return v.visitBreak(this, d);
  1199         @Override
  1200         public int getTag() {
  1201             return BREAK;
  1205     /**
  1206      * A continue of a loop.
  1207      */
  1208     public static class JCContinue extends JCStatement implements ContinueTree {
  1209         public Name label;
  1210         public JCTree target;
  1211         protected JCContinue(Name label, JCTree target) {
  1212             this.label = label;
  1213             this.target = target;
  1215         @Override
  1216         public void accept(Visitor v) { v.visitContinue(this); }
  1218         public Kind getKind() { return Kind.CONTINUE; }
  1219         public Name getLabel() { return label; }
  1220         @Override
  1221         public <R,D> R accept(TreeVisitor<R,D> v, D d) {
  1222             return v.visitContinue(this, d);
  1224         @Override
  1225         public int getTag() {
  1226             return CONTINUE;
  1230     /**
  1231      * A return statement.
  1232      */
  1233     public static class JCReturn extends JCStatement implements ReturnTree {
  1234         public JCExpression expr;
  1235         protected JCReturn(JCExpression expr) {
  1236             this.expr = expr;
  1238         @Override
  1239         public void accept(Visitor v) { v.visitReturn(this); }
  1241         public Kind getKind() { return Kind.RETURN; }
  1242         public JCExpression getExpression() { return expr; }
  1243         @Override
  1244         public <R,D> R accept(TreeVisitor<R,D> v, D d) {
  1245             return v.visitReturn(this, d);
  1247         @Override
  1248         public int getTag() {
  1249             return RETURN;
  1253     /**
  1254      * A throw statement.
  1255      */
  1256     public static class JCThrow extends JCStatement implements ThrowTree {
  1257         public JCExpression expr;
  1258         protected JCThrow(JCTree expr) {
  1259             this.expr = (JCExpression)expr;
  1261         @Override
  1262         public void accept(Visitor v) { v.visitThrow(this); }
  1264         public Kind getKind() { return Kind.THROW; }
  1265         public JCExpression getExpression() { return expr; }
  1266         @Override
  1267         public <R,D> R accept(TreeVisitor<R,D> v, D d) {
  1268             return v.visitThrow(this, d);
  1270         @Override
  1271         public int getTag() {
  1272             return THROW;
  1276     /**
  1277      * An assert statement.
  1278      */
  1279     public static class JCAssert extends JCStatement implements AssertTree {
  1280         public JCExpression cond;
  1281         public JCExpression detail;
  1282         protected JCAssert(JCExpression cond, JCExpression detail) {
  1283             this.cond = cond;
  1284             this.detail = detail;
  1286         @Override
  1287         public void accept(Visitor v) { v.visitAssert(this); }
  1289         public Kind getKind() { return Kind.ASSERT; }
  1290         public JCExpression getCondition() { return cond; }
  1291         public JCExpression getDetail() { return detail; }
  1292         @Override
  1293         public <R,D> R accept(TreeVisitor<R,D> v, D d) {
  1294             return v.visitAssert(this, d);
  1296         @Override
  1297         public int getTag() {
  1298             return ASSERT;
  1302     /**
  1303      * A method invocation
  1304      */
  1305     public static class JCMethodInvocation extends JCExpression implements MethodInvocationTree {
  1306         public List<JCExpression> typeargs;
  1307         public JCExpression meth;
  1308         public List<JCExpression> args;
  1309         public Type varargsElement;
  1310         protected JCMethodInvocation(List<JCExpression> typeargs,
  1311                         JCExpression meth,
  1312                         List<JCExpression> args)
  1314             this.typeargs = (typeargs == null) ? List.<JCExpression>nil()
  1315                                                : typeargs;
  1316             this.meth = meth;
  1317             this.args = args;
  1319         @Override
  1320         public void accept(Visitor v) { v.visitApply(this); }
  1322         public Kind getKind() { return Kind.METHOD_INVOCATION; }
  1323         public List<JCExpression> getTypeArguments() {
  1324             return typeargs;
  1326         public JCExpression getMethodSelect() { return meth; }
  1327         public List<JCExpression> getArguments() {
  1328             return args;
  1330         @Override
  1331         public <R,D> R accept(TreeVisitor<R,D> v, D d) {
  1332             return v.visitMethodInvocation(this, d);
  1334         @Override
  1335         public JCMethodInvocation setType(Type type) {
  1336             super.setType(type);
  1337             return this;
  1339         @Override
  1340         public int getTag() {
  1341             return(APPLY);
  1345     /**
  1346      * A new(...) operation.
  1347      */
  1348     public static class JCNewClass extends JCExpression implements NewClassTree {
  1349         public JCExpression encl;
  1350         public List<JCExpression> typeargs;
  1351         public JCExpression clazz;
  1352         public List<JCExpression> args;
  1353         public JCClassDecl def;
  1354         public Symbol constructor;
  1355         public Type varargsElement;
  1356         public Type constructorType;
  1357         protected JCNewClass(JCExpression encl,
  1358                            List<JCExpression> typeargs,
  1359                            JCExpression clazz,
  1360                            List<JCExpression> args,
  1361                            JCClassDecl def)
  1363             this.encl = encl;
  1364             this.typeargs = (typeargs == null) ? List.<JCExpression>nil()
  1365                                                : typeargs;
  1366             this.clazz = clazz;
  1367             this.args = args;
  1368             this.def = def;
  1370         @Override
  1371         public void accept(Visitor v) { v.visitNewClass(this); }
  1373         public Kind getKind() { return Kind.NEW_CLASS; }
  1374         public JCExpression getEnclosingExpression() { // expr.new C< ... > ( ... )
  1375             return encl;
  1377         public List<JCExpression> getTypeArguments() {
  1378             return typeargs;
  1380         public JCExpression getIdentifier() { return clazz; }
  1381         public List<JCExpression> getArguments() {
  1382             return args;
  1384         public JCClassDecl getClassBody() { return def; }
  1385         @Override
  1386         public <R,D> R accept(TreeVisitor<R,D> v, D d) {
  1387             return v.visitNewClass(this, d);
  1389         @Override
  1390         public int getTag() {
  1391             return NEWCLASS;
  1395     /**
  1396      * A new[...] operation.
  1397      */
  1398     public static class JCNewArray extends JCExpression implements NewArrayTree {
  1399         public JCExpression elemtype;
  1400         public List<JCExpression> dims;
  1401         public List<JCExpression> elems;
  1402         protected JCNewArray(JCExpression elemtype,
  1403                            List<JCExpression> dims,
  1404                            List<JCExpression> elems)
  1406             this.elemtype = elemtype;
  1407             this.dims = dims;
  1408             this.elems = elems;
  1410         @Override
  1411         public void accept(Visitor v) { v.visitNewArray(this); }
  1413         public Kind getKind() { return Kind.NEW_ARRAY; }
  1414         public JCExpression getType() { return elemtype; }
  1415         public List<JCExpression> getDimensions() {
  1416             return dims;
  1418         public List<JCExpression> getInitializers() {
  1419             return elems;
  1421         @Override
  1422         public <R,D> R accept(TreeVisitor<R,D> v, D d) {
  1423             return v.visitNewArray(this, d);
  1425         @Override
  1426         public int getTag() {
  1427             return NEWARRAY;
  1431     /**
  1432      * A parenthesized subexpression ( ... )
  1433      */
  1434     public static class JCParens extends JCExpression implements ParenthesizedTree {
  1435         public JCExpression expr;
  1436         protected JCParens(JCExpression expr) {
  1437             this.expr = expr;
  1439         @Override
  1440         public void accept(Visitor v) { v.visitParens(this); }
  1442         public Kind getKind() { return Kind.PARENTHESIZED; }
  1443         public JCExpression getExpression() { return expr; }
  1444         @Override
  1445         public <R,D> R accept(TreeVisitor<R,D> v, D d) {
  1446             return v.visitParenthesized(this, d);
  1448         @Override
  1449         public int getTag() {
  1450             return PARENS;
  1454     /**
  1455      * A assignment with "=".
  1456      */
  1457     public static class JCAssign extends JCExpression implements AssignmentTree {
  1458         public JCExpression lhs;
  1459         public JCExpression rhs;
  1460         protected JCAssign(JCExpression lhs, JCExpression rhs) {
  1461             this.lhs = lhs;
  1462             this.rhs = rhs;
  1464         @Override
  1465         public void accept(Visitor v) { v.visitAssign(this); }
  1467         public Kind getKind() { return Kind.ASSIGNMENT; }
  1468         public JCExpression getVariable() { return lhs; }
  1469         public JCExpression getExpression() { return rhs; }
  1470         @Override
  1471         public <R,D> R accept(TreeVisitor<R,D> v, D d) {
  1472             return v.visitAssignment(this, d);
  1474         @Override
  1475         public int getTag() {
  1476             return ASSIGN;
  1480     /**
  1481      * An assignment with "+=", "|=" ...
  1482      */
  1483     public static class JCAssignOp extends JCExpression implements CompoundAssignmentTree {
  1484         private int opcode;
  1485         public JCExpression lhs;
  1486         public JCExpression rhs;
  1487         public Symbol operator;
  1488         protected JCAssignOp(int opcode, JCTree lhs, JCTree rhs, Symbol operator) {
  1489             this.opcode = opcode;
  1490             this.lhs = (JCExpression)lhs;
  1491             this.rhs = (JCExpression)rhs;
  1492             this.operator = operator;
  1494         @Override
  1495         public void accept(Visitor v) { v.visitAssignop(this); }
  1497         public Kind getKind() { return TreeInfo.tagToKind(getTag()); }
  1498         public JCExpression getVariable() { return lhs; }
  1499         public JCExpression getExpression() { return rhs; }
  1500         public Symbol getOperator() {
  1501             return operator;
  1503         @Override
  1504         public <R,D> R accept(TreeVisitor<R,D> v, D d) {
  1505             return v.visitCompoundAssignment(this, d);
  1507         @Override
  1508         public int getTag() {
  1509             return opcode;
  1513     /**
  1514      * A unary operation.
  1515      */
  1516     public static class JCUnary extends JCExpression implements UnaryTree {
  1517         private int opcode;
  1518         public JCExpression arg;
  1519         public Symbol operator;
  1520         protected JCUnary(int opcode, JCExpression arg) {
  1521             this.opcode = opcode;
  1522             this.arg = arg;
  1524         @Override
  1525         public void accept(Visitor v) { v.visitUnary(this); }
  1527         public Kind getKind() { return TreeInfo.tagToKind(getTag()); }
  1528         public JCExpression getExpression() { return arg; }
  1529         public Symbol getOperator() {
  1530             return operator;
  1532         @Override
  1533         public <R,D> R accept(TreeVisitor<R,D> v, D d) {
  1534             return v.visitUnary(this, d);
  1536         @Override
  1537         public int getTag() {
  1538             return opcode;
  1541         public void setTag(int tag) {
  1542             opcode = tag;
  1546     /**
  1547      * A binary operation.
  1548      */
  1549     public static class JCBinary extends JCExpression implements BinaryTree {
  1550         private int opcode;
  1551         public JCExpression lhs;
  1552         public JCExpression rhs;
  1553         public Symbol operator;
  1554         protected JCBinary(int opcode,
  1555                          JCExpression lhs,
  1556                          JCExpression rhs,
  1557                          Symbol operator) {
  1558             this.opcode = opcode;
  1559             this.lhs = lhs;
  1560             this.rhs = rhs;
  1561             this.operator = operator;
  1563         @Override
  1564         public void accept(Visitor v) { v.visitBinary(this); }
  1566         public Kind getKind() { return TreeInfo.tagToKind(getTag()); }
  1567         public JCExpression getLeftOperand() { return lhs; }
  1568         public JCExpression getRightOperand() { return rhs; }
  1569         public Symbol getOperator() {
  1570             return operator;
  1572         @Override
  1573         public <R,D> R accept(TreeVisitor<R,D> v, D d) {
  1574             return v.visitBinary(this, d);
  1576         @Override
  1577         public int getTag() {
  1578             return opcode;
  1582     /**
  1583      * A type cast.
  1584      */
  1585     public static class JCTypeCast extends JCExpression implements TypeCastTree {
  1586         public JCTree clazz;
  1587         public JCExpression expr;
  1588         protected JCTypeCast(JCTree clazz, JCExpression expr) {
  1589             this.clazz = clazz;
  1590             this.expr = expr;
  1592         @Override
  1593         public void accept(Visitor v) { v.visitTypeCast(this); }
  1595         public Kind getKind() { return Kind.TYPE_CAST; }
  1596         public JCTree getType() { return clazz; }
  1597         public JCExpression getExpression() { return expr; }
  1598         @Override
  1599         public <R,D> R accept(TreeVisitor<R,D> v, D d) {
  1600             return v.visitTypeCast(this, d);
  1602         @Override
  1603         public int getTag() {
  1604             return TYPECAST;
  1608     /**
  1609      * A type test.
  1610      */
  1611     public static class JCInstanceOf extends JCExpression implements InstanceOfTree {
  1612         public JCExpression expr;
  1613         public JCTree clazz;
  1614         protected JCInstanceOf(JCExpression expr, JCTree clazz) {
  1615             this.expr = expr;
  1616             this.clazz = clazz;
  1618         @Override
  1619         public void accept(Visitor v) { v.visitTypeTest(this); }
  1621         public Kind getKind() { return Kind.INSTANCE_OF; }
  1622         public JCTree getType() { return clazz; }
  1623         public JCExpression getExpression() { return expr; }
  1624         @Override
  1625         public <R,D> R accept(TreeVisitor<R,D> v, D d) {
  1626             return v.visitInstanceOf(this, d);
  1628         @Override
  1629         public int getTag() {
  1630             return TYPETEST;
  1634     /**
  1635      * An array selection
  1636      */
  1637     public static class JCArrayAccess extends JCExpression implements ArrayAccessTree {
  1638         public JCExpression indexed;
  1639         public JCExpression index;
  1640         protected JCArrayAccess(JCExpression indexed, JCExpression index) {
  1641             this.indexed = indexed;
  1642             this.index = index;
  1644         @Override
  1645         public void accept(Visitor v) { v.visitIndexed(this); }
  1647         public Kind getKind() { return Kind.ARRAY_ACCESS; }
  1648         public JCExpression getExpression() { return indexed; }
  1649         public JCExpression getIndex() { return index; }
  1650         @Override
  1651         public <R,D> R accept(TreeVisitor<R,D> v, D d) {
  1652             return v.visitArrayAccess(this, d);
  1654         @Override
  1655         public int getTag() {
  1656             return INDEXED;
  1660     /**
  1661      * Selects through packages and classes
  1662      * @param selected selected Tree hierarchie
  1663      * @param selector name of field to select thru
  1664      * @param sym symbol of the selected class
  1665      */
  1666     public static class JCFieldAccess extends JCExpression implements MemberSelectTree {
  1667         public JCExpression selected;
  1668         public Name name;
  1669         public Symbol sym;
  1670         protected JCFieldAccess(JCExpression selected, Name name, Symbol sym) {
  1671             this.selected = selected;
  1672             this.name = name;
  1673             this.sym = sym;
  1675         @Override
  1676         public void accept(Visitor v) { v.visitSelect(this); }
  1678         public Kind getKind() { return Kind.MEMBER_SELECT; }
  1679         public JCExpression getExpression() { return selected; }
  1680         @Override
  1681         public <R,D> R accept(TreeVisitor<R,D> v, D d) {
  1682             return v.visitMemberSelect(this, d);
  1684         public Name getIdentifier() { return name; }
  1685         @Override
  1686         public int getTag() {
  1687             return SELECT;
  1691     /**
  1692      * An identifier
  1693      * @param idname the name
  1694      * @param sym the symbol
  1695      */
  1696     public static class JCIdent extends JCExpression implements IdentifierTree {
  1697         public Name name;
  1698         public Symbol sym;
  1699         protected JCIdent(Name name, Symbol sym) {
  1700             this.name = name;
  1701             this.sym = sym;
  1703         @Override
  1704         public void accept(Visitor v) { v.visitIdent(this); }
  1706         public Kind getKind() { return Kind.IDENTIFIER; }
  1707         public Name getName() { return name; }
  1708         @Override
  1709         public <R,D> R accept(TreeVisitor<R,D> v, D d) {
  1710             return v.visitIdentifier(this, d);
  1712         public int getTag() {
  1713             return IDENT;
  1717     /**
  1718      * A constant value given literally.
  1719      * @param value value representation
  1720      */
  1721     public static class JCLiteral extends JCExpression implements LiteralTree {
  1722         public int typetag;
  1723         public Object value;
  1724         protected JCLiteral(int typetag, Object value) {
  1725             this.typetag = typetag;
  1726             this.value = value;
  1728         @Override
  1729         public void accept(Visitor v) { v.visitLiteral(this); }
  1731         public Kind getKind() {
  1732             switch (typetag) {
  1733             case TypeTags.INT:
  1734                 return Kind.INT_LITERAL;
  1735             case TypeTags.LONG:
  1736                 return Kind.LONG_LITERAL;
  1737             case TypeTags.FLOAT:
  1738                 return Kind.FLOAT_LITERAL;
  1739             case TypeTags.DOUBLE:
  1740                 return Kind.DOUBLE_LITERAL;
  1741             case TypeTags.BOOLEAN:
  1742                 return Kind.BOOLEAN_LITERAL;
  1743             case TypeTags.CHAR:
  1744                 return Kind.CHAR_LITERAL;
  1745             case TypeTags.CLASS:
  1746                 return Kind.STRING_LITERAL;
  1747             case TypeTags.BOT:
  1748                 return Kind.NULL_LITERAL;
  1749             default:
  1750                 throw new AssertionError("unknown literal kind " + this);
  1753         public Object getValue() {
  1754             switch (typetag) {
  1755                 case TypeTags.BOOLEAN:
  1756                     int bi = (Integer) value;
  1757                     return (bi != 0);
  1758                 case TypeTags.CHAR:
  1759                     int ci = (Integer) value;
  1760                     char c = (char) ci;
  1761                     if (c != ci)
  1762                         throw new AssertionError("bad value for char literal");
  1763                     return c;
  1764                 default:
  1765                     return value;
  1768         @Override
  1769         public <R,D> R accept(TreeVisitor<R,D> v, D d) {
  1770             return v.visitLiteral(this, d);
  1772         @Override
  1773         public JCLiteral setType(Type type) {
  1774             super.setType(type);
  1775             return this;
  1777         @Override
  1778         public int getTag() {
  1779             return LITERAL;
  1783     /**
  1784      * Identifies a basic type.
  1785      * @param tag the basic type id
  1786      * @see TypeTags
  1787      */
  1788     public static class JCPrimitiveTypeTree extends JCExpression implements PrimitiveTypeTree {
  1789         public int typetag;
  1790         protected JCPrimitiveTypeTree(int typetag) {
  1791             this.typetag = typetag;
  1793         @Override
  1794         public void accept(Visitor v) { v.visitTypeIdent(this); }
  1796         public Kind getKind() { return Kind.PRIMITIVE_TYPE; }
  1797         public TypeKind getPrimitiveTypeKind() {
  1798             switch (typetag) {
  1799             case TypeTags.BOOLEAN:
  1800                 return TypeKind.BOOLEAN;
  1801             case TypeTags.BYTE:
  1802                 return TypeKind.BYTE;
  1803             case TypeTags.SHORT:
  1804                 return TypeKind.SHORT;
  1805             case TypeTags.INT:
  1806                 return TypeKind.INT;
  1807             case TypeTags.LONG:
  1808                 return TypeKind.LONG;
  1809             case TypeTags.CHAR:
  1810                 return TypeKind.CHAR;
  1811             case TypeTags.FLOAT:
  1812                 return TypeKind.FLOAT;
  1813             case TypeTags.DOUBLE:
  1814                 return TypeKind.DOUBLE;
  1815             case TypeTags.VOID:
  1816                 return TypeKind.VOID;
  1817             default:
  1818                 throw new AssertionError("unknown primitive type " + this);
  1821         @Override
  1822         public <R,D> R accept(TreeVisitor<R,D> v, D d) {
  1823             return v.visitPrimitiveType(this, d);
  1825         @Override
  1826         public int getTag() {
  1827             return TYPEIDENT;
  1831     /**
  1832      * An array type, A[]
  1833      */
  1834     public static class JCArrayTypeTree extends JCExpression implements ArrayTypeTree {
  1835         public JCExpression elemtype;
  1836         protected JCArrayTypeTree(JCExpression elemtype) {
  1837             this.elemtype = elemtype;
  1839         @Override
  1840         public void accept(Visitor v) { v.visitTypeArray(this); }
  1842         public Kind getKind() { return Kind.ARRAY_TYPE; }
  1843         public JCTree getType() { return elemtype; }
  1844         @Override
  1845         public <R,D> R accept(TreeVisitor<R,D> v, D d) {
  1846             return v.visitArrayType(this, d);
  1848         @Override
  1849         public int getTag() {
  1850             return TYPEARRAY;
  1854     /**
  1855      * A parameterized type, T<...>
  1856      */
  1857     public static class JCTypeApply extends JCExpression implements ParameterizedTypeTree {
  1858         public JCExpression clazz;
  1859         public List<JCExpression> arguments;
  1860         protected JCTypeApply(JCExpression clazz, List<JCExpression> arguments) {
  1861             this.clazz = clazz;
  1862             this.arguments = arguments;
  1864         @Override
  1865         public void accept(Visitor v) { v.visitTypeApply(this); }
  1867         public Kind getKind() { return Kind.PARAMETERIZED_TYPE; }
  1868         public JCTree getType() { return clazz; }
  1869         public List<JCExpression> getTypeArguments() {
  1870             return arguments;
  1872         @Override
  1873         public <R,D> R accept(TreeVisitor<R,D> v, D d) {
  1874             return v.visitParameterizedType(this, d);
  1876         @Override
  1877         public int getTag() {
  1878             return TYPEAPPLY;
  1882     /**
  1883      * A disjunction type, T1 | T2 | ... Tn (used in multicatch statements)
  1884      */
  1885     public static class JCTypeDisjunction extends JCExpression implements DisjunctiveTypeTree {
  1887         public List<JCExpression> alternatives;
  1889         protected JCTypeDisjunction(List<JCExpression> components) {
  1890             this.alternatives = components;
  1892         @Override
  1893         public void accept(Visitor v) { v.visitTypeDisjunction(this); }
  1895         public Kind getKind() { return Kind.DISJUNCTIVE_TYPE; }
  1897         public List<JCExpression> getTypeAlternatives() {
  1898             return alternatives;
  1900         @Override
  1901         public <R,D> R accept(TreeVisitor<R,D> v, D d) {
  1902             return v.visitDisjunctiveType(this, d);
  1904         @Override
  1905         public int getTag() {
  1906             return TYPEDISJUNCTION;
  1910     /**
  1911      * A formal class parameter.
  1912      * @param name name
  1913      * @param bounds bounds
  1914      */
  1915     public static class JCTypeParameter extends JCTree implements TypeParameterTree {
  1916         public Name name;
  1917         public List<JCExpression> bounds;
  1918         protected JCTypeParameter(Name name, List<JCExpression> bounds) {
  1919             this.name = name;
  1920             this.bounds = bounds;
  1922         @Override
  1923         public void accept(Visitor v) { v.visitTypeParameter(this); }
  1925         public Kind getKind() { return Kind.TYPE_PARAMETER; }
  1926         public Name getName() { return name; }
  1927         public List<JCExpression> getBounds() {
  1928             return bounds;
  1930         @Override
  1931         public <R,D> R accept(TreeVisitor<R,D> v, D d) {
  1932             return v.visitTypeParameter(this, d);
  1934         @Override
  1935         public int getTag() {
  1936             return TYPEPARAMETER;
  1940     public static class JCWildcard extends JCExpression implements WildcardTree {
  1941         public TypeBoundKind kind;
  1942         public JCTree inner;
  1943         protected JCWildcard(TypeBoundKind kind, JCTree inner) {
  1944             kind.getClass(); // null-check
  1945             this.kind = kind;
  1946             this.inner = inner;
  1948         @Override
  1949         public void accept(Visitor v) { v.visitWildcard(this); }
  1951         public Kind getKind() {
  1952             switch (kind.kind) {
  1953             case UNBOUND:
  1954                 return Kind.UNBOUNDED_WILDCARD;
  1955             case EXTENDS:
  1956                 return Kind.EXTENDS_WILDCARD;
  1957             case SUPER:
  1958                 return Kind.SUPER_WILDCARD;
  1959             default:
  1960                 throw new AssertionError("Unknown wildcard bound " + kind);
  1963         public JCTree getBound() { return inner; }
  1964         @Override
  1965         public <R,D> R accept(TreeVisitor<R,D> v, D d) {
  1966             return v.visitWildcard(this, d);
  1968         @Override
  1969         public int getTag() {
  1970             return WILDCARD;
  1974     public static class TypeBoundKind extends JCTree {
  1975         public BoundKind kind;
  1976         protected TypeBoundKind(BoundKind kind) {
  1977             this.kind = kind;
  1979         @Override
  1980         public void accept(Visitor v) { v.visitTypeBoundKind(this); }
  1982         public Kind getKind() {
  1983             throw new AssertionError("TypeBoundKind is not part of a public API");
  1985         @Override
  1986         public <R,D> R accept(TreeVisitor<R,D> v, D d) {
  1987             throw new AssertionError("TypeBoundKind is not part of a public API");
  1989         @Override
  1990         public int getTag() {
  1991             return TYPEBOUNDKIND;
  1995     public static class JCAnnotation extends JCExpression implements AnnotationTree {
  1996         public JCTree annotationType;
  1997         public List<JCExpression> args;
  1998         protected JCAnnotation(JCTree annotationType, List<JCExpression> args) {
  1999             this.annotationType = annotationType;
  2000             this.args = args;
  2002         @Override
  2003         public void accept(Visitor v) { v.visitAnnotation(this); }
  2005         public Kind getKind() { return Kind.ANNOTATION; }
  2006         public JCTree getAnnotationType() { return annotationType; }
  2007         public List<JCExpression> getArguments() {
  2008             return args;
  2010         @Override
  2011         public <R,D> R accept(TreeVisitor<R,D> v, D d) {
  2012             return v.visitAnnotation(this, d);
  2014         @Override
  2015         public int getTag() {
  2016             return ANNOTATION;
  2020     public static class JCModifiers extends JCTree implements com.sun.source.tree.ModifiersTree {
  2021         public long flags;
  2022         public List<JCAnnotation> annotations;
  2023         protected JCModifiers(long flags, List<JCAnnotation> annotations) {
  2024             this.flags = flags;
  2025             this.annotations = annotations;
  2027         @Override
  2028         public void accept(Visitor v) { v.visitModifiers(this); }
  2030         public Kind getKind() { return Kind.MODIFIERS; }
  2031         public Set<Modifier> getFlags() {
  2032             return Flags.asModifierSet(flags);
  2034         public List<JCAnnotation> getAnnotations() {
  2035             return annotations;
  2037         @Override
  2038         public <R,D> R accept(TreeVisitor<R,D> v, D d) {
  2039             return v.visitModifiers(this, d);
  2041         @Override
  2042         public int getTag() {
  2043             return MODIFIERS;
  2047     public static class JCErroneous extends JCExpression
  2048             implements com.sun.source.tree.ErroneousTree {
  2049         public List<? extends JCTree> errs;
  2050         protected JCErroneous(List<? extends JCTree> errs) {
  2051             this.errs = errs;
  2053         @Override
  2054         public void accept(Visitor v) { v.visitErroneous(this); }
  2056         public Kind getKind() { return Kind.ERRONEOUS; }
  2058         public List<? extends JCTree> getErrorTrees() {
  2059             return errs;
  2062         @Override
  2063         public <R,D> R accept(TreeVisitor<R,D> v, D d) {
  2064             return v.visitErroneous(this, d);
  2066         @Override
  2067         public int getTag() {
  2068             return ERRONEOUS;
  2072     /** (let int x = 3; in x+2) */
  2073     public static class LetExpr extends JCExpression {
  2074         public List<JCVariableDecl> defs;
  2075         public JCTree expr;
  2076         protected LetExpr(List<JCVariableDecl> defs, JCTree expr) {
  2077             this.defs = defs;
  2078             this.expr = expr;
  2080         @Override
  2081         public void accept(Visitor v) { v.visitLetExpr(this); }
  2083         public Kind getKind() {
  2084             throw new AssertionError("LetExpr is not part of a public API");
  2086         @Override
  2087         public <R,D> R accept(TreeVisitor<R,D> v, D d) {
  2088             throw new AssertionError("LetExpr is not part of a public API");
  2090         @Override
  2091         public int getTag() {
  2092             return LETEXPR;
  2096     /** An interface for tree factories
  2097      */
  2098     public interface Factory {
  2099         JCCompilationUnit TopLevel(List<JCAnnotation> packageAnnotations,
  2100                                    JCExpression pid,
  2101                                    List<JCTree> defs);
  2102         JCImport Import(JCTree qualid, boolean staticImport);
  2103         JCClassDecl ClassDef(JCModifiers mods,
  2104                           Name name,
  2105                           List<JCTypeParameter> typarams,
  2106                           JCTree extending,
  2107                           List<JCExpression> implementing,
  2108                           List<JCTree> defs);
  2109         JCMethodDecl MethodDef(JCModifiers mods,
  2110                             Name name,
  2111                             JCExpression restype,
  2112                             List<JCTypeParameter> typarams,
  2113                             List<JCVariableDecl> params,
  2114                             List<JCExpression> thrown,
  2115                             JCBlock body,
  2116                             JCExpression defaultValue);
  2117         JCVariableDecl VarDef(JCModifiers mods,
  2118                       Name name,
  2119                       JCExpression vartype,
  2120                       JCExpression init);
  2121         JCSkip Skip();
  2122         JCBlock Block(long flags, List<JCStatement> stats);
  2123         JCDoWhileLoop DoLoop(JCStatement body, JCExpression cond);
  2124         JCWhileLoop WhileLoop(JCExpression cond, JCStatement body);
  2125         JCForLoop ForLoop(List<JCStatement> init,
  2126                         JCExpression cond,
  2127                         List<JCExpressionStatement> step,
  2128                         JCStatement body);
  2129         JCEnhancedForLoop ForeachLoop(JCVariableDecl var, JCExpression expr, JCStatement body);
  2130         JCLabeledStatement Labelled(Name label, JCStatement body);
  2131         JCSwitch Switch(JCExpression selector, List<JCCase> cases);
  2132         JCCase Case(JCExpression pat, List<JCStatement> stats);
  2133         JCSynchronized Synchronized(JCExpression lock, JCBlock body);
  2134         JCTry Try(JCBlock body, List<JCCatch> catchers, JCBlock finalizer);
  2135         JCTry Try(List<JCTree> resources,
  2136                   JCBlock body,
  2137                   List<JCCatch> catchers,
  2138                   JCBlock finalizer);
  2139         JCCatch Catch(JCVariableDecl param, JCBlock body);
  2140         JCConditional Conditional(JCExpression cond,
  2141                                 JCExpression thenpart,
  2142                                 JCExpression elsepart);
  2143         JCIf If(JCExpression cond, JCStatement thenpart, JCStatement elsepart);
  2144         JCExpressionStatement Exec(JCExpression expr);
  2145         JCBreak Break(Name label);
  2146         JCContinue Continue(Name label);
  2147         JCReturn Return(JCExpression expr);
  2148         JCThrow Throw(JCTree expr);
  2149         JCAssert Assert(JCExpression cond, JCExpression detail);
  2150         JCMethodInvocation Apply(List<JCExpression> typeargs,
  2151                     JCExpression fn,
  2152                     List<JCExpression> args);
  2153         JCNewClass NewClass(JCExpression encl,
  2154                           List<JCExpression> typeargs,
  2155                           JCExpression clazz,
  2156                           List<JCExpression> args,
  2157                           JCClassDecl def);
  2158         JCNewArray NewArray(JCExpression elemtype,
  2159                           List<JCExpression> dims,
  2160                           List<JCExpression> elems);
  2161         JCParens Parens(JCExpression expr);
  2162         JCAssign Assign(JCExpression lhs, JCExpression rhs);
  2163         JCAssignOp Assignop(int opcode, JCTree lhs, JCTree rhs);
  2164         JCUnary Unary(int opcode, JCExpression arg);
  2165         JCBinary Binary(int opcode, JCExpression lhs, JCExpression rhs);
  2166         JCTypeCast TypeCast(JCTree expr, JCExpression type);
  2167         JCInstanceOf TypeTest(JCExpression expr, JCTree clazz);
  2168         JCArrayAccess Indexed(JCExpression indexed, JCExpression index);
  2169         JCFieldAccess Select(JCExpression selected, Name selector);
  2170         JCIdent Ident(Name idname);
  2171         JCLiteral Literal(int tag, Object value);
  2172         JCPrimitiveTypeTree TypeIdent(int typetag);
  2173         JCArrayTypeTree TypeArray(JCExpression elemtype);
  2174         JCTypeApply TypeApply(JCExpression clazz, List<JCExpression> arguments);
  2175         JCTypeParameter TypeParameter(Name name, List<JCExpression> bounds);
  2176         JCWildcard Wildcard(TypeBoundKind kind, JCTree type);
  2177         TypeBoundKind TypeBoundKind(BoundKind kind);
  2178         JCAnnotation Annotation(JCTree annotationType, List<JCExpression> args);
  2179         JCModifiers Modifiers(long flags, List<JCAnnotation> annotations);
  2180         JCErroneous Erroneous(List<? extends JCTree> errs);
  2181         LetExpr LetExpr(List<JCVariableDecl> defs, JCTree expr);
  2184     /** A generic visitor class for trees.
  2185      */
  2186     public static abstract class Visitor {
  2187         public void visitTopLevel(JCCompilationUnit that)    { visitTree(that); }
  2188         public void visitImport(JCImport that)               { visitTree(that); }
  2189         public void visitClassDef(JCClassDecl that)          { visitTree(that); }
  2190         public void visitMethodDef(JCMethodDecl that)        { visitTree(that); }
  2191         public void visitVarDef(JCVariableDecl that)         { visitTree(that); }
  2192         public void visitSkip(JCSkip that)                   { visitTree(that); }
  2193         public void visitBlock(JCBlock that)                 { visitTree(that); }
  2194         public void visitDoLoop(JCDoWhileLoop that)          { visitTree(that); }
  2195         public void visitWhileLoop(JCWhileLoop that)         { visitTree(that); }
  2196         public void visitForLoop(JCForLoop that)             { visitTree(that); }
  2197         public void visitForeachLoop(JCEnhancedForLoop that) { visitTree(that); }
  2198         public void visitLabelled(JCLabeledStatement that)   { visitTree(that); }
  2199         public void visitSwitch(JCSwitch that)               { visitTree(that); }
  2200         public void visitCase(JCCase that)                   { visitTree(that); }
  2201         public void visitSynchronized(JCSynchronized that)   { visitTree(that); }
  2202         public void visitTry(JCTry that)                     { visitTree(that); }
  2203         public void visitCatch(JCCatch that)                 { visitTree(that); }
  2204         public void visitConditional(JCConditional that)     { visitTree(that); }
  2205         public void visitIf(JCIf that)                       { visitTree(that); }
  2206         public void visitExec(JCExpressionStatement that)    { visitTree(that); }
  2207         public void visitBreak(JCBreak that)                 { visitTree(that); }
  2208         public void visitContinue(JCContinue that)           { visitTree(that); }
  2209         public void visitReturn(JCReturn that)               { visitTree(that); }
  2210         public void visitThrow(JCThrow that)                 { visitTree(that); }
  2211         public void visitAssert(JCAssert that)               { visitTree(that); }
  2212         public void visitApply(JCMethodInvocation that)      { visitTree(that); }
  2213         public void visitNewClass(JCNewClass that)           { visitTree(that); }
  2214         public void visitNewArray(JCNewArray that)           { visitTree(that); }
  2215         public void visitParens(JCParens that)               { visitTree(that); }
  2216         public void visitAssign(JCAssign that)               { visitTree(that); }
  2217         public void visitAssignop(JCAssignOp that)           { visitTree(that); }
  2218         public void visitUnary(JCUnary that)                 { visitTree(that); }
  2219         public void visitBinary(JCBinary that)               { visitTree(that); }
  2220         public void visitTypeCast(JCTypeCast that)           { visitTree(that); }
  2221         public void visitTypeTest(JCInstanceOf that)         { visitTree(that); }
  2222         public void visitIndexed(JCArrayAccess that)         { visitTree(that); }
  2223         public void visitSelect(JCFieldAccess that)          { visitTree(that); }
  2224         public void visitIdent(JCIdent that)                 { visitTree(that); }
  2225         public void visitLiteral(JCLiteral that)             { visitTree(that); }
  2226         public void visitTypeIdent(JCPrimitiveTypeTree that) { visitTree(that); }
  2227         public void visitTypeArray(JCArrayTypeTree that)     { visitTree(that); }
  2228         public void visitTypeApply(JCTypeApply that)         { visitTree(that); }
  2229         public void visitTypeDisjunction(JCTypeDisjunction that)   { visitTree(that); }
  2230         public void visitTypeParameter(JCTypeParameter that) { visitTree(that); }
  2231         public void visitWildcard(JCWildcard that)           { visitTree(that); }
  2232         public void visitTypeBoundKind(TypeBoundKind that)   { visitTree(that); }
  2233         public void visitAnnotation(JCAnnotation that)       { visitTree(that); }
  2234         public void visitModifiers(JCModifiers that)         { visitTree(that); }
  2235         public void visitErroneous(JCErroneous that)         { visitTree(that); }
  2236         public void visitLetExpr(LetExpr that)               { visitTree(that); }
  2238         public void visitTree(JCTree that)                   { Assert.error(); }

mercurial