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

Wed, 06 Apr 2011 19:30:57 -0700

author
darcy
date
Wed, 06 Apr 2011 19:30:57 -0700
changeset 969
8cc5b440fdde
parent 904
4baab658f357
child 1089
0f3da6af9799
permissions
-rw-r--r--

7033809: Rename "disjunctive" to "union" in javax.lang.model
Reviewed-by: mcimadamore, jjg

     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     /** Union types, of type TypeUnion
   240      */
   241     public static final int TYPEUNION = TYPEAPPLY + 1;
   243     /** Formal type parameters, of type TypeParameter.
   244      */
   245     public static final int TYPEPARAMETER = TYPEUNION + 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                 int tag = tree.getTag();
   469                 if (tag == IMPORT)
   470                     imports.append((JCImport)tree);
   471                 else if (tag != SKIP)
   472                     break;
   473             }
   474             return imports.toList();
   475         }
   476         public JCExpression getPackageName() { return pid; }
   477         public JavaFileObject getSourceFile() {
   478             return sourcefile;
   479         }
   480         public Position.LineMap getLineMap() {
   481             return lineMap;
   482         }
   483         public List<JCTree> getTypeDecls() {
   484             List<JCTree> typeDefs;
   485             for (typeDefs = defs; !typeDefs.isEmpty(); typeDefs = typeDefs.tail)
   486                 if (typeDefs.head.getTag() != IMPORT)
   487                     break;
   488             return typeDefs;
   489         }
   490         @Override
   491         public <R,D> R accept(TreeVisitor<R,D> v, D d) {
   492             return v.visitCompilationUnit(this, d);
   493         }
   495         @Override
   496         public int getTag() {
   497             return TOPLEVEL;
   498         }
   499     }
   501     /**
   502      * An import clause.
   503      * @param qualid    The imported class(es).
   504      */
   505     public static class JCImport extends JCTree implements ImportTree {
   506         public boolean staticImport;
   507         public JCTree qualid;
   508         protected JCImport(JCTree qualid, boolean importStatic) {
   509             this.qualid = qualid;
   510             this.staticImport = importStatic;
   511         }
   512         @Override
   513         public void accept(Visitor v) { v.visitImport(this); }
   515         public boolean isStatic() { return staticImport; }
   516         public JCTree getQualifiedIdentifier() { return qualid; }
   518         public Kind getKind() { return Kind.IMPORT; }
   519         @Override
   520         public <R,D> R accept(TreeVisitor<R,D> v, D d) {
   521             return v.visitImport(this, d);
   522         }
   524         @Override
   525         public int getTag() {
   526             return IMPORT;
   527         }
   528     }
   530     public static abstract class JCStatement extends JCTree implements StatementTree {
   531         @Override
   532         public JCStatement setType(Type type) {
   533             super.setType(type);
   534             return this;
   535         }
   536         @Override
   537         public JCStatement setPos(int pos) {
   538             super.setPos(pos);
   539             return this;
   540         }
   541     }
   543     public static abstract class JCExpression extends JCTree implements ExpressionTree {
   544         @Override
   545         public JCExpression setType(Type type) {
   546             super.setType(type);
   547             return this;
   548         }
   549         @Override
   550         public JCExpression setPos(int pos) {
   551             super.setPos(pos);
   552             return this;
   553         }
   554     }
   556     /**
   557      * A class definition.
   558      * @param modifiers the modifiers
   559      * @param name the name of the class
   560      * @param typarams formal class parameters
   561      * @param extending the classes this class extends
   562      * @param implementing the interfaces implemented by this class
   563      * @param defs all variables and methods defined in this class
   564      * @param sym the symbol
   565      */
   566     public static class JCClassDecl extends JCStatement implements ClassTree {
   567         public JCModifiers mods;
   568         public Name name;
   569         public List<JCTypeParameter> typarams;
   570         public JCExpression extending;
   571         public List<JCExpression> implementing;
   572         public List<JCTree> defs;
   573         public ClassSymbol sym;
   574         protected JCClassDecl(JCModifiers mods,
   575                            Name name,
   576                            List<JCTypeParameter> typarams,
   577                            JCExpression extending,
   578                            List<JCExpression> implementing,
   579                            List<JCTree> defs,
   580                            ClassSymbol sym)
   581         {
   582             this.mods = mods;
   583             this.name = name;
   584             this.typarams = typarams;
   585             this.extending = extending;
   586             this.implementing = implementing;
   587             this.defs = defs;
   588             this.sym = sym;
   589         }
   590         @Override
   591         public void accept(Visitor v) { v.visitClassDef(this); }
   593         public Kind getKind() {
   594             if ((mods.flags & Flags.ANNOTATION) != 0)
   595                 return Kind.ANNOTATION_TYPE;
   596             else if ((mods.flags & Flags.INTERFACE) != 0)
   597                 return Kind.INTERFACE;
   598             else if ((mods.flags & Flags.ENUM) != 0)
   599                 return Kind.ENUM;
   600             else
   601                 return Kind.CLASS;
   602         }
   604         public JCModifiers getModifiers() { return mods; }
   605         public Name getSimpleName() { return name; }
   606         public List<JCTypeParameter> getTypeParameters() {
   607             return typarams;
   608         }
   609         public JCTree getExtendsClause() { return extending; }
   610         public List<JCExpression> getImplementsClause() {
   611             return implementing;
   612         }
   613         public List<JCTree> getMembers() {
   614             return defs;
   615         }
   616         @Override
   617         public <R,D> R accept(TreeVisitor<R,D> v, D d) {
   618             return v.visitClass(this, d);
   619         }
   621         @Override
   622         public int getTag() {
   623             return CLASSDEF;
   624         }
   625     }
   627     /**
   628      * A method definition.
   629      * @param modifiers method modifiers
   630      * @param name method name
   631      * @param restype type of method return value
   632      * @param typarams type parameters
   633      * @param params value parameters
   634      * @param thrown exceptions thrown by this method
   635      * @param stats statements in the method
   636      * @param sym method symbol
   637      */
   638     public static class JCMethodDecl extends JCTree implements MethodTree {
   639         public JCModifiers mods;
   640         public Name name;
   641         public JCExpression restype;
   642         public List<JCTypeParameter> typarams;
   643         public List<JCVariableDecl> params;
   644         public List<JCExpression> thrown;
   645         public JCBlock body;
   646         public JCExpression defaultValue; // for annotation types
   647         public MethodSymbol sym;
   648         protected JCMethodDecl(JCModifiers mods,
   649                             Name name,
   650                             JCExpression restype,
   651                             List<JCTypeParameter> typarams,
   652                             List<JCVariableDecl> params,
   653                             List<JCExpression> thrown,
   654                             JCBlock body,
   655                             JCExpression defaultValue,
   656                             MethodSymbol sym)
   657         {
   658             this.mods = mods;
   659             this.name = name;
   660             this.restype = restype;
   661             this.typarams = typarams;
   662             this.params = params;
   663             this.thrown = thrown;
   664             this.body = body;
   665             this.defaultValue = defaultValue;
   666             this.sym = sym;
   667         }
   668         @Override
   669         public void accept(Visitor v) { v.visitMethodDef(this); }
   671         public Kind getKind() { return Kind.METHOD; }
   672         public JCModifiers getModifiers() { return mods; }
   673         public Name getName() { return name; }
   674         public JCTree getReturnType() { return restype; }
   675         public List<JCTypeParameter> getTypeParameters() {
   676             return typarams;
   677         }
   678         public List<JCVariableDecl> getParameters() {
   679             return params;
   680         }
   681         public List<JCExpression> getThrows() {
   682             return thrown;
   683         }
   684         public JCBlock getBody() { return body; }
   685         public JCTree getDefaultValue() { // for annotation types
   686             return defaultValue;
   687         }
   688         @Override
   689         public <R,D> R accept(TreeVisitor<R,D> v, D d) {
   690             return v.visitMethod(this, d);
   691         }
   693         @Override
   694         public int getTag() {
   695             return METHODDEF;
   696         }
   697   }
   699     /**
   700      * A variable definition.
   701      * @param modifiers variable modifiers
   702      * @param name variable name
   703      * @param vartype type of the variable
   704      * @param init variables initial value
   705      * @param sym symbol
   706      */
   707     public static class JCVariableDecl extends JCStatement implements VariableTree {
   708         public JCModifiers mods;
   709         public Name name;
   710         public JCExpression vartype;
   711         public JCExpression init;
   712         public VarSymbol sym;
   713         protected JCVariableDecl(JCModifiers mods,
   714                          Name name,
   715                          JCExpression vartype,
   716                          JCExpression init,
   717                          VarSymbol sym) {
   718             this.mods = mods;
   719             this.name = name;
   720             this.vartype = vartype;
   721             this.init = init;
   722             this.sym = sym;
   723         }
   724         @Override
   725         public void accept(Visitor v) { v.visitVarDef(this); }
   727         public Kind getKind() { return Kind.VARIABLE; }
   728         public JCModifiers getModifiers() { return mods; }
   729         public Name getName() { return name; }
   730         public JCTree getType() { return vartype; }
   731         public JCExpression getInitializer() {
   732             return init;
   733         }
   734         @Override
   735         public <R,D> R accept(TreeVisitor<R,D> v, D d) {
   736             return v.visitVariable(this, d);
   737         }
   739         @Override
   740         public int getTag() {
   741             return VARDEF;
   742         }
   743     }
   745       /**
   746      * A no-op statement ";".
   747      */
   748     public static class JCSkip extends JCStatement implements EmptyStatementTree {
   749         protected JCSkip() {
   750         }
   751         @Override
   752         public void accept(Visitor v) { v.visitSkip(this); }
   754         public Kind getKind() { return Kind.EMPTY_STATEMENT; }
   755         @Override
   756         public <R,D> R accept(TreeVisitor<R,D> v, D d) {
   757             return v.visitEmptyStatement(this, d);
   758         }
   760         @Override
   761         public int getTag() {
   762             return SKIP;
   763         }
   764     }
   766     /**
   767      * A statement block.
   768      * @param stats statements
   769      * @param flags flags
   770      */
   771     public static class JCBlock extends JCStatement implements BlockTree {
   772         public long flags;
   773         public List<JCStatement> stats;
   774         /** Position of closing brace, optional. */
   775         public int endpos = Position.NOPOS;
   776         protected JCBlock(long flags, List<JCStatement> stats) {
   777             this.stats = stats;
   778             this.flags = flags;
   779         }
   780         @Override
   781         public void accept(Visitor v) { v.visitBlock(this); }
   783         public Kind getKind() { return Kind.BLOCK; }
   784         public List<JCStatement> getStatements() {
   785             return stats;
   786         }
   787         public boolean isStatic() { return (flags & Flags.STATIC) != 0; }
   788         @Override
   789         public <R,D> R accept(TreeVisitor<R,D> v, D d) {
   790             return v.visitBlock(this, d);
   791         }
   793         @Override
   794         public int getTag() {
   795             return BLOCK;
   796         }
   797     }
   799     /**
   800      * A do loop
   801      */
   802     public static class JCDoWhileLoop extends JCStatement implements DoWhileLoopTree {
   803         public JCStatement body;
   804         public JCExpression cond;
   805         protected JCDoWhileLoop(JCStatement body, JCExpression cond) {
   806             this.body = body;
   807             this.cond = cond;
   808         }
   809         @Override
   810         public void accept(Visitor v) { v.visitDoLoop(this); }
   812         public Kind getKind() { return Kind.DO_WHILE_LOOP; }
   813         public JCExpression getCondition() { return cond; }
   814         public JCStatement getStatement() { return body; }
   815         @Override
   816         public <R,D> R accept(TreeVisitor<R,D> v, D d) {
   817             return v.visitDoWhileLoop(this, d);
   818         }
   820         @Override
   821         public int getTag() {
   822             return DOLOOP;
   823         }
   824     }
   826     /**
   827      * A while loop
   828      */
   829     public static class JCWhileLoop extends JCStatement implements WhileLoopTree {
   830         public JCExpression cond;
   831         public JCStatement body;
   832         protected JCWhileLoop(JCExpression cond, JCStatement body) {
   833             this.cond = cond;
   834             this.body = body;
   835         }
   836         @Override
   837         public void accept(Visitor v) { v.visitWhileLoop(this); }
   839         public Kind getKind() { return Kind.WHILE_LOOP; }
   840         public JCExpression getCondition() { return cond; }
   841         public JCStatement getStatement() { return body; }
   842         @Override
   843         public <R,D> R accept(TreeVisitor<R,D> v, D d) {
   844             return v.visitWhileLoop(this, d);
   845         }
   847         @Override
   848         public int getTag() {
   849             return WHILELOOP;
   850         }
   851     }
   853     /**
   854      * A for loop.
   855      */
   856     public static class JCForLoop extends JCStatement implements ForLoopTree {
   857         public List<JCStatement> init;
   858         public JCExpression cond;
   859         public List<JCExpressionStatement> step;
   860         public JCStatement body;
   861         protected JCForLoop(List<JCStatement> init,
   862                           JCExpression cond,
   863                           List<JCExpressionStatement> update,
   864                           JCStatement body)
   865         {
   866             this.init = init;
   867             this.cond = cond;
   868             this.step = update;
   869             this.body = body;
   870         }
   871         @Override
   872         public void accept(Visitor v) { v.visitForLoop(this); }
   874         public Kind getKind() { return Kind.FOR_LOOP; }
   875         public JCExpression getCondition() { return cond; }
   876         public JCStatement getStatement() { return body; }
   877         public List<JCStatement> getInitializer() {
   878             return init;
   879         }
   880         public List<JCExpressionStatement> getUpdate() {
   881             return step;
   882         }
   883         @Override
   884         public <R,D> R accept(TreeVisitor<R,D> v, D d) {
   885             return v.visitForLoop(this, d);
   886         }
   888         @Override
   889         public int getTag() {
   890             return FORLOOP;
   891         }
   892     }
   894     /**
   895      * The enhanced for loop.
   896      */
   897     public static class JCEnhancedForLoop extends JCStatement implements EnhancedForLoopTree {
   898         public JCVariableDecl var;
   899         public JCExpression expr;
   900         public JCStatement body;
   901         protected JCEnhancedForLoop(JCVariableDecl var, JCExpression expr, JCStatement body) {
   902             this.var = var;
   903             this.expr = expr;
   904             this.body = body;
   905         }
   906         @Override
   907         public void accept(Visitor v) { v.visitForeachLoop(this); }
   909         public Kind getKind() { return Kind.ENHANCED_FOR_LOOP; }
   910         public JCVariableDecl getVariable() { return var; }
   911         public JCExpression getExpression() { return expr; }
   912         public JCStatement getStatement() { return body; }
   913         @Override
   914         public <R,D> R accept(TreeVisitor<R,D> v, D d) {
   915             return v.visitEnhancedForLoop(this, d);
   916         }
   917         @Override
   918         public int getTag() {
   919             return FOREACHLOOP;
   920         }
   921     }
   923     /**
   924      * A labelled expression or statement.
   925      */
   926     public static class JCLabeledStatement extends JCStatement implements LabeledStatementTree {
   927         public Name label;
   928         public JCStatement body;
   929         protected JCLabeledStatement(Name label, JCStatement body) {
   930             this.label = label;
   931             this.body = body;
   932         }
   933         @Override
   934         public void accept(Visitor v) { v.visitLabelled(this); }
   935         public Kind getKind() { return Kind.LABELED_STATEMENT; }
   936         public Name getLabel() { return label; }
   937         public JCStatement getStatement() { return body; }
   938         @Override
   939         public <R,D> R accept(TreeVisitor<R,D> v, D d) {
   940             return v.visitLabeledStatement(this, d);
   941         }
   942         @Override
   943         public int getTag() {
   944             return LABELLED;
   945         }
   946     }
   948     /**
   949      * A "switch ( ) { }" construction.
   950      */
   951     public static class JCSwitch extends JCStatement implements SwitchTree {
   952         public JCExpression selector;
   953         public List<JCCase> cases;
   954         protected JCSwitch(JCExpression selector, List<JCCase> cases) {
   955             this.selector = selector;
   956             this.cases = cases;
   957         }
   958         @Override
   959         public void accept(Visitor v) { v.visitSwitch(this); }
   961         public Kind getKind() { return Kind.SWITCH; }
   962         public JCExpression getExpression() { return selector; }
   963         public List<JCCase> getCases() { return cases; }
   964         @Override
   965         public <R,D> R accept(TreeVisitor<R,D> v, D d) {
   966             return v.visitSwitch(this, d);
   967         }
   968         @Override
   969         public int getTag() {
   970             return SWITCH;
   971         }
   972     }
   974     /**
   975      * A "case  :" of a switch.
   976      */
   977     public static class JCCase extends JCStatement implements CaseTree {
   978         public JCExpression pat;
   979         public List<JCStatement> stats;
   980         protected JCCase(JCExpression pat, List<JCStatement> stats) {
   981             this.pat = pat;
   982             this.stats = stats;
   983         }
   984         @Override
   985         public void accept(Visitor v) { v.visitCase(this); }
   987         public Kind getKind() { return Kind.CASE; }
   988         public JCExpression getExpression() { return pat; }
   989         public List<JCStatement> getStatements() { return stats; }
   990         @Override
   991         public <R,D> R accept(TreeVisitor<R,D> v, D d) {
   992             return v.visitCase(this, d);
   993         }
   994         @Override
   995         public int getTag() {
   996             return CASE;
   997         }
   998     }
  1000     /**
  1001      * A synchronized block.
  1002      */
  1003     public static class JCSynchronized extends JCStatement implements SynchronizedTree {
  1004         public JCExpression lock;
  1005         public JCBlock body;
  1006         protected JCSynchronized(JCExpression lock, JCBlock body) {
  1007             this.lock = lock;
  1008             this.body = body;
  1010         @Override
  1011         public void accept(Visitor v) { v.visitSynchronized(this); }
  1013         public Kind getKind() { return Kind.SYNCHRONIZED; }
  1014         public JCExpression getExpression() { return lock; }
  1015         public JCBlock getBlock() { return body; }
  1016         @Override
  1017         public <R,D> R accept(TreeVisitor<R,D> v, D d) {
  1018             return v.visitSynchronized(this, d);
  1020         @Override
  1021         public int getTag() {
  1022             return SYNCHRONIZED;
  1026     /**
  1027      * A "try { } catch ( ) { } finally { }" block.
  1028      */
  1029     public static class JCTry extends JCStatement implements TryTree {
  1030         public JCBlock body;
  1031         public List<JCCatch> catchers;
  1032         public JCBlock finalizer;
  1033         public List<JCTree> resources;
  1034         protected JCTry(List<JCTree> resources,
  1035                         JCBlock body,
  1036                         List<JCCatch> catchers,
  1037                         JCBlock finalizer) {
  1038             this.body = body;
  1039             this.catchers = catchers;
  1040             this.finalizer = finalizer;
  1041             this.resources = resources;
  1043         @Override
  1044         public void accept(Visitor v) { v.visitTry(this); }
  1046         public Kind getKind() { return Kind.TRY; }
  1047         public JCBlock getBlock() { return body; }
  1048         public List<JCCatch> getCatches() {
  1049             return catchers;
  1051         public JCBlock getFinallyBlock() { return finalizer; }
  1052         @Override
  1053         public <R,D> R accept(TreeVisitor<R,D> v, D d) {
  1054             return v.visitTry(this, d);
  1056         @Override
  1057         public List<? extends JCTree> getResources() {
  1058             return resources;
  1060         @Override
  1061         public int getTag() {
  1062             return TRY;
  1066     /**
  1067      * A catch block.
  1068      */
  1069     public static class JCCatch extends JCTree implements CatchTree {
  1070         public JCVariableDecl param;
  1071         public JCBlock body;
  1072         protected JCCatch(JCVariableDecl param, JCBlock body) {
  1073             this.param = param;
  1074             this.body = body;
  1076         @Override
  1077         public void accept(Visitor v) { v.visitCatch(this); }
  1079         public Kind getKind() { return Kind.CATCH; }
  1080         public JCVariableDecl getParameter() { return param; }
  1081         public JCBlock getBlock() { return body; }
  1082         @Override
  1083         public <R,D> R accept(TreeVisitor<R,D> v, D d) {
  1084             return v.visitCatch(this, d);
  1086         @Override
  1087         public int getTag() {
  1088             return CATCH;
  1092     /**
  1093      * A ( ) ? ( ) : ( ) conditional expression
  1094      */
  1095     public static class JCConditional extends JCExpression implements ConditionalExpressionTree {
  1096         public JCExpression cond;
  1097         public JCExpression truepart;
  1098         public JCExpression falsepart;
  1099         protected JCConditional(JCExpression cond,
  1100                               JCExpression truepart,
  1101                               JCExpression falsepart)
  1103             this.cond = cond;
  1104             this.truepart = truepart;
  1105             this.falsepart = falsepart;
  1107         @Override
  1108         public void accept(Visitor v) { v.visitConditional(this); }
  1110         public Kind getKind() { return Kind.CONDITIONAL_EXPRESSION; }
  1111         public JCExpression getCondition() { return cond; }
  1112         public JCExpression getTrueExpression() { return truepart; }
  1113         public JCExpression getFalseExpression() { return falsepart; }
  1114         @Override
  1115         public <R,D> R accept(TreeVisitor<R,D> v, D d) {
  1116             return v.visitConditionalExpression(this, d);
  1118         @Override
  1119         public int getTag() {
  1120             return CONDEXPR;
  1124     /**
  1125      * An "if ( ) { } else { }" block
  1126      */
  1127     public static class JCIf extends JCStatement implements IfTree {
  1128         public JCExpression cond;
  1129         public JCStatement thenpart;
  1130         public JCStatement elsepart;
  1131         protected JCIf(JCExpression cond,
  1132                      JCStatement thenpart,
  1133                      JCStatement elsepart)
  1135             this.cond = cond;
  1136             this.thenpart = thenpart;
  1137             this.elsepart = elsepart;
  1139         @Override
  1140         public void accept(Visitor v) { v.visitIf(this); }
  1142         public Kind getKind() { return Kind.IF; }
  1143         public JCExpression getCondition() { return cond; }
  1144         public JCStatement getThenStatement() { return thenpart; }
  1145         public JCStatement getElseStatement() { return elsepart; }
  1146         @Override
  1147         public <R,D> R accept(TreeVisitor<R,D> v, D d) {
  1148             return v.visitIf(this, d);
  1150         @Override
  1151         public int getTag() {
  1152             return IF;
  1156     /**
  1157      * an expression statement
  1158      * @param expr expression structure
  1159      */
  1160     public static class JCExpressionStatement extends JCStatement implements ExpressionStatementTree {
  1161         public JCExpression expr;
  1162         protected JCExpressionStatement(JCExpression expr)
  1164             this.expr = expr;
  1166         @Override
  1167         public void accept(Visitor v) { v.visitExec(this); }
  1169         public Kind getKind() { return Kind.EXPRESSION_STATEMENT; }
  1170         public JCExpression getExpression() { return expr; }
  1171         @Override
  1172         public <R,D> R accept(TreeVisitor<R,D> v, D d) {
  1173             return v.visitExpressionStatement(this, d);
  1175         @Override
  1176         public int getTag() {
  1177             return EXEC;
  1181     /**
  1182      * A break from a loop or switch.
  1183      */
  1184     public static class JCBreak extends JCStatement implements BreakTree {
  1185         public Name label;
  1186         public JCTree target;
  1187         protected JCBreak(Name label, JCTree target) {
  1188             this.label = label;
  1189             this.target = target;
  1191         @Override
  1192         public void accept(Visitor v) { v.visitBreak(this); }
  1194         public Kind getKind() { return Kind.BREAK; }
  1195         public Name getLabel() { return label; }
  1196         @Override
  1197         public <R,D> R accept(TreeVisitor<R,D> v, D d) {
  1198             return v.visitBreak(this, d);
  1200         @Override
  1201         public int getTag() {
  1202             return BREAK;
  1206     /**
  1207      * A continue of a loop.
  1208      */
  1209     public static class JCContinue extends JCStatement implements ContinueTree {
  1210         public Name label;
  1211         public JCTree target;
  1212         protected JCContinue(Name label, JCTree target) {
  1213             this.label = label;
  1214             this.target = target;
  1216         @Override
  1217         public void accept(Visitor v) { v.visitContinue(this); }
  1219         public Kind getKind() { return Kind.CONTINUE; }
  1220         public Name getLabel() { return label; }
  1221         @Override
  1222         public <R,D> R accept(TreeVisitor<R,D> v, D d) {
  1223             return v.visitContinue(this, d);
  1225         @Override
  1226         public int getTag() {
  1227             return CONTINUE;
  1231     /**
  1232      * A return statement.
  1233      */
  1234     public static class JCReturn extends JCStatement implements ReturnTree {
  1235         public JCExpression expr;
  1236         protected JCReturn(JCExpression expr) {
  1237             this.expr = expr;
  1239         @Override
  1240         public void accept(Visitor v) { v.visitReturn(this); }
  1242         public Kind getKind() { return Kind.RETURN; }
  1243         public JCExpression getExpression() { return expr; }
  1244         @Override
  1245         public <R,D> R accept(TreeVisitor<R,D> v, D d) {
  1246             return v.visitReturn(this, d);
  1248         @Override
  1249         public int getTag() {
  1250             return RETURN;
  1254     /**
  1255      * A throw statement.
  1256      */
  1257     public static class JCThrow extends JCStatement implements ThrowTree {
  1258         public JCExpression expr;
  1259         protected JCThrow(JCTree expr) {
  1260             this.expr = (JCExpression)expr;
  1262         @Override
  1263         public void accept(Visitor v) { v.visitThrow(this); }
  1265         public Kind getKind() { return Kind.THROW; }
  1266         public JCExpression getExpression() { return expr; }
  1267         @Override
  1268         public <R,D> R accept(TreeVisitor<R,D> v, D d) {
  1269             return v.visitThrow(this, d);
  1271         @Override
  1272         public int getTag() {
  1273             return THROW;
  1277     /**
  1278      * An assert statement.
  1279      */
  1280     public static class JCAssert extends JCStatement implements AssertTree {
  1281         public JCExpression cond;
  1282         public JCExpression detail;
  1283         protected JCAssert(JCExpression cond, JCExpression detail) {
  1284             this.cond = cond;
  1285             this.detail = detail;
  1287         @Override
  1288         public void accept(Visitor v) { v.visitAssert(this); }
  1290         public Kind getKind() { return Kind.ASSERT; }
  1291         public JCExpression getCondition() { return cond; }
  1292         public JCExpression getDetail() { return detail; }
  1293         @Override
  1294         public <R,D> R accept(TreeVisitor<R,D> v, D d) {
  1295             return v.visitAssert(this, d);
  1297         @Override
  1298         public int getTag() {
  1299             return ASSERT;
  1303     /**
  1304      * A method invocation
  1305      */
  1306     public static class JCMethodInvocation extends JCExpression implements MethodInvocationTree {
  1307         public List<JCExpression> typeargs;
  1308         public JCExpression meth;
  1309         public List<JCExpression> args;
  1310         public Type varargsElement;
  1311         protected JCMethodInvocation(List<JCExpression> typeargs,
  1312                         JCExpression meth,
  1313                         List<JCExpression> args)
  1315             this.typeargs = (typeargs == null) ? List.<JCExpression>nil()
  1316                                                : typeargs;
  1317             this.meth = meth;
  1318             this.args = args;
  1320         @Override
  1321         public void accept(Visitor v) { v.visitApply(this); }
  1323         public Kind getKind() { return Kind.METHOD_INVOCATION; }
  1324         public List<JCExpression> getTypeArguments() {
  1325             return typeargs;
  1327         public JCExpression getMethodSelect() { return meth; }
  1328         public List<JCExpression> getArguments() {
  1329             return args;
  1331         @Override
  1332         public <R,D> R accept(TreeVisitor<R,D> v, D d) {
  1333             return v.visitMethodInvocation(this, d);
  1335         @Override
  1336         public JCMethodInvocation setType(Type type) {
  1337             super.setType(type);
  1338             return this;
  1340         @Override
  1341         public int getTag() {
  1342             return(APPLY);
  1346     /**
  1347      * A new(...) operation.
  1348      */
  1349     public static class JCNewClass extends JCExpression implements NewClassTree {
  1350         public JCExpression encl;
  1351         public List<JCExpression> typeargs;
  1352         public JCExpression clazz;
  1353         public List<JCExpression> args;
  1354         public JCClassDecl def;
  1355         public Symbol constructor;
  1356         public Type varargsElement;
  1357         public Type constructorType;
  1358         protected JCNewClass(JCExpression encl,
  1359                            List<JCExpression> typeargs,
  1360                            JCExpression clazz,
  1361                            List<JCExpression> args,
  1362                            JCClassDecl def)
  1364             this.encl = encl;
  1365             this.typeargs = (typeargs == null) ? List.<JCExpression>nil()
  1366                                                : typeargs;
  1367             this.clazz = clazz;
  1368             this.args = args;
  1369             this.def = def;
  1371         @Override
  1372         public void accept(Visitor v) { v.visitNewClass(this); }
  1374         public Kind getKind() { return Kind.NEW_CLASS; }
  1375         public JCExpression getEnclosingExpression() { // expr.new C< ... > ( ... )
  1376             return encl;
  1378         public List<JCExpression> getTypeArguments() {
  1379             return typeargs;
  1381         public JCExpression getIdentifier() { return clazz; }
  1382         public List<JCExpression> getArguments() {
  1383             return args;
  1385         public JCClassDecl getClassBody() { return def; }
  1386         @Override
  1387         public <R,D> R accept(TreeVisitor<R,D> v, D d) {
  1388             return v.visitNewClass(this, d);
  1390         @Override
  1391         public int getTag() {
  1392             return NEWCLASS;
  1396     /**
  1397      * A new[...] operation.
  1398      */
  1399     public static class JCNewArray extends JCExpression implements NewArrayTree {
  1400         public JCExpression elemtype;
  1401         public List<JCExpression> dims;
  1402         public List<JCExpression> elems;
  1403         protected JCNewArray(JCExpression elemtype,
  1404                            List<JCExpression> dims,
  1405                            List<JCExpression> elems)
  1407             this.elemtype = elemtype;
  1408             this.dims = dims;
  1409             this.elems = elems;
  1411         @Override
  1412         public void accept(Visitor v) { v.visitNewArray(this); }
  1414         public Kind getKind() { return Kind.NEW_ARRAY; }
  1415         public JCExpression getType() { return elemtype; }
  1416         public List<JCExpression> getDimensions() {
  1417             return dims;
  1419         public List<JCExpression> getInitializers() {
  1420             return elems;
  1422         @Override
  1423         public <R,D> R accept(TreeVisitor<R,D> v, D d) {
  1424             return v.visitNewArray(this, d);
  1426         @Override
  1427         public int getTag() {
  1428             return NEWARRAY;
  1432     /**
  1433      * A parenthesized subexpression ( ... )
  1434      */
  1435     public static class JCParens extends JCExpression implements ParenthesizedTree {
  1436         public JCExpression expr;
  1437         protected JCParens(JCExpression expr) {
  1438             this.expr = expr;
  1440         @Override
  1441         public void accept(Visitor v) { v.visitParens(this); }
  1443         public Kind getKind() { return Kind.PARENTHESIZED; }
  1444         public JCExpression getExpression() { return expr; }
  1445         @Override
  1446         public <R,D> R accept(TreeVisitor<R,D> v, D d) {
  1447             return v.visitParenthesized(this, d);
  1449         @Override
  1450         public int getTag() {
  1451             return PARENS;
  1455     /**
  1456      * A assignment with "=".
  1457      */
  1458     public static class JCAssign extends JCExpression implements AssignmentTree {
  1459         public JCExpression lhs;
  1460         public JCExpression rhs;
  1461         protected JCAssign(JCExpression lhs, JCExpression rhs) {
  1462             this.lhs = lhs;
  1463             this.rhs = rhs;
  1465         @Override
  1466         public void accept(Visitor v) { v.visitAssign(this); }
  1468         public Kind getKind() { return Kind.ASSIGNMENT; }
  1469         public JCExpression getVariable() { return lhs; }
  1470         public JCExpression getExpression() { return rhs; }
  1471         @Override
  1472         public <R,D> R accept(TreeVisitor<R,D> v, D d) {
  1473             return v.visitAssignment(this, d);
  1475         @Override
  1476         public int getTag() {
  1477             return ASSIGN;
  1481     /**
  1482      * An assignment with "+=", "|=" ...
  1483      */
  1484     public static class JCAssignOp extends JCExpression implements CompoundAssignmentTree {
  1485         private int opcode;
  1486         public JCExpression lhs;
  1487         public JCExpression rhs;
  1488         public Symbol operator;
  1489         protected JCAssignOp(int opcode, JCTree lhs, JCTree rhs, Symbol operator) {
  1490             this.opcode = opcode;
  1491             this.lhs = (JCExpression)lhs;
  1492             this.rhs = (JCExpression)rhs;
  1493             this.operator = operator;
  1495         @Override
  1496         public void accept(Visitor v) { v.visitAssignop(this); }
  1498         public Kind getKind() { return TreeInfo.tagToKind(getTag()); }
  1499         public JCExpression getVariable() { return lhs; }
  1500         public JCExpression getExpression() { return rhs; }
  1501         public Symbol getOperator() {
  1502             return operator;
  1504         @Override
  1505         public <R,D> R accept(TreeVisitor<R,D> v, D d) {
  1506             return v.visitCompoundAssignment(this, d);
  1508         @Override
  1509         public int getTag() {
  1510             return opcode;
  1514     /**
  1515      * A unary operation.
  1516      */
  1517     public static class JCUnary extends JCExpression implements UnaryTree {
  1518         private int opcode;
  1519         public JCExpression arg;
  1520         public Symbol operator;
  1521         protected JCUnary(int opcode, JCExpression arg) {
  1522             this.opcode = opcode;
  1523             this.arg = arg;
  1525         @Override
  1526         public void accept(Visitor v) { v.visitUnary(this); }
  1528         public Kind getKind() { return TreeInfo.tagToKind(getTag()); }
  1529         public JCExpression getExpression() { return arg; }
  1530         public Symbol getOperator() {
  1531             return operator;
  1533         @Override
  1534         public <R,D> R accept(TreeVisitor<R,D> v, D d) {
  1535             return v.visitUnary(this, d);
  1537         @Override
  1538         public int getTag() {
  1539             return opcode;
  1542         public void setTag(int tag) {
  1543             opcode = tag;
  1547     /**
  1548      * A binary operation.
  1549      */
  1550     public static class JCBinary extends JCExpression implements BinaryTree {
  1551         private int opcode;
  1552         public JCExpression lhs;
  1553         public JCExpression rhs;
  1554         public Symbol operator;
  1555         protected JCBinary(int opcode,
  1556                          JCExpression lhs,
  1557                          JCExpression rhs,
  1558                          Symbol operator) {
  1559             this.opcode = opcode;
  1560             this.lhs = lhs;
  1561             this.rhs = rhs;
  1562             this.operator = operator;
  1564         @Override
  1565         public void accept(Visitor v) { v.visitBinary(this); }
  1567         public Kind getKind() { return TreeInfo.tagToKind(getTag()); }
  1568         public JCExpression getLeftOperand() { return lhs; }
  1569         public JCExpression getRightOperand() { return rhs; }
  1570         public Symbol getOperator() {
  1571             return operator;
  1573         @Override
  1574         public <R,D> R accept(TreeVisitor<R,D> v, D d) {
  1575             return v.visitBinary(this, d);
  1577         @Override
  1578         public int getTag() {
  1579             return opcode;
  1583     /**
  1584      * A type cast.
  1585      */
  1586     public static class JCTypeCast extends JCExpression implements TypeCastTree {
  1587         public JCTree clazz;
  1588         public JCExpression expr;
  1589         protected JCTypeCast(JCTree clazz, JCExpression expr) {
  1590             this.clazz = clazz;
  1591             this.expr = expr;
  1593         @Override
  1594         public void accept(Visitor v) { v.visitTypeCast(this); }
  1596         public Kind getKind() { return Kind.TYPE_CAST; }
  1597         public JCTree getType() { return clazz; }
  1598         public JCExpression getExpression() { return expr; }
  1599         @Override
  1600         public <R,D> R accept(TreeVisitor<R,D> v, D d) {
  1601             return v.visitTypeCast(this, d);
  1603         @Override
  1604         public int getTag() {
  1605             return TYPECAST;
  1609     /**
  1610      * A type test.
  1611      */
  1612     public static class JCInstanceOf extends JCExpression implements InstanceOfTree {
  1613         public JCExpression expr;
  1614         public JCTree clazz;
  1615         protected JCInstanceOf(JCExpression expr, JCTree clazz) {
  1616             this.expr = expr;
  1617             this.clazz = clazz;
  1619         @Override
  1620         public void accept(Visitor v) { v.visitTypeTest(this); }
  1622         public Kind getKind() { return Kind.INSTANCE_OF; }
  1623         public JCTree getType() { return clazz; }
  1624         public JCExpression getExpression() { return expr; }
  1625         @Override
  1626         public <R,D> R accept(TreeVisitor<R,D> v, D d) {
  1627             return v.visitInstanceOf(this, d);
  1629         @Override
  1630         public int getTag() {
  1631             return TYPETEST;
  1635     /**
  1636      * An array selection
  1637      */
  1638     public static class JCArrayAccess extends JCExpression implements ArrayAccessTree {
  1639         public JCExpression indexed;
  1640         public JCExpression index;
  1641         protected JCArrayAccess(JCExpression indexed, JCExpression index) {
  1642             this.indexed = indexed;
  1643             this.index = index;
  1645         @Override
  1646         public void accept(Visitor v) { v.visitIndexed(this); }
  1648         public Kind getKind() { return Kind.ARRAY_ACCESS; }
  1649         public JCExpression getExpression() { return indexed; }
  1650         public JCExpression getIndex() { return index; }
  1651         @Override
  1652         public <R,D> R accept(TreeVisitor<R,D> v, D d) {
  1653             return v.visitArrayAccess(this, d);
  1655         @Override
  1656         public int getTag() {
  1657             return INDEXED;
  1661     /**
  1662      * Selects through packages and classes
  1663      * @param selected selected Tree hierarchie
  1664      * @param selector name of field to select thru
  1665      * @param sym symbol of the selected class
  1666      */
  1667     public static class JCFieldAccess extends JCExpression implements MemberSelectTree {
  1668         public JCExpression selected;
  1669         public Name name;
  1670         public Symbol sym;
  1671         protected JCFieldAccess(JCExpression selected, Name name, Symbol sym) {
  1672             this.selected = selected;
  1673             this.name = name;
  1674             this.sym = sym;
  1676         @Override
  1677         public void accept(Visitor v) { v.visitSelect(this); }
  1679         public Kind getKind() { return Kind.MEMBER_SELECT; }
  1680         public JCExpression getExpression() { return selected; }
  1681         @Override
  1682         public <R,D> R accept(TreeVisitor<R,D> v, D d) {
  1683             return v.visitMemberSelect(this, d);
  1685         public Name getIdentifier() { return name; }
  1686         @Override
  1687         public int getTag() {
  1688             return SELECT;
  1692     /**
  1693      * An identifier
  1694      * @param idname the name
  1695      * @param sym the symbol
  1696      */
  1697     public static class JCIdent extends JCExpression implements IdentifierTree {
  1698         public Name name;
  1699         public Symbol sym;
  1700         protected JCIdent(Name name, Symbol sym) {
  1701             this.name = name;
  1702             this.sym = sym;
  1704         @Override
  1705         public void accept(Visitor v) { v.visitIdent(this); }
  1707         public Kind getKind() { return Kind.IDENTIFIER; }
  1708         public Name getName() { return name; }
  1709         @Override
  1710         public <R,D> R accept(TreeVisitor<R,D> v, D d) {
  1711             return v.visitIdentifier(this, d);
  1713         public int getTag() {
  1714             return IDENT;
  1718     /**
  1719      * A constant value given literally.
  1720      * @param value value representation
  1721      */
  1722     public static class JCLiteral extends JCExpression implements LiteralTree {
  1723         public int typetag;
  1724         public Object value;
  1725         protected JCLiteral(int typetag, Object value) {
  1726             this.typetag = typetag;
  1727             this.value = value;
  1729         @Override
  1730         public void accept(Visitor v) { v.visitLiteral(this); }
  1732         public Kind getKind() {
  1733             switch (typetag) {
  1734             case TypeTags.INT:
  1735                 return Kind.INT_LITERAL;
  1736             case TypeTags.LONG:
  1737                 return Kind.LONG_LITERAL;
  1738             case TypeTags.FLOAT:
  1739                 return Kind.FLOAT_LITERAL;
  1740             case TypeTags.DOUBLE:
  1741                 return Kind.DOUBLE_LITERAL;
  1742             case TypeTags.BOOLEAN:
  1743                 return Kind.BOOLEAN_LITERAL;
  1744             case TypeTags.CHAR:
  1745                 return Kind.CHAR_LITERAL;
  1746             case TypeTags.CLASS:
  1747                 return Kind.STRING_LITERAL;
  1748             case TypeTags.BOT:
  1749                 return Kind.NULL_LITERAL;
  1750             default:
  1751                 throw new AssertionError("unknown literal kind " + this);
  1754         public Object getValue() {
  1755             switch (typetag) {
  1756                 case TypeTags.BOOLEAN:
  1757                     int bi = (Integer) value;
  1758                     return (bi != 0);
  1759                 case TypeTags.CHAR:
  1760                     int ci = (Integer) value;
  1761                     char c = (char) ci;
  1762                     if (c != ci)
  1763                         throw new AssertionError("bad value for char literal");
  1764                     return c;
  1765                 default:
  1766                     return value;
  1769         @Override
  1770         public <R,D> R accept(TreeVisitor<R,D> v, D d) {
  1771             return v.visitLiteral(this, d);
  1773         @Override
  1774         public JCLiteral setType(Type type) {
  1775             super.setType(type);
  1776             return this;
  1778         @Override
  1779         public int getTag() {
  1780             return LITERAL;
  1784     /**
  1785      * Identifies a basic type.
  1786      * @param tag the basic type id
  1787      * @see TypeTags
  1788      */
  1789     public static class JCPrimitiveTypeTree extends JCExpression implements PrimitiveTypeTree {
  1790         public int typetag;
  1791         protected JCPrimitiveTypeTree(int typetag) {
  1792             this.typetag = typetag;
  1794         @Override
  1795         public void accept(Visitor v) { v.visitTypeIdent(this); }
  1797         public Kind getKind() { return Kind.PRIMITIVE_TYPE; }
  1798         public TypeKind getPrimitiveTypeKind() {
  1799             switch (typetag) {
  1800             case TypeTags.BOOLEAN:
  1801                 return TypeKind.BOOLEAN;
  1802             case TypeTags.BYTE:
  1803                 return TypeKind.BYTE;
  1804             case TypeTags.SHORT:
  1805                 return TypeKind.SHORT;
  1806             case TypeTags.INT:
  1807                 return TypeKind.INT;
  1808             case TypeTags.LONG:
  1809                 return TypeKind.LONG;
  1810             case TypeTags.CHAR:
  1811                 return TypeKind.CHAR;
  1812             case TypeTags.FLOAT:
  1813                 return TypeKind.FLOAT;
  1814             case TypeTags.DOUBLE:
  1815                 return TypeKind.DOUBLE;
  1816             case TypeTags.VOID:
  1817                 return TypeKind.VOID;
  1818             default:
  1819                 throw new AssertionError("unknown primitive type " + this);
  1822         @Override
  1823         public <R,D> R accept(TreeVisitor<R,D> v, D d) {
  1824             return v.visitPrimitiveType(this, d);
  1826         @Override
  1827         public int getTag() {
  1828             return TYPEIDENT;
  1832     /**
  1833      * An array type, A[]
  1834      */
  1835     public static class JCArrayTypeTree extends JCExpression implements ArrayTypeTree {
  1836         public JCExpression elemtype;
  1837         protected JCArrayTypeTree(JCExpression elemtype) {
  1838             this.elemtype = elemtype;
  1840         @Override
  1841         public void accept(Visitor v) { v.visitTypeArray(this); }
  1843         public Kind getKind() { return Kind.ARRAY_TYPE; }
  1844         public JCTree getType() { return elemtype; }
  1845         @Override
  1846         public <R,D> R accept(TreeVisitor<R,D> v, D d) {
  1847             return v.visitArrayType(this, d);
  1849         @Override
  1850         public int getTag() {
  1851             return TYPEARRAY;
  1855     /**
  1856      * A parameterized type, T<...>
  1857      */
  1858     public static class JCTypeApply extends JCExpression implements ParameterizedTypeTree {
  1859         public JCExpression clazz;
  1860         public List<JCExpression> arguments;
  1861         protected JCTypeApply(JCExpression clazz, List<JCExpression> arguments) {
  1862             this.clazz = clazz;
  1863             this.arguments = arguments;
  1865         @Override
  1866         public void accept(Visitor v) { v.visitTypeApply(this); }
  1868         public Kind getKind() { return Kind.PARAMETERIZED_TYPE; }
  1869         public JCTree getType() { return clazz; }
  1870         public List<JCExpression> getTypeArguments() {
  1871             return arguments;
  1873         @Override
  1874         public <R,D> R accept(TreeVisitor<R,D> v, D d) {
  1875             return v.visitParameterizedType(this, d);
  1877         @Override
  1878         public int getTag() {
  1879             return TYPEAPPLY;
  1883     /**
  1884      * A union type, T1 | T2 | ... Tn (used in multicatch statements)
  1885      */
  1886     public static class JCTypeUnion extends JCExpression implements UnionTypeTree {
  1888         public List<JCExpression> alternatives;
  1890         protected JCTypeUnion(List<JCExpression> components) {
  1891             this.alternatives = components;
  1893         @Override
  1894         public void accept(Visitor v) { v.visitTypeUnion(this); }
  1896         public Kind getKind() { return Kind.UNION_TYPE; }
  1898         public List<JCExpression> getTypeAlternatives() {
  1899             return alternatives;
  1901         @Override
  1902         public <R,D> R accept(TreeVisitor<R,D> v, D d) {
  1903             return v.visitUnionType(this, d);
  1905         @Override
  1906         public int getTag() {
  1907             return TYPEUNION;
  1911     /**
  1912      * A formal class parameter.
  1913      * @param name name
  1914      * @param bounds bounds
  1915      */
  1916     public static class JCTypeParameter extends JCTree implements TypeParameterTree {
  1917         public Name name;
  1918         public List<JCExpression> bounds;
  1919         protected JCTypeParameter(Name name, List<JCExpression> bounds) {
  1920             this.name = name;
  1921             this.bounds = bounds;
  1923         @Override
  1924         public void accept(Visitor v) { v.visitTypeParameter(this); }
  1926         public Kind getKind() { return Kind.TYPE_PARAMETER; }
  1927         public Name getName() { return name; }
  1928         public List<JCExpression> getBounds() {
  1929             return bounds;
  1931         @Override
  1932         public <R,D> R accept(TreeVisitor<R,D> v, D d) {
  1933             return v.visitTypeParameter(this, d);
  1935         @Override
  1936         public int getTag() {
  1937             return TYPEPARAMETER;
  1941     public static class JCWildcard extends JCExpression implements WildcardTree {
  1942         public TypeBoundKind kind;
  1943         public JCTree inner;
  1944         protected JCWildcard(TypeBoundKind kind, JCTree inner) {
  1945             kind.getClass(); // null-check
  1946             this.kind = kind;
  1947             this.inner = inner;
  1949         @Override
  1950         public void accept(Visitor v) { v.visitWildcard(this); }
  1952         public Kind getKind() {
  1953             switch (kind.kind) {
  1954             case UNBOUND:
  1955                 return Kind.UNBOUNDED_WILDCARD;
  1956             case EXTENDS:
  1957                 return Kind.EXTENDS_WILDCARD;
  1958             case SUPER:
  1959                 return Kind.SUPER_WILDCARD;
  1960             default:
  1961                 throw new AssertionError("Unknown wildcard bound " + kind);
  1964         public JCTree getBound() { return inner; }
  1965         @Override
  1966         public <R,D> R accept(TreeVisitor<R,D> v, D d) {
  1967             return v.visitWildcard(this, d);
  1969         @Override
  1970         public int getTag() {
  1971             return WILDCARD;
  1975     public static class TypeBoundKind extends JCTree {
  1976         public BoundKind kind;
  1977         protected TypeBoundKind(BoundKind kind) {
  1978             this.kind = kind;
  1980         @Override
  1981         public void accept(Visitor v) { v.visitTypeBoundKind(this); }
  1983         public Kind getKind() {
  1984             throw new AssertionError("TypeBoundKind is not part of a public API");
  1986         @Override
  1987         public <R,D> R accept(TreeVisitor<R,D> v, D d) {
  1988             throw new AssertionError("TypeBoundKind is not part of a public API");
  1990         @Override
  1991         public int getTag() {
  1992             return TYPEBOUNDKIND;
  1996     public static class JCAnnotation extends JCExpression implements AnnotationTree {
  1997         public JCTree annotationType;
  1998         public List<JCExpression> args;
  1999         protected JCAnnotation(JCTree annotationType, List<JCExpression> args) {
  2000             this.annotationType = annotationType;
  2001             this.args = args;
  2003         @Override
  2004         public void accept(Visitor v) { v.visitAnnotation(this); }
  2006         public Kind getKind() { return Kind.ANNOTATION; }
  2007         public JCTree getAnnotationType() { return annotationType; }
  2008         public List<JCExpression> getArguments() {
  2009             return args;
  2011         @Override
  2012         public <R,D> R accept(TreeVisitor<R,D> v, D d) {
  2013             return v.visitAnnotation(this, d);
  2015         @Override
  2016         public int getTag() {
  2017             return ANNOTATION;
  2021     public static class JCModifiers extends JCTree implements com.sun.source.tree.ModifiersTree {
  2022         public long flags;
  2023         public List<JCAnnotation> annotations;
  2024         protected JCModifiers(long flags, List<JCAnnotation> annotations) {
  2025             this.flags = flags;
  2026             this.annotations = annotations;
  2028         @Override
  2029         public void accept(Visitor v) { v.visitModifiers(this); }
  2031         public Kind getKind() { return Kind.MODIFIERS; }
  2032         public Set<Modifier> getFlags() {
  2033             return Flags.asModifierSet(flags);
  2035         public List<JCAnnotation> getAnnotations() {
  2036             return annotations;
  2038         @Override
  2039         public <R,D> R accept(TreeVisitor<R,D> v, D d) {
  2040             return v.visitModifiers(this, d);
  2042         @Override
  2043         public int getTag() {
  2044             return MODIFIERS;
  2048     public static class JCErroneous extends JCExpression
  2049             implements com.sun.source.tree.ErroneousTree {
  2050         public List<? extends JCTree> errs;
  2051         protected JCErroneous(List<? extends JCTree> errs) {
  2052             this.errs = errs;
  2054         @Override
  2055         public void accept(Visitor v) { v.visitErroneous(this); }
  2057         public Kind getKind() { return Kind.ERRONEOUS; }
  2059         public List<? extends JCTree> getErrorTrees() {
  2060             return errs;
  2063         @Override
  2064         public <R,D> R accept(TreeVisitor<R,D> v, D d) {
  2065             return v.visitErroneous(this, d);
  2067         @Override
  2068         public int getTag() {
  2069             return ERRONEOUS;
  2073     /** (let int x = 3; in x+2) */
  2074     public static class LetExpr extends JCExpression {
  2075         public List<JCVariableDecl> defs;
  2076         public JCTree expr;
  2077         protected LetExpr(List<JCVariableDecl> defs, JCTree expr) {
  2078             this.defs = defs;
  2079             this.expr = expr;
  2081         @Override
  2082         public void accept(Visitor v) { v.visitLetExpr(this); }
  2084         public Kind getKind() {
  2085             throw new AssertionError("LetExpr is not part of a public API");
  2087         @Override
  2088         public <R,D> R accept(TreeVisitor<R,D> v, D d) {
  2089             throw new AssertionError("LetExpr is not part of a public API");
  2091         @Override
  2092         public int getTag() {
  2093             return LETEXPR;
  2097     /** An interface for tree factories
  2098      */
  2099     public interface Factory {
  2100         JCCompilationUnit TopLevel(List<JCAnnotation> packageAnnotations,
  2101                                    JCExpression pid,
  2102                                    List<JCTree> defs);
  2103         JCImport Import(JCTree qualid, boolean staticImport);
  2104         JCClassDecl ClassDef(JCModifiers mods,
  2105                           Name name,
  2106                           List<JCTypeParameter> typarams,
  2107                           JCExpression extending,
  2108                           List<JCExpression> implementing,
  2109                           List<JCTree> defs);
  2110         JCMethodDecl MethodDef(JCModifiers mods,
  2111                             Name name,
  2112                             JCExpression restype,
  2113                             List<JCTypeParameter> typarams,
  2114                             List<JCVariableDecl> params,
  2115                             List<JCExpression> thrown,
  2116                             JCBlock body,
  2117                             JCExpression defaultValue);
  2118         JCVariableDecl VarDef(JCModifiers mods,
  2119                       Name name,
  2120                       JCExpression vartype,
  2121                       JCExpression init);
  2122         JCSkip Skip();
  2123         JCBlock Block(long flags, List<JCStatement> stats);
  2124         JCDoWhileLoop DoLoop(JCStatement body, JCExpression cond);
  2125         JCWhileLoop WhileLoop(JCExpression cond, JCStatement body);
  2126         JCForLoop ForLoop(List<JCStatement> init,
  2127                         JCExpression cond,
  2128                         List<JCExpressionStatement> step,
  2129                         JCStatement body);
  2130         JCEnhancedForLoop ForeachLoop(JCVariableDecl var, JCExpression expr, JCStatement body);
  2131         JCLabeledStatement Labelled(Name label, JCStatement body);
  2132         JCSwitch Switch(JCExpression selector, List<JCCase> cases);
  2133         JCCase Case(JCExpression pat, List<JCStatement> stats);
  2134         JCSynchronized Synchronized(JCExpression lock, JCBlock body);
  2135         JCTry Try(JCBlock body, List<JCCatch> catchers, JCBlock finalizer);
  2136         JCTry Try(List<JCTree> resources,
  2137                   JCBlock body,
  2138                   List<JCCatch> catchers,
  2139                   JCBlock finalizer);
  2140         JCCatch Catch(JCVariableDecl param, JCBlock body);
  2141         JCConditional Conditional(JCExpression cond,
  2142                                 JCExpression thenpart,
  2143                                 JCExpression elsepart);
  2144         JCIf If(JCExpression cond, JCStatement thenpart, JCStatement elsepart);
  2145         JCExpressionStatement Exec(JCExpression expr);
  2146         JCBreak Break(Name label);
  2147         JCContinue Continue(Name label);
  2148         JCReturn Return(JCExpression expr);
  2149         JCThrow Throw(JCTree expr);
  2150         JCAssert Assert(JCExpression cond, JCExpression detail);
  2151         JCMethodInvocation Apply(List<JCExpression> typeargs,
  2152                     JCExpression fn,
  2153                     List<JCExpression> args);
  2154         JCNewClass NewClass(JCExpression encl,
  2155                           List<JCExpression> typeargs,
  2156                           JCExpression clazz,
  2157                           List<JCExpression> args,
  2158                           JCClassDecl def);
  2159         JCNewArray NewArray(JCExpression elemtype,
  2160                           List<JCExpression> dims,
  2161                           List<JCExpression> elems);
  2162         JCParens Parens(JCExpression expr);
  2163         JCAssign Assign(JCExpression lhs, JCExpression rhs);
  2164         JCAssignOp Assignop(int opcode, JCTree lhs, JCTree rhs);
  2165         JCUnary Unary(int opcode, JCExpression arg);
  2166         JCBinary Binary(int opcode, JCExpression lhs, JCExpression rhs);
  2167         JCTypeCast TypeCast(JCTree expr, JCExpression type);
  2168         JCInstanceOf TypeTest(JCExpression expr, JCTree clazz);
  2169         JCArrayAccess Indexed(JCExpression indexed, JCExpression index);
  2170         JCFieldAccess Select(JCExpression selected, Name selector);
  2171         JCIdent Ident(Name idname);
  2172         JCLiteral Literal(int tag, Object value);
  2173         JCPrimitiveTypeTree TypeIdent(int typetag);
  2174         JCArrayTypeTree TypeArray(JCExpression elemtype);
  2175         JCTypeApply TypeApply(JCExpression clazz, List<JCExpression> arguments);
  2176         JCTypeParameter TypeParameter(Name name, List<JCExpression> bounds);
  2177         JCWildcard Wildcard(TypeBoundKind kind, JCTree type);
  2178         TypeBoundKind TypeBoundKind(BoundKind kind);
  2179         JCAnnotation Annotation(JCTree annotationType, List<JCExpression> args);
  2180         JCModifiers Modifiers(long flags, List<JCAnnotation> annotations);
  2181         JCErroneous Erroneous(List<? extends JCTree> errs);
  2182         LetExpr LetExpr(List<JCVariableDecl> defs, JCTree expr);
  2185     /** A generic visitor class for trees.
  2186      */
  2187     public static abstract class Visitor {
  2188         public void visitTopLevel(JCCompilationUnit that)    { visitTree(that); }
  2189         public void visitImport(JCImport that)               { visitTree(that); }
  2190         public void visitClassDef(JCClassDecl that)          { visitTree(that); }
  2191         public void visitMethodDef(JCMethodDecl that)        { visitTree(that); }
  2192         public void visitVarDef(JCVariableDecl that)         { visitTree(that); }
  2193         public void visitSkip(JCSkip that)                   { visitTree(that); }
  2194         public void visitBlock(JCBlock that)                 { visitTree(that); }
  2195         public void visitDoLoop(JCDoWhileLoop that)          { visitTree(that); }
  2196         public void visitWhileLoop(JCWhileLoop that)         { visitTree(that); }
  2197         public void visitForLoop(JCForLoop that)             { visitTree(that); }
  2198         public void visitForeachLoop(JCEnhancedForLoop that) { visitTree(that); }
  2199         public void visitLabelled(JCLabeledStatement that)   { visitTree(that); }
  2200         public void visitSwitch(JCSwitch that)               { visitTree(that); }
  2201         public void visitCase(JCCase that)                   { visitTree(that); }
  2202         public void visitSynchronized(JCSynchronized that)   { visitTree(that); }
  2203         public void visitTry(JCTry that)                     { visitTree(that); }
  2204         public void visitCatch(JCCatch that)                 { visitTree(that); }
  2205         public void visitConditional(JCConditional that)     { visitTree(that); }
  2206         public void visitIf(JCIf that)                       { visitTree(that); }
  2207         public void visitExec(JCExpressionStatement that)    { visitTree(that); }
  2208         public void visitBreak(JCBreak that)                 { visitTree(that); }
  2209         public void visitContinue(JCContinue that)           { visitTree(that); }
  2210         public void visitReturn(JCReturn that)               { visitTree(that); }
  2211         public void visitThrow(JCThrow that)                 { visitTree(that); }
  2212         public void visitAssert(JCAssert that)               { visitTree(that); }
  2213         public void visitApply(JCMethodInvocation that)      { visitTree(that); }
  2214         public void visitNewClass(JCNewClass that)           { visitTree(that); }
  2215         public void visitNewArray(JCNewArray that)           { visitTree(that); }
  2216         public void visitParens(JCParens that)               { visitTree(that); }
  2217         public void visitAssign(JCAssign that)               { visitTree(that); }
  2218         public void visitAssignop(JCAssignOp that)           { visitTree(that); }
  2219         public void visitUnary(JCUnary that)                 { visitTree(that); }
  2220         public void visitBinary(JCBinary that)               { visitTree(that); }
  2221         public void visitTypeCast(JCTypeCast that)           { visitTree(that); }
  2222         public void visitTypeTest(JCInstanceOf that)         { visitTree(that); }
  2223         public void visitIndexed(JCArrayAccess that)         { visitTree(that); }
  2224         public void visitSelect(JCFieldAccess that)          { visitTree(that); }
  2225         public void visitIdent(JCIdent that)                 { visitTree(that); }
  2226         public void visitLiteral(JCLiteral that)             { visitTree(that); }
  2227         public void visitTypeIdent(JCPrimitiveTypeTree that) { visitTree(that); }
  2228         public void visitTypeArray(JCArrayTypeTree that)     { visitTree(that); }
  2229         public void visitTypeApply(JCTypeApply that)         { visitTree(that); }
  2230         public void visitTypeUnion(JCTypeUnion that)         { visitTree(that); }
  2231         public void visitTypeParameter(JCTypeParameter that) { visitTree(that); }
  2232         public void visitWildcard(JCWildcard that)           { visitTree(that); }
  2233         public void visitTypeBoundKind(TypeBoundKind that)   { visitTree(that); }
  2234         public void visitAnnotation(JCAnnotation that)       { visitTree(that); }
  2235         public void visitModifiers(JCModifiers that)         { visitTree(that); }
  2236         public void visitErroneous(JCErroneous that)         { visitTree(that); }
  2237         public void visitLetExpr(LetExpr that)               { visitTree(that); }
  2239         public void visitTree(JCTree that)                   { Assert.error(); }

mercurial