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

Thu, 04 Feb 2010 10:14:28 -0800

author
jjg
date
Thu, 04 Feb 2010 10:14:28 -0800
changeset 489
4b4e282a3146
parent 308
03944ee4fac4
child 550
a6f2911a7c55
permissions
-rw-r--r--

6923080: TreeScanner.visitNewClass should scan tree.typeargs
Reviewed-by: darcy

     1 /*
     2  * Copyright 1999-2009 Sun Microsystems, Inc.  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.  Sun designates this
     8  * particular file as subject to the "Classpath" exception as provided
     9  * by Sun 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 Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
    22  * CA 95054 USA or visit www.sun.com if you need additional information or
    23  * have any 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 API supported by Sun Microsystems.
    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     /** Formal type parameters, of type TypeParameter.
   240      */
   241     public static final int TYPEPARAMETER = TYPEAPPLY + 1;
   243     /** Type argument.
   244      */
   245     public static final int WILDCARD = TYPEPARAMETER + 1;
   247     /** Bound kind: extends, super, exact, or unbound
   248      */
   249     public static final int TYPEBOUNDKIND = WILDCARD + 1;
   251     /** metadata: Annotation.
   252      */
   253     public static final int ANNOTATION = TYPEBOUNDKIND + 1;
   255     /** metadata: Modifiers
   256      */
   257     public static final int MODIFIERS = ANNOTATION + 1;
   259     public static final int ANNOTATED_TYPE = MODIFIERS + 1;
   261     /** Error trees, of type Erroneous.
   262      */
   263     public static final int ERRONEOUS = ANNOTATED_TYPE + 1;
   265     /** Unary operators, of type Unary.
   266      */
   267     public static final int POS = ERRONEOUS + 1;             // +
   268     public static final int NEG = POS + 1;                   // -
   269     public static final int NOT = NEG + 1;                   // !
   270     public static final int COMPL = NOT + 1;                 // ~
   271     public static final int PREINC = COMPL + 1;              // ++ _
   272     public static final int PREDEC = PREINC + 1;             // -- _
   273     public static final int POSTINC = PREDEC + 1;            // _ ++
   274     public static final int POSTDEC = POSTINC + 1;           // _ --
   276     /** unary operator for null reference checks, only used internally.
   277      */
   278     public static final int NULLCHK = POSTDEC + 1;
   280     /** Binary operators, of type Binary.
   281      */
   282     public static final int OR = NULLCHK + 1;                // ||
   283     public static final int AND = OR + 1;                    // &&
   284     public static final int BITOR = AND + 1;                 // |
   285     public static final int BITXOR = BITOR + 1;              // ^
   286     public static final int BITAND = BITXOR + 1;             // &
   287     public static final int EQ = BITAND + 1;                 // ==
   288     public static final int NE = EQ + 1;                     // !=
   289     public static final int LT = NE + 1;                     // <
   290     public static final int GT = LT + 1;                     // >
   291     public static final int LE = GT + 1;                     // <=
   292     public static final int GE = LE + 1;                     // >=
   293     public static final int SL = GE + 1;                     // <<
   294     public static final int SR = SL + 1;                     // >>
   295     public static final int USR = SR + 1;                    // >>>
   296     public static final int PLUS = USR + 1;                  // +
   297     public static final int MINUS = PLUS + 1;                // -
   298     public static final int MUL = MINUS + 1;                 // *
   299     public static final int DIV = MUL + 1;                   // /
   300     public static final int MOD = DIV + 1;                   // %
   302     /** Assignment operators, of type Assignop.
   303      */
   304     public static final int BITOR_ASG = MOD + 1;             // |=
   305     public static final int BITXOR_ASG = BITOR_ASG + 1;      // ^=
   306     public static final int BITAND_ASG = BITXOR_ASG + 1;     // &=
   308     public static final int SL_ASG = SL + BITOR_ASG - BITOR; // <<=
   309     public static final int SR_ASG = SL_ASG + 1;             // >>=
   310     public static final int USR_ASG = SR_ASG + 1;            // >>>=
   311     public static final int PLUS_ASG = USR_ASG + 1;          // +=
   312     public static final int MINUS_ASG = PLUS_ASG + 1;        // -=
   313     public static final int MUL_ASG = MINUS_ASG + 1;         // *=
   314     public static final int DIV_ASG = MUL_ASG + 1;           // /=
   315     public static final int MOD_ASG = DIV_ASG + 1;           // %=
   317     /** A synthetic let expression, of type LetExpr.
   318      */
   319     public static final int LETEXPR = MOD_ASG + 1;           // ala scheme
   322     /** The offset between assignment operators and normal operators.
   323      */
   324     public static final int ASGOffset = BITOR_ASG - BITOR;
   326     /* The (encoded) position in the source file. @see util.Position.
   327      */
   328     public int pos;
   330     /* The type of this node.
   331      */
   332     public Type type;
   334     /* The tag of this node -- one of the constants declared above.
   335      */
   336     public abstract int getTag();
   338     /** Convert a tree to a pretty-printed string. */
   339     public String toString() {
   340         StringWriter s = new StringWriter();
   341         try {
   342             new Pretty(s, false).printExpr(this);
   343         }
   344         catch (IOException e) {
   345             // should never happen, because StringWriter is defined
   346             // never to throw any IOExceptions
   347             throw new AssertionError(e);
   348         }
   349         return s.toString();
   350     }
   352     /** Set position field and return this tree.
   353      */
   354     public JCTree setPos(int pos) {
   355         this.pos = pos;
   356         return this;
   357     }
   359     /** Set type field and return this tree.
   360      */
   361     public JCTree setType(Type type) {
   362         this.type = type;
   363         return this;
   364     }
   366     /** Visit this tree with a given visitor.
   367      */
   368     public abstract void accept(Visitor v);
   370     public abstract <R,D> R accept(TreeVisitor<R,D> v, D d);
   372     /** Return a shallow copy of this tree.
   373      */
   374     public Object clone() {
   375         try {
   376             return super.clone();
   377         } catch(CloneNotSupportedException e) {
   378             throw new RuntimeException(e);
   379         }
   380     }
   382     /** Get a default position for this tree node.
   383      */
   384     public DiagnosticPosition pos() {
   385         return this;
   386     }
   388     // for default DiagnosticPosition
   389     public JCTree getTree() {
   390         return this;
   391     }
   393     // for default DiagnosticPosition
   394     public int getStartPosition() {
   395         return TreeInfo.getStartPos(this);
   396     }
   398     // for default DiagnosticPosition
   399     public int getPreferredPosition() {
   400         return pos;
   401     }
   403     // for default DiagnosticPosition
   404     public int getEndPosition(Map<JCTree, Integer> endPosTable) {
   405         return TreeInfo.getEndPos(this, endPosTable);
   406     }
   408     /**
   409      * Everything in one source file is kept in a TopLevel structure.
   410      * @param pid              The tree representing the package clause.
   411      * @param sourcefile       The source file name.
   412      * @param defs             All definitions in this file (ClassDef, Import, and Skip)
   413      * @param packge           The package it belongs to.
   414      * @param namedImportScope A scope for all named imports.
   415      * @param starImportScope  A scope for all import-on-demands.
   416      * @param lineMap          Line starting positions, defined only
   417      *                         if option -g is set.
   418      * @param docComments      A hashtable that stores all documentation comments
   419      *                         indexed by the tree nodes they refer to.
   420      *                         defined only if option -s is set.
   421      * @param endPositions     A hashtable that stores ending positions of source
   422      *                         ranges indexed by the tree nodes they belong to.
   423      *                         Defined only if option -Xjcov is set.
   424      */
   425     public static class JCCompilationUnit extends JCTree implements CompilationUnitTree {
   426         public List<JCAnnotation> packageAnnotations;
   427         public JCExpression pid;
   428         public List<JCTree> defs;
   429         public JavaFileObject sourcefile;
   430         public PackageSymbol packge;
   431         public Scope namedImportScope;
   432         public Scope starImportScope;
   433         public long flags;
   434         public Position.LineMap lineMap = null;
   435         public Map<JCTree, String> docComments = null;
   436         public Map<JCTree, Integer> endPositions = null;
   437         protected JCCompilationUnit(List<JCAnnotation> packageAnnotations,
   438                         JCExpression pid,
   439                         List<JCTree> defs,
   440                         JavaFileObject sourcefile,
   441                         PackageSymbol packge,
   442                         Scope namedImportScope,
   443                         Scope starImportScope) {
   444             this.packageAnnotations = packageAnnotations;
   445             this.pid = pid;
   446             this.defs = defs;
   447             this.sourcefile = sourcefile;
   448             this.packge = packge;
   449             this.namedImportScope = namedImportScope;
   450             this.starImportScope = starImportScope;
   451         }
   452         @Override
   453         public void accept(Visitor v) { v.visitTopLevel(this); }
   455         public Kind getKind() { return Kind.COMPILATION_UNIT; }
   456         public List<JCAnnotation> getPackageAnnotations() {
   457             return packageAnnotations;
   458         }
   459         public List<JCImport> getImports() {
   460             ListBuffer<JCImport> imports = new ListBuffer<JCImport>();
   461             for (JCTree tree : defs) {
   462                 if (tree.getTag() == IMPORT)
   463                     imports.append((JCImport)tree);
   464                 else
   465                     break;
   466             }
   467             return imports.toList();
   468         }
   469         public JCExpression getPackageName() { return pid; }
   470         public JavaFileObject getSourceFile() {
   471             return sourcefile;
   472         }
   473         public Position.LineMap getLineMap() {
   474             return lineMap;
   475         }
   476         public List<JCTree> getTypeDecls() {
   477             List<JCTree> typeDefs;
   478             for (typeDefs = defs; !typeDefs.isEmpty(); typeDefs = typeDefs.tail)
   479                 if (typeDefs.head.getTag() != IMPORT)
   480                     break;
   481             return typeDefs;
   482         }
   483         @Override
   484         public <R,D> R accept(TreeVisitor<R,D> v, D d) {
   485             return v.visitCompilationUnit(this, d);
   486         }
   488         @Override
   489         public int getTag() {
   490             return TOPLEVEL;
   491         }
   492     }
   494     /**
   495      * An import clause.
   496      * @param qualid    The imported class(es).
   497      */
   498     public static class JCImport extends JCTree implements ImportTree {
   499         public boolean staticImport;
   500         public JCTree qualid;
   501         protected JCImport(JCTree qualid, boolean importStatic) {
   502             this.qualid = qualid;
   503             this.staticImport = importStatic;
   504         }
   505         @Override
   506         public void accept(Visitor v) { v.visitImport(this); }
   508         public boolean isStatic() { return staticImport; }
   509         public JCTree getQualifiedIdentifier() { return qualid; }
   511         public Kind getKind() { return Kind.IMPORT; }
   512         @Override
   513         public <R,D> R accept(TreeVisitor<R,D> v, D d) {
   514             return v.visitImport(this, d);
   515         }
   517         @Override
   518         public int getTag() {
   519             return IMPORT;
   520         }
   521     }
   523     public static abstract class JCStatement extends JCTree implements StatementTree {
   524         @Override
   525         public JCStatement setType(Type type) {
   526             super.setType(type);
   527             return this;
   528         }
   529         @Override
   530         public JCStatement setPos(int pos) {
   531             super.setPos(pos);
   532             return this;
   533         }
   534     }
   536     public static abstract class JCExpression extends JCTree implements ExpressionTree {
   537         @Override
   538         public JCExpression setType(Type type) {
   539             super.setType(type);
   540             return this;
   541         }
   542         @Override
   543         public JCExpression setPos(int pos) {
   544             super.setPos(pos);
   545             return this;
   546         }
   547     }
   549     /**
   550      * A class definition.
   551      * @param modifiers the modifiers
   552      * @param name the name of the class
   553      * @param typarams formal class parameters
   554      * @param extending the classes this class extends
   555      * @param implementing the interfaces implemented by this class
   556      * @param defs all variables and methods defined in this class
   557      * @param sym the symbol
   558      */
   559     public static class JCClassDecl extends JCStatement implements ClassTree {
   560         public JCModifiers mods;
   561         public Name name;
   562         public List<JCTypeParameter> typarams;
   563         public JCTree extending;
   564         public List<JCExpression> implementing;
   565         public List<JCTree> defs;
   566         public ClassSymbol sym;
   567         protected JCClassDecl(JCModifiers mods,
   568                            Name name,
   569                            List<JCTypeParameter> typarams,
   570                            JCTree extending,
   571                            List<JCExpression> implementing,
   572                            List<JCTree> defs,
   573                            ClassSymbol sym)
   574         {
   575             this.mods = mods;
   576             this.name = name;
   577             this.typarams = typarams;
   578             this.extending = extending;
   579             this.implementing = implementing;
   580             this.defs = defs;
   581             this.sym = sym;
   582         }
   583         @Override
   584         public void accept(Visitor v) { v.visitClassDef(this); }
   586         public Kind getKind() { return Kind.CLASS; }
   587         public JCModifiers getModifiers() { return mods; }
   588         public Name getSimpleName() { return name; }
   589         public List<JCTypeParameter> getTypeParameters() {
   590             return typarams;
   591         }
   592         public JCTree getExtendsClause() { return extending; }
   593         public List<JCExpression> getImplementsClause() {
   594             return implementing;
   595         }
   596         public List<JCTree> getMembers() {
   597             return defs;
   598         }
   599         @Override
   600         public <R,D> R accept(TreeVisitor<R,D> v, D d) {
   601             return v.visitClass(this, d);
   602         }
   604         @Override
   605         public int getTag() {
   606             return CLASSDEF;
   607         }
   608     }
   610     /**
   611      * A method definition.
   612      * @param modifiers method modifiers
   613      * @param name method name
   614      * @param restype type of method return value
   615      * @param typarams type parameters
   616      * @param params value parameters
   617      * @param thrown exceptions thrown by this method
   618      * @param stats statements in the method
   619      * @param sym method symbol
   620      */
   621     public static class JCMethodDecl extends JCTree implements MethodTree {
   622         public JCModifiers mods;
   623         public Name name;
   624         public JCExpression restype;
   625         public List<JCTypeParameter> typarams;
   626         public List<JCVariableDecl> params;
   627         public List<JCTypeAnnotation> receiverAnnotations;
   628         public List<JCExpression> thrown;
   629         public JCBlock body;
   630         public JCExpression defaultValue; // for annotation types
   631         public MethodSymbol sym;
   632         protected JCMethodDecl(JCModifiers mods,
   633                             Name name,
   634                             JCExpression restype,
   635                             List<JCTypeParameter> typarams,
   636                             List<JCVariableDecl> params,
   637                             List<JCTypeAnnotation> receiver,
   638                             List<JCExpression> thrown,
   639                             JCBlock body,
   640                             JCExpression defaultValue,
   641                             MethodSymbol sym)
   642         {
   643             this.mods = mods;
   644             this.name = name;
   645             this.restype = restype;
   646             this.typarams = typarams;
   647             this.params = params;
   648             this.receiverAnnotations = (receiver != null ? receiver : List.<JCTypeAnnotation>nil());
   649             this.thrown = thrown;
   650             this.body = body;
   651             this.defaultValue = defaultValue;
   652             this.sym = sym;
   653         }
   654         @Override
   655         public void accept(Visitor v) { v.visitMethodDef(this); }
   657         public Kind getKind() { return Kind.METHOD; }
   658         public JCModifiers getModifiers() { return mods; }
   659         public Name getName() { return name; }
   660         public JCTree getReturnType() { return restype; }
   661         public List<JCTypeParameter> getTypeParameters() {
   662             return typarams;
   663         }
   664         public List<JCVariableDecl> getParameters() {
   665             return params;
   666         }
   667         public List<JCTypeAnnotation> getReceiverAnnotations() { return receiverAnnotations; }
   668         public List<JCExpression> getThrows() {
   669             return thrown;
   670         }
   671         public JCBlock getBody() { return body; }
   672         public JCTree getDefaultValue() { // for annotation types
   673             return defaultValue;
   674         }
   675         @Override
   676         public <R,D> R accept(TreeVisitor<R,D> v, D d) {
   677             return v.visitMethod(this, d);
   678         }
   680         @Override
   681         public int getTag() {
   682             return METHODDEF;
   683         }
   684   }
   686     /**
   687      * A variable definition.
   688      * @param modifiers variable modifiers
   689      * @param name variable name
   690      * @param vartype type of the variable
   691      * @param init variables initial value
   692      * @param sym symbol
   693      */
   694     public static class JCVariableDecl extends JCStatement implements VariableTree {
   695         public JCModifiers mods;
   696         public Name name;
   697         public JCExpression vartype;
   698         public JCExpression init;
   699         public VarSymbol sym;
   700         protected JCVariableDecl(JCModifiers mods,
   701                          Name name,
   702                          JCExpression vartype,
   703                          JCExpression init,
   704                          VarSymbol sym) {
   705             this.mods = mods;
   706             this.name = name;
   707             this.vartype = vartype;
   708             this.init = init;
   709             this.sym = sym;
   710         }
   711         @Override
   712         public void accept(Visitor v) { v.visitVarDef(this); }
   714         public Kind getKind() { return Kind.VARIABLE; }
   715         public JCModifiers getModifiers() { return mods; }
   716         public Name getName() { return name; }
   717         public JCTree getType() { return vartype; }
   718         public JCExpression getInitializer() {
   719             return init;
   720         }
   721         @Override
   722         public <R,D> R accept(TreeVisitor<R,D> v, D d) {
   723             return v.visitVariable(this, d);
   724         }
   726         @Override
   727         public int getTag() {
   728             return VARDEF;
   729         }
   730     }
   732       /**
   733      * A no-op statement ";".
   734      */
   735     public static class JCSkip extends JCStatement implements EmptyStatementTree {
   736         protected JCSkip() {
   737         }
   738         @Override
   739         public void accept(Visitor v) { v.visitSkip(this); }
   741         public Kind getKind() { return Kind.EMPTY_STATEMENT; }
   742         @Override
   743         public <R,D> R accept(TreeVisitor<R,D> v, D d) {
   744             return v.visitEmptyStatement(this, d);
   745         }
   747         @Override
   748         public int getTag() {
   749             return SKIP;
   750         }
   751     }
   753     /**
   754      * A statement block.
   755      * @param stats statements
   756      * @param flags flags
   757      */
   758     public static class JCBlock extends JCStatement implements BlockTree {
   759         public long flags;
   760         public List<JCStatement> stats;
   761         /** Position of closing brace, optional. */
   762         public int endpos = Position.NOPOS;
   763         protected JCBlock(long flags, List<JCStatement> stats) {
   764             this.stats = stats;
   765             this.flags = flags;
   766         }
   767         @Override
   768         public void accept(Visitor v) { v.visitBlock(this); }
   770         public Kind getKind() { return Kind.BLOCK; }
   771         public List<JCStatement> getStatements() {
   772             return stats;
   773         }
   774         public boolean isStatic() { return (flags & Flags.STATIC) != 0; }
   775         @Override
   776         public <R,D> R accept(TreeVisitor<R,D> v, D d) {
   777             return v.visitBlock(this, d);
   778         }
   780         @Override
   781         public int getTag() {
   782             return BLOCK;
   783         }
   784     }
   786     /**
   787      * A do loop
   788      */
   789     public static class JCDoWhileLoop extends JCStatement implements DoWhileLoopTree {
   790         public JCStatement body;
   791         public JCExpression cond;
   792         protected JCDoWhileLoop(JCStatement body, JCExpression cond) {
   793             this.body = body;
   794             this.cond = cond;
   795         }
   796         @Override
   797         public void accept(Visitor v) { v.visitDoLoop(this); }
   799         public Kind getKind() { return Kind.DO_WHILE_LOOP; }
   800         public JCExpression getCondition() { return cond; }
   801         public JCStatement getStatement() { return body; }
   802         @Override
   803         public <R,D> R accept(TreeVisitor<R,D> v, D d) {
   804             return v.visitDoWhileLoop(this, d);
   805         }
   807         @Override
   808         public int getTag() {
   809             return DOLOOP;
   810         }
   811     }
   813     /**
   814      * A while loop
   815      */
   816     public static class JCWhileLoop extends JCStatement implements WhileLoopTree {
   817         public JCExpression cond;
   818         public JCStatement body;
   819         protected JCWhileLoop(JCExpression cond, JCStatement body) {
   820             this.cond = cond;
   821             this.body = body;
   822         }
   823         @Override
   824         public void accept(Visitor v) { v.visitWhileLoop(this); }
   826         public Kind getKind() { return Kind.WHILE_LOOP; }
   827         public JCExpression getCondition() { return cond; }
   828         public JCStatement getStatement() { return body; }
   829         @Override
   830         public <R,D> R accept(TreeVisitor<R,D> v, D d) {
   831             return v.visitWhileLoop(this, d);
   832         }
   834         @Override
   835         public int getTag() {
   836             return WHILELOOP;
   837         }
   838     }
   840     /**
   841      * A for loop.
   842      */
   843     public static class JCForLoop extends JCStatement implements ForLoopTree {
   844         public List<JCStatement> init;
   845         public JCExpression cond;
   846         public List<JCExpressionStatement> step;
   847         public JCStatement body;
   848         protected JCForLoop(List<JCStatement> init,
   849                           JCExpression cond,
   850                           List<JCExpressionStatement> update,
   851                           JCStatement body)
   852         {
   853             this.init = init;
   854             this.cond = cond;
   855             this.step = update;
   856             this.body = body;
   857         }
   858         @Override
   859         public void accept(Visitor v) { v.visitForLoop(this); }
   861         public Kind getKind() { return Kind.FOR_LOOP; }
   862         public JCExpression getCondition() { return cond; }
   863         public JCStatement getStatement() { return body; }
   864         public List<JCStatement> getInitializer() {
   865             return init;
   866         }
   867         public List<JCExpressionStatement> getUpdate() {
   868             return step;
   869         }
   870         @Override
   871         public <R,D> R accept(TreeVisitor<R,D> v, D d) {
   872             return v.visitForLoop(this, d);
   873         }
   875         @Override
   876         public int getTag() {
   877             return FORLOOP;
   878         }
   879     }
   881     /**
   882      * The enhanced for loop.
   883      */
   884     public static class JCEnhancedForLoop extends JCStatement implements EnhancedForLoopTree {
   885         public JCVariableDecl var;
   886         public JCExpression expr;
   887         public JCStatement body;
   888         protected JCEnhancedForLoop(JCVariableDecl var, JCExpression expr, JCStatement body) {
   889             this.var = var;
   890             this.expr = expr;
   891             this.body = body;
   892         }
   893         @Override
   894         public void accept(Visitor v) { v.visitForeachLoop(this); }
   896         public Kind getKind() { return Kind.ENHANCED_FOR_LOOP; }
   897         public JCVariableDecl getVariable() { return var; }
   898         public JCExpression getExpression() { return expr; }
   899         public JCStatement getStatement() { return body; }
   900         @Override
   901         public <R,D> R accept(TreeVisitor<R,D> v, D d) {
   902             return v.visitEnhancedForLoop(this, d);
   903         }
   904         @Override
   905         public int getTag() {
   906             return FOREACHLOOP;
   907         }
   908     }
   910     /**
   911      * A labelled expression or statement.
   912      */
   913     public static class JCLabeledStatement extends JCStatement implements LabeledStatementTree {
   914         public Name label;
   915         public JCStatement body;
   916         protected JCLabeledStatement(Name label, JCStatement body) {
   917             this.label = label;
   918             this.body = body;
   919         }
   920         @Override
   921         public void accept(Visitor v) { v.visitLabelled(this); }
   922         public Kind getKind() { return Kind.LABELED_STATEMENT; }
   923         public Name getLabel() { return label; }
   924         public JCStatement getStatement() { return body; }
   925         @Override
   926         public <R,D> R accept(TreeVisitor<R,D> v, D d) {
   927             return v.visitLabeledStatement(this, d);
   928         }
   929         @Override
   930         public int getTag() {
   931             return LABELLED;
   932         }
   933     }
   935     /**
   936      * A "switch ( ) { }" construction.
   937      */
   938     public static class JCSwitch extends JCStatement implements SwitchTree {
   939         public JCExpression selector;
   940         public List<JCCase> cases;
   941         protected JCSwitch(JCExpression selector, List<JCCase> cases) {
   942             this.selector = selector;
   943             this.cases = cases;
   944         }
   945         @Override
   946         public void accept(Visitor v) { v.visitSwitch(this); }
   948         public Kind getKind() { return Kind.SWITCH; }
   949         public JCExpression getExpression() { return selector; }
   950         public List<JCCase> getCases() { return cases; }
   951         @Override
   952         public <R,D> R accept(TreeVisitor<R,D> v, D d) {
   953             return v.visitSwitch(this, d);
   954         }
   955         @Override
   956         public int getTag() {
   957             return SWITCH;
   958         }
   959     }
   961     /**
   962      * A "case  :" of a switch.
   963      */
   964     public static class JCCase extends JCStatement implements CaseTree {
   965         public JCExpression pat;
   966         public List<JCStatement> stats;
   967         protected JCCase(JCExpression pat, List<JCStatement> stats) {
   968             this.pat = pat;
   969             this.stats = stats;
   970         }
   971         @Override
   972         public void accept(Visitor v) { v.visitCase(this); }
   974         public Kind getKind() { return Kind.CASE; }
   975         public JCExpression getExpression() { return pat; }
   976         public List<JCStatement> getStatements() { return stats; }
   977         @Override
   978         public <R,D> R accept(TreeVisitor<R,D> v, D d) {
   979             return v.visitCase(this, d);
   980         }
   981         @Override
   982         public int getTag() {
   983             return CASE;
   984         }
   985     }
   987     /**
   988      * A synchronized block.
   989      */
   990     public static class JCSynchronized extends JCStatement implements SynchronizedTree {
   991         public JCExpression lock;
   992         public JCBlock body;
   993         protected JCSynchronized(JCExpression lock, JCBlock body) {
   994             this.lock = lock;
   995             this.body = body;
   996         }
   997         @Override
   998         public void accept(Visitor v) { v.visitSynchronized(this); }
  1000         public Kind getKind() { return Kind.SYNCHRONIZED; }
  1001         public JCExpression getExpression() { return lock; }
  1002         public JCBlock getBlock() { return body; }
  1003         @Override
  1004         public <R,D> R accept(TreeVisitor<R,D> v, D d) {
  1005             return v.visitSynchronized(this, d);
  1007         @Override
  1008         public int getTag() {
  1009             return SYNCHRONIZED;
  1013     /**
  1014      * A "try { } catch ( ) { } finally { }" block.
  1015      */
  1016     public static class JCTry extends JCStatement implements TryTree {
  1017         public JCBlock body;
  1018         public List<JCCatch> catchers;
  1019         public JCBlock finalizer;
  1020         protected JCTry(JCBlock body, List<JCCatch> catchers, JCBlock finalizer) {
  1021             this.body = body;
  1022             this.catchers = catchers;
  1023             this.finalizer = finalizer;
  1025         @Override
  1026         public void accept(Visitor v) { v.visitTry(this); }
  1028         public Kind getKind() { return Kind.TRY; }
  1029         public JCBlock getBlock() { return body; }
  1030         public List<JCCatch> getCatches() {
  1031             return catchers;
  1033         public JCBlock getFinallyBlock() { return finalizer; }
  1034         @Override
  1035         public <R,D> R accept(TreeVisitor<R,D> v, D d) {
  1036             return v.visitTry(this, d);
  1038         @Override
  1039         public int getTag() {
  1040             return TRY;
  1044     /**
  1045      * A catch block.
  1046      */
  1047     public static class JCCatch extends JCTree implements CatchTree {
  1048         public JCVariableDecl param;
  1049         public JCBlock body;
  1050         protected JCCatch(JCVariableDecl param, JCBlock body) {
  1051             this.param = param;
  1052             this.body = body;
  1054         @Override
  1055         public void accept(Visitor v) { v.visitCatch(this); }
  1057         public Kind getKind() { return Kind.CATCH; }
  1058         public JCVariableDecl getParameter() { return param; }
  1059         public JCBlock getBlock() { return body; }
  1060         @Override
  1061         public <R,D> R accept(TreeVisitor<R,D> v, D d) {
  1062             return v.visitCatch(this, d);
  1064         @Override
  1065         public int getTag() {
  1066             return CATCH;
  1070     /**
  1071      * A ( ) ? ( ) : ( ) conditional expression
  1072      */
  1073     public static class JCConditional extends JCExpression implements ConditionalExpressionTree {
  1074         public JCExpression cond;
  1075         public JCExpression truepart;
  1076         public JCExpression falsepart;
  1077         protected JCConditional(JCExpression cond,
  1078                               JCExpression truepart,
  1079                               JCExpression falsepart)
  1081             this.cond = cond;
  1082             this.truepart = truepart;
  1083             this.falsepart = falsepart;
  1085         @Override
  1086         public void accept(Visitor v) { v.visitConditional(this); }
  1088         public Kind getKind() { return Kind.CONDITIONAL_EXPRESSION; }
  1089         public JCExpression getCondition() { return cond; }
  1090         public JCExpression getTrueExpression() { return truepart; }
  1091         public JCExpression getFalseExpression() { return falsepart; }
  1092         @Override
  1093         public <R,D> R accept(TreeVisitor<R,D> v, D d) {
  1094             return v.visitConditionalExpression(this, d);
  1096         @Override
  1097         public int getTag() {
  1098             return CONDEXPR;
  1102     /**
  1103      * An "if ( ) { } else { }" block
  1104      */
  1105     public static class JCIf extends JCStatement implements IfTree {
  1106         public JCExpression cond;
  1107         public JCStatement thenpart;
  1108         public JCStatement elsepart;
  1109         protected JCIf(JCExpression cond,
  1110                      JCStatement thenpart,
  1111                      JCStatement elsepart)
  1113             this.cond = cond;
  1114             this.thenpart = thenpart;
  1115             this.elsepart = elsepart;
  1117         @Override
  1118         public void accept(Visitor v) { v.visitIf(this); }
  1120         public Kind getKind() { return Kind.IF; }
  1121         public JCExpression getCondition() { return cond; }
  1122         public JCStatement getThenStatement() { return thenpart; }
  1123         public JCStatement getElseStatement() { return elsepart; }
  1124         @Override
  1125         public <R,D> R accept(TreeVisitor<R,D> v, D d) {
  1126             return v.visitIf(this, d);
  1128         @Override
  1129         public int getTag() {
  1130             return IF;
  1134     /**
  1135      * an expression statement
  1136      * @param expr expression structure
  1137      */
  1138     public static class JCExpressionStatement extends JCStatement implements ExpressionStatementTree {
  1139         public JCExpression expr;
  1140         protected JCExpressionStatement(JCExpression expr)
  1142             this.expr = expr;
  1144         @Override
  1145         public void accept(Visitor v) { v.visitExec(this); }
  1147         public Kind getKind() { return Kind.EXPRESSION_STATEMENT; }
  1148         public JCExpression getExpression() { return expr; }
  1149         @Override
  1150         public <R,D> R accept(TreeVisitor<R,D> v, D d) {
  1151             return v.visitExpressionStatement(this, d);
  1153         @Override
  1154         public int getTag() {
  1155             return EXEC;
  1159     /**
  1160      * A break from a loop or switch.
  1161      */
  1162     public static class JCBreak extends JCStatement implements BreakTree {
  1163         public Name label;
  1164         public JCTree target;
  1165         protected JCBreak(Name label, JCTree target) {
  1166             this.label = label;
  1167             this.target = target;
  1169         @Override
  1170         public void accept(Visitor v) { v.visitBreak(this); }
  1172         public Kind getKind() { return Kind.BREAK; }
  1173         public Name getLabel() { return label; }
  1174         @Override
  1175         public <R,D> R accept(TreeVisitor<R,D> v, D d) {
  1176             return v.visitBreak(this, d);
  1178         @Override
  1179         public int getTag() {
  1180             return BREAK;
  1184     /**
  1185      * A continue of a loop.
  1186      */
  1187     public static class JCContinue extends JCStatement implements ContinueTree {
  1188         public Name label;
  1189         public JCTree target;
  1190         protected JCContinue(Name label, JCTree target) {
  1191             this.label = label;
  1192             this.target = target;
  1194         @Override
  1195         public void accept(Visitor v) { v.visitContinue(this); }
  1197         public Kind getKind() { return Kind.CONTINUE; }
  1198         public Name getLabel() { return label; }
  1199         @Override
  1200         public <R,D> R accept(TreeVisitor<R,D> v, D d) {
  1201             return v.visitContinue(this, d);
  1203         @Override
  1204         public int getTag() {
  1205             return CONTINUE;
  1209     /**
  1210      * A return statement.
  1211      */
  1212     public static class JCReturn extends JCStatement implements ReturnTree {
  1213         public JCExpression expr;
  1214         protected JCReturn(JCExpression expr) {
  1215             this.expr = expr;
  1217         @Override
  1218         public void accept(Visitor v) { v.visitReturn(this); }
  1220         public Kind getKind() { return Kind.RETURN; }
  1221         public JCExpression getExpression() { return expr; }
  1222         @Override
  1223         public <R,D> R accept(TreeVisitor<R,D> v, D d) {
  1224             return v.visitReturn(this, d);
  1226         @Override
  1227         public int getTag() {
  1228             return RETURN;
  1232     /**
  1233      * A throw statement.
  1234      */
  1235     public static class JCThrow extends JCStatement implements ThrowTree {
  1236         public JCExpression expr;
  1237         protected JCThrow(JCTree expr) {
  1238             this.expr = (JCExpression)expr;
  1240         @Override
  1241         public void accept(Visitor v) { v.visitThrow(this); }
  1243         public Kind getKind() { return Kind.THROW; }
  1244         public JCExpression getExpression() { return expr; }
  1245         @Override
  1246         public <R,D> R accept(TreeVisitor<R,D> v, D d) {
  1247             return v.visitThrow(this, d);
  1249         @Override
  1250         public int getTag() {
  1251             return THROW;
  1255     /**
  1256      * An assert statement.
  1257      */
  1258     public static class JCAssert extends JCStatement implements AssertTree {
  1259         public JCExpression cond;
  1260         public JCExpression detail;
  1261         protected JCAssert(JCExpression cond, JCExpression detail) {
  1262             this.cond = cond;
  1263             this.detail = detail;
  1265         @Override
  1266         public void accept(Visitor v) { v.visitAssert(this); }
  1268         public Kind getKind() { return Kind.ASSERT; }
  1269         public JCExpression getCondition() { return cond; }
  1270         public JCExpression getDetail() { return detail; }
  1271         @Override
  1272         public <R,D> R accept(TreeVisitor<R,D> v, D d) {
  1273             return v.visitAssert(this, d);
  1275         @Override
  1276         public int getTag() {
  1277             return ASSERT;
  1281     /**
  1282      * A method invocation
  1283      */
  1284     public static class JCMethodInvocation extends JCExpression implements MethodInvocationTree {
  1285         public List<JCExpression> typeargs;
  1286         public JCExpression meth;
  1287         public List<JCExpression> args;
  1288         public Type varargsElement;
  1289         protected JCMethodInvocation(List<JCExpression> typeargs,
  1290                         JCExpression meth,
  1291                         List<JCExpression> args)
  1293             this.typeargs = (typeargs == null) ? List.<JCExpression>nil()
  1294                                                : typeargs;
  1295             this.meth = meth;
  1296             this.args = args;
  1298         @Override
  1299         public void accept(Visitor v) { v.visitApply(this); }
  1301         public Kind getKind() { return Kind.METHOD_INVOCATION; }
  1302         public List<JCExpression> getTypeArguments() {
  1303             return typeargs;
  1305         public JCExpression getMethodSelect() { return meth; }
  1306         public List<JCExpression> getArguments() {
  1307             return args;
  1309         @Override
  1310         public <R,D> R accept(TreeVisitor<R,D> v, D d) {
  1311             return v.visitMethodInvocation(this, d);
  1313         @Override
  1314         public JCMethodInvocation setType(Type type) {
  1315             super.setType(type);
  1316             return this;
  1318         @Override
  1319         public int getTag() {
  1320             return(APPLY);
  1324     /**
  1325      * A new(...) operation.
  1326      */
  1327     public static class JCNewClass extends JCExpression implements NewClassTree {
  1328         public JCExpression encl;
  1329         public List<JCExpression> typeargs;
  1330         public JCExpression clazz;
  1331         public List<JCExpression> args;
  1332         public JCClassDecl def;
  1333         public Symbol constructor;
  1334         public Type varargsElement;
  1335         public Type constructorType;
  1336         protected JCNewClass(JCExpression encl,
  1337                            List<JCExpression> typeargs,
  1338                            JCExpression clazz,
  1339                            List<JCExpression> args,
  1340                            JCClassDecl def)
  1342             this.encl = encl;
  1343             this.typeargs = (typeargs == null) ? List.<JCExpression>nil()
  1344                                                : typeargs;
  1345             this.clazz = clazz;
  1346             this.args = args;
  1347             this.def = def;
  1349         @Override
  1350         public void accept(Visitor v) { v.visitNewClass(this); }
  1352         public Kind getKind() { return Kind.NEW_CLASS; }
  1353         public JCExpression getEnclosingExpression() { // expr.new C< ... > ( ... )
  1354             return encl;
  1356         public List<JCExpression> getTypeArguments() {
  1357             return typeargs;
  1359         public JCExpression getIdentifier() { return clazz; }
  1360         public List<JCExpression> getArguments() {
  1361             return args;
  1363         public JCClassDecl getClassBody() { return def; }
  1364         @Override
  1365         public <R,D> R accept(TreeVisitor<R,D> v, D d) {
  1366             return v.visitNewClass(this, d);
  1368         @Override
  1369         public int getTag() {
  1370             return NEWCLASS;
  1374     /**
  1375      * A new[...] operation.
  1376      */
  1377     public static class JCNewArray extends JCExpression implements NewArrayTree {
  1378         public JCExpression elemtype;
  1379         public List<JCExpression> dims;
  1380         public List<JCTypeAnnotation> annotations;
  1381         public List<List<JCTypeAnnotation>> dimAnnotations;
  1382         public List<JCExpression> elems;
  1383         protected JCNewArray(JCExpression elemtype,
  1384                            List<JCExpression> dims,
  1385                            List<JCExpression> elems)
  1387             this.elemtype = elemtype;
  1388             this.dims = dims;
  1389             this.annotations = List.nil();
  1390             this.dimAnnotations = List.nil();
  1391             this.elems = elems;
  1393         @Override
  1394         public void accept(Visitor v) { v.visitNewArray(this); }
  1396         public Kind getKind() { return Kind.NEW_ARRAY; }
  1397         public JCExpression getType() { return elemtype; }
  1398         public List<JCExpression> getDimensions() {
  1399             return dims;
  1401         public List<JCExpression> getInitializers() {
  1402             return elems;
  1404         @Override
  1405         public <R,D> R accept(TreeVisitor<R,D> v, D d) {
  1406             return v.visitNewArray(this, d);
  1408         @Override
  1409         public int getTag() {
  1410             return NEWARRAY;
  1414     /**
  1415      * A parenthesized subexpression ( ... )
  1416      */
  1417     public static class JCParens extends JCExpression implements ParenthesizedTree {
  1418         public JCExpression expr;
  1419         protected JCParens(JCExpression expr) {
  1420             this.expr = expr;
  1422         @Override
  1423         public void accept(Visitor v) { v.visitParens(this); }
  1425         public Kind getKind() { return Kind.PARENTHESIZED; }
  1426         public JCExpression getExpression() { return expr; }
  1427         @Override
  1428         public <R,D> R accept(TreeVisitor<R,D> v, D d) {
  1429             return v.visitParenthesized(this, d);
  1431         @Override
  1432         public int getTag() {
  1433             return PARENS;
  1437     /**
  1438      * A assignment with "=".
  1439      */
  1440     public static class JCAssign extends JCExpression implements AssignmentTree {
  1441         public JCExpression lhs;
  1442         public JCExpression rhs;
  1443         protected JCAssign(JCExpression lhs, JCExpression rhs) {
  1444             this.lhs = lhs;
  1445             this.rhs = rhs;
  1447         @Override
  1448         public void accept(Visitor v) { v.visitAssign(this); }
  1450         public Kind getKind() { return Kind.ASSIGNMENT; }
  1451         public JCExpression getVariable() { return lhs; }
  1452         public JCExpression getExpression() { return rhs; }
  1453         @Override
  1454         public <R,D> R accept(TreeVisitor<R,D> v, D d) {
  1455             return v.visitAssignment(this, d);
  1457         @Override
  1458         public int getTag() {
  1459             return ASSIGN;
  1463     /**
  1464      * An assignment with "+=", "|=" ...
  1465      */
  1466     public static class JCAssignOp extends JCExpression implements CompoundAssignmentTree {
  1467         private int opcode;
  1468         public JCExpression lhs;
  1469         public JCExpression rhs;
  1470         public Symbol operator;
  1471         protected JCAssignOp(int opcode, JCTree lhs, JCTree rhs, Symbol operator) {
  1472             this.opcode = opcode;
  1473             this.lhs = (JCExpression)lhs;
  1474             this.rhs = (JCExpression)rhs;
  1475             this.operator = operator;
  1477         @Override
  1478         public void accept(Visitor v) { v.visitAssignop(this); }
  1480         public Kind getKind() { return TreeInfo.tagToKind(getTag()); }
  1481         public JCExpression getVariable() { return lhs; }
  1482         public JCExpression getExpression() { return rhs; }
  1483         public Symbol getOperator() {
  1484             return operator;
  1486         @Override
  1487         public <R,D> R accept(TreeVisitor<R,D> v, D d) {
  1488             return v.visitCompoundAssignment(this, d);
  1490         @Override
  1491         public int getTag() {
  1492             return opcode;
  1496     /**
  1497      * A unary operation.
  1498      */
  1499     public static class JCUnary extends JCExpression implements UnaryTree {
  1500         private int opcode;
  1501         public JCExpression arg;
  1502         public Symbol operator;
  1503         protected JCUnary(int opcode, JCExpression arg) {
  1504             this.opcode = opcode;
  1505             this.arg = arg;
  1507         @Override
  1508         public void accept(Visitor v) { v.visitUnary(this); }
  1510         public Kind getKind() { return TreeInfo.tagToKind(getTag()); }
  1511         public JCExpression getExpression() { return arg; }
  1512         public Symbol getOperator() {
  1513             return operator;
  1515         @Override
  1516         public <R,D> R accept(TreeVisitor<R,D> v, D d) {
  1517             return v.visitUnary(this, d);
  1519         @Override
  1520         public int getTag() {
  1521             return opcode;
  1524         public void setTag(int tag) {
  1525             opcode = tag;
  1529     /**
  1530      * A binary operation.
  1531      */
  1532     public static class JCBinary extends JCExpression implements BinaryTree {
  1533         private int opcode;
  1534         public JCExpression lhs;
  1535         public JCExpression rhs;
  1536         public Symbol operator;
  1537         protected JCBinary(int opcode,
  1538                          JCExpression lhs,
  1539                          JCExpression rhs,
  1540                          Symbol operator) {
  1541             this.opcode = opcode;
  1542             this.lhs = lhs;
  1543             this.rhs = rhs;
  1544             this.operator = operator;
  1546         @Override
  1547         public void accept(Visitor v) { v.visitBinary(this); }
  1549         public Kind getKind() { return TreeInfo.tagToKind(getTag()); }
  1550         public JCExpression getLeftOperand() { return lhs; }
  1551         public JCExpression getRightOperand() { return rhs; }
  1552         public Symbol getOperator() {
  1553             return operator;
  1555         @Override
  1556         public <R,D> R accept(TreeVisitor<R,D> v, D d) {
  1557             return v.visitBinary(this, d);
  1559         @Override
  1560         public int getTag() {
  1561             return opcode;
  1565     /**
  1566      * A type cast.
  1567      */
  1568     public static class JCTypeCast extends JCExpression implements TypeCastTree {
  1569         public JCTree clazz;
  1570         public JCExpression expr;
  1571         protected JCTypeCast(JCTree clazz, JCExpression expr) {
  1572             this.clazz = clazz;
  1573             this.expr = expr;
  1575         @Override
  1576         public void accept(Visitor v) { v.visitTypeCast(this); }
  1578         public Kind getKind() { return Kind.TYPE_CAST; }
  1579         public JCTree getType() { return clazz; }
  1580         public JCExpression getExpression() { return expr; }
  1581         @Override
  1582         public <R,D> R accept(TreeVisitor<R,D> v, D d) {
  1583             return v.visitTypeCast(this, d);
  1585         @Override
  1586         public int getTag() {
  1587             return TYPECAST;
  1591     /**
  1592      * A type test.
  1593      */
  1594     public static class JCInstanceOf extends JCExpression implements InstanceOfTree {
  1595         public JCExpression expr;
  1596         public JCTree clazz;
  1597         protected JCInstanceOf(JCExpression expr, JCTree clazz) {
  1598             this.expr = expr;
  1599             this.clazz = clazz;
  1601         @Override
  1602         public void accept(Visitor v) { v.visitTypeTest(this); }
  1604         public Kind getKind() { return Kind.INSTANCE_OF; }
  1605         public JCTree getType() { return clazz; }
  1606         public JCExpression getExpression() { return expr; }
  1607         @Override
  1608         public <R,D> R accept(TreeVisitor<R,D> v, D d) {
  1609             return v.visitInstanceOf(this, d);
  1611         @Override
  1612         public int getTag() {
  1613             return TYPETEST;
  1617     /**
  1618      * An array selection
  1619      */
  1620     public static class JCArrayAccess extends JCExpression implements ArrayAccessTree {
  1621         public JCExpression indexed;
  1622         public JCExpression index;
  1623         protected JCArrayAccess(JCExpression indexed, JCExpression index) {
  1624             this.indexed = indexed;
  1625             this.index = index;
  1627         @Override
  1628         public void accept(Visitor v) { v.visitIndexed(this); }
  1630         public Kind getKind() { return Kind.ARRAY_ACCESS; }
  1631         public JCExpression getExpression() { return indexed; }
  1632         public JCExpression getIndex() { return index; }
  1633         @Override
  1634         public <R,D> R accept(TreeVisitor<R,D> v, D d) {
  1635             return v.visitArrayAccess(this, d);
  1637         @Override
  1638         public int getTag() {
  1639             return INDEXED;
  1643     /**
  1644      * Selects through packages and classes
  1645      * @param selected selected Tree hierarchie
  1646      * @param selector name of field to select thru
  1647      * @param sym symbol of the selected class
  1648      */
  1649     public static class JCFieldAccess extends JCExpression implements MemberSelectTree {
  1650         public JCExpression selected;
  1651         public Name name;
  1652         public Symbol sym;
  1653         protected JCFieldAccess(JCExpression selected, Name name, Symbol sym) {
  1654             this.selected = selected;
  1655             this.name = name;
  1656             this.sym = sym;
  1658         @Override
  1659         public void accept(Visitor v) { v.visitSelect(this); }
  1661         public Kind getKind() { return Kind.MEMBER_SELECT; }
  1662         public JCExpression getExpression() { return selected; }
  1663         @Override
  1664         public <R,D> R accept(TreeVisitor<R,D> v, D d) {
  1665             return v.visitMemberSelect(this, d);
  1667         public Name getIdentifier() { return name; }
  1668         @Override
  1669         public int getTag() {
  1670             return SELECT;
  1674     /**
  1675      * An identifier
  1676      * @param idname the name
  1677      * @param sym the symbol
  1678      */
  1679     public static class JCIdent extends JCExpression implements IdentifierTree {
  1680         public Name name;
  1681         public Symbol sym;
  1682         protected JCIdent(Name name, Symbol sym) {
  1683             this.name = name;
  1684             this.sym = sym;
  1686         @Override
  1687         public void accept(Visitor v) { v.visitIdent(this); }
  1689         public Kind getKind() { return Kind.IDENTIFIER; }
  1690         public Name getName() { return name; }
  1691         @Override
  1692         public <R,D> R accept(TreeVisitor<R,D> v, D d) {
  1693             return v.visitIdentifier(this, d);
  1695         public int getTag() {
  1696             return IDENT;
  1700     /**
  1701      * A constant value given literally.
  1702      * @param value value representation
  1703      */
  1704     public static class JCLiteral extends JCExpression implements LiteralTree {
  1705         public int typetag;
  1706         public Object value;
  1707         protected JCLiteral(int typetag, Object value) {
  1708             this.typetag = typetag;
  1709             this.value = value;
  1711         @Override
  1712         public void accept(Visitor v) { v.visitLiteral(this); }
  1714         public Kind getKind() {
  1715             switch (typetag) {
  1716             case TypeTags.INT:
  1717                 return Kind.INT_LITERAL;
  1718             case TypeTags.LONG:
  1719                 return Kind.LONG_LITERAL;
  1720             case TypeTags.FLOAT:
  1721                 return Kind.FLOAT_LITERAL;
  1722             case TypeTags.DOUBLE:
  1723                 return Kind.DOUBLE_LITERAL;
  1724             case TypeTags.BOOLEAN:
  1725                 return Kind.BOOLEAN_LITERAL;
  1726             case TypeTags.CHAR:
  1727                 return Kind.CHAR_LITERAL;
  1728             case TypeTags.CLASS:
  1729                 return Kind.STRING_LITERAL;
  1730             case TypeTags.BOT:
  1731                 return Kind.NULL_LITERAL;
  1732             default:
  1733                 throw new AssertionError("unknown literal kind " + this);
  1736         public Object getValue() {
  1737             switch (typetag) {
  1738                 case TypeTags.BOOLEAN:
  1739                     int bi = (Integer) value;
  1740                     return (bi != 0);
  1741                 case TypeTags.CHAR:
  1742                     int ci = (Integer) value;
  1743                     char c = (char) ci;
  1744                     if (c != ci)
  1745                         throw new AssertionError("bad value for char literal");
  1746                     return c;
  1747                 default:
  1748                     return value;
  1751         @Override
  1752         public <R,D> R accept(TreeVisitor<R,D> v, D d) {
  1753             return v.visitLiteral(this, d);
  1755         @Override
  1756         public JCLiteral setType(Type type) {
  1757             super.setType(type);
  1758             return this;
  1760         @Override
  1761         public int getTag() {
  1762             return LITERAL;
  1766     /**
  1767      * Identifies a basic type.
  1768      * @param tag the basic type id
  1769      * @see TypeTags
  1770      */
  1771     public static class JCPrimitiveTypeTree extends JCExpression implements PrimitiveTypeTree {
  1772         public int typetag;
  1773         protected JCPrimitiveTypeTree(int typetag) {
  1774             this.typetag = typetag;
  1776         @Override
  1777         public void accept(Visitor v) { v.visitTypeIdent(this); }
  1779         public Kind getKind() { return Kind.PRIMITIVE_TYPE; }
  1780         public TypeKind getPrimitiveTypeKind() {
  1781             switch (typetag) {
  1782             case TypeTags.BOOLEAN:
  1783                 return TypeKind.BOOLEAN;
  1784             case TypeTags.BYTE:
  1785                 return TypeKind.BYTE;
  1786             case TypeTags.SHORT:
  1787                 return TypeKind.SHORT;
  1788             case TypeTags.INT:
  1789                 return TypeKind.INT;
  1790             case TypeTags.LONG:
  1791                 return TypeKind.LONG;
  1792             case TypeTags.CHAR:
  1793                 return TypeKind.CHAR;
  1794             case TypeTags.FLOAT:
  1795                 return TypeKind.FLOAT;
  1796             case TypeTags.DOUBLE:
  1797                 return TypeKind.DOUBLE;
  1798             case TypeTags.VOID:
  1799                 return TypeKind.VOID;
  1800             default:
  1801                 throw new AssertionError("unknown primitive type " + this);
  1804         @Override
  1805         public <R,D> R accept(TreeVisitor<R,D> v, D d) {
  1806             return v.visitPrimitiveType(this, d);
  1808         @Override
  1809         public int getTag() {
  1810             return TYPEIDENT;
  1814     /**
  1815      * An array type, A[]
  1816      */
  1817     public static class JCArrayTypeTree extends JCExpression implements ArrayTypeTree {
  1818         public JCExpression elemtype;
  1819         protected JCArrayTypeTree(JCExpression elemtype) {
  1820             this.elemtype = elemtype;
  1822         @Override
  1823         public void accept(Visitor v) { v.visitTypeArray(this); }
  1825         public Kind getKind() { return Kind.ARRAY_TYPE; }
  1826         public JCTree getType() { return elemtype; }
  1827         @Override
  1828         public <R,D> R accept(TreeVisitor<R,D> v, D d) {
  1829             return v.visitArrayType(this, d);
  1831         @Override
  1832         public int getTag() {
  1833             return TYPEARRAY;
  1837     /**
  1838      * A parameterized type, T<...>
  1839      */
  1840     public static class JCTypeApply extends JCExpression implements ParameterizedTypeTree {
  1841         public JCExpression clazz;
  1842         public List<JCExpression> arguments;
  1843         protected JCTypeApply(JCExpression clazz, List<JCExpression> arguments) {
  1844             this.clazz = clazz;
  1845             this.arguments = arguments;
  1847         @Override
  1848         public void accept(Visitor v) { v.visitTypeApply(this); }
  1850         public Kind getKind() { return Kind.PARAMETERIZED_TYPE; }
  1851         public JCTree getType() { return clazz; }
  1852         public List<JCExpression> getTypeArguments() {
  1853             return arguments;
  1855         @Override
  1856         public <R,D> R accept(TreeVisitor<R,D> v, D d) {
  1857             return v.visitParameterizedType(this, d);
  1859         @Override
  1860         public int getTag() {
  1861             return TYPEAPPLY;
  1865     /**
  1866      * A formal class parameter.
  1867      * @param name name
  1868      * @param bounds bounds
  1869      */
  1870     public static class JCTypeParameter extends JCTree implements TypeParameterTree {
  1871         public Name name;
  1872         public List<JCExpression> bounds;
  1873         public List<JCTypeAnnotation> annotations;
  1874         protected JCTypeParameter(Name name, List<JCExpression> bounds, List<JCTypeAnnotation> annotations) {
  1875             this.name = name;
  1876             this.bounds = bounds;
  1877             this.annotations = annotations;
  1879         @Override
  1880         public void accept(Visitor v) { v.visitTypeParameter(this); }
  1882         public Kind getKind() { return Kind.TYPE_PARAMETER; }
  1883         public Name getName() { return name; }
  1884         public List<JCExpression> getBounds() {
  1885             return bounds;
  1887         public List<JCTypeAnnotation> getAnnotations() {
  1888             return annotations;
  1890         @Override
  1891         public <R,D> R accept(TreeVisitor<R,D> v, D d) {
  1892             return v.visitTypeParameter(this, d);
  1894         @Override
  1895         public int getTag() {
  1896             return TYPEPARAMETER;
  1900     public static class JCWildcard extends JCExpression implements WildcardTree {
  1901         public TypeBoundKind kind;
  1902         public JCTree inner;
  1903         protected JCWildcard(TypeBoundKind kind, JCTree inner) {
  1904             kind.getClass(); // null-check
  1905             this.kind = kind;
  1906             this.inner = inner;
  1908         @Override
  1909         public void accept(Visitor v) { v.visitWildcard(this); }
  1911         public Kind getKind() {
  1912             switch (kind.kind) {
  1913             case UNBOUND:
  1914                 return Kind.UNBOUNDED_WILDCARD;
  1915             case EXTENDS:
  1916                 return Kind.EXTENDS_WILDCARD;
  1917             case SUPER:
  1918                 return Kind.SUPER_WILDCARD;
  1919             default:
  1920                 throw new AssertionError("Unknown wildcard bound " + kind);
  1923         public JCTree getBound() { return inner; }
  1924         @Override
  1925         public <R,D> R accept(TreeVisitor<R,D> v, D d) {
  1926             return v.visitWildcard(this, d);
  1928         @Override
  1929         public int getTag() {
  1930             return WILDCARD;
  1934     public static class TypeBoundKind extends JCTree {
  1935         public BoundKind kind;
  1936         protected TypeBoundKind(BoundKind kind) {
  1937             this.kind = kind;
  1939         @Override
  1940         public void accept(Visitor v) { v.visitTypeBoundKind(this); }
  1942         public Kind getKind() {
  1943             throw new AssertionError("TypeBoundKind is not part of a public API");
  1945         @Override
  1946         public <R,D> R accept(TreeVisitor<R,D> v, D d) {
  1947             throw new AssertionError("TypeBoundKind is not part of a public API");
  1949         @Override
  1950         public int getTag() {
  1951             return TYPEBOUNDKIND;
  1955     public static class JCAnnotation extends JCExpression implements AnnotationTree {
  1956         public JCTree annotationType;
  1957         public List<JCExpression> args;
  1958         protected JCAnnotation(JCTree annotationType, List<JCExpression> args) {
  1959             this.annotationType = annotationType;
  1960             this.args = args;
  1962         @Override
  1963         public void accept(Visitor v) { v.visitAnnotation(this); }
  1965         public Kind getKind() { return Kind.ANNOTATION; }
  1966         public JCTree getAnnotationType() { return annotationType; }
  1967         public List<JCExpression> getArguments() {
  1968             return args;
  1970         @Override
  1971         public <R,D> R accept(TreeVisitor<R,D> v, D d) {
  1972             return v.visitAnnotation(this, d);
  1974         @Override
  1975         public int getTag() {
  1976             return ANNOTATION;
  1980     public static class JCTypeAnnotation extends JCAnnotation {
  1981         public TypeAnnotationPosition annotation_position;
  1982         public Attribute.TypeCompound attribute_field;
  1984         protected JCTypeAnnotation(JCTree annotationType, List<JCExpression> args) {
  1985             super(annotationType, args);
  1986             this.annotation_position = new TypeAnnotationPosition();
  1990     public static class JCModifiers extends JCTree implements com.sun.source.tree.ModifiersTree {
  1991         public long flags;
  1992         public List<JCAnnotation> annotations;
  1993         protected JCModifiers(long flags, List<JCAnnotation> annotations) {
  1994             this.flags = flags;
  1995             this.annotations = annotations;
  1997         @Override
  1998         public void accept(Visitor v) { v.visitModifiers(this); }
  2000         public Kind getKind() { return Kind.MODIFIERS; }
  2001         public Set<Modifier> getFlags() {
  2002             return Flags.asModifierSet(flags);
  2004         public List<JCAnnotation> getAnnotations() {
  2005             return annotations;
  2007         @Override
  2008         public <R,D> R accept(TreeVisitor<R,D> v, D d) {
  2009             return v.visitModifiers(this, d);
  2011         @Override
  2012         public int getTag() {
  2013             return MODIFIERS;
  2017     public static class JCAnnotatedType extends JCExpression implements com.sun.source.tree.AnnotatedTypeTree {
  2018         public List<JCTypeAnnotation> annotations;
  2019         public JCExpression underlyingType;
  2020         protected JCAnnotatedType(List<JCTypeAnnotation> annotations, JCExpression underlyingType) {
  2021             this.annotations = annotations;
  2022             this.underlyingType = underlyingType;
  2024         @Override
  2025         public void accept(Visitor v) { v.visitAnnotatedType(this); }
  2027         public Kind getKind() { return Kind.ANNOTATED_TYPE; }
  2028         public List<JCTypeAnnotation> getAnnotations() {
  2029             return annotations;
  2031         public JCExpression getUnderlyingType() {
  2032             return underlyingType;
  2034         @Override
  2035         public <R,D> R accept(TreeVisitor<R,D> v, D d) {
  2036             return v.visitAnnotatedType(this, d);
  2038         @Override
  2039         public int getTag() {
  2040             return ANNOTATED_TYPE;
  2044     public static class JCErroneous extends JCExpression
  2045             implements com.sun.source.tree.ErroneousTree {
  2046         public List<? extends JCTree> errs;
  2047         protected JCErroneous(List<? extends JCTree> errs) {
  2048             this.errs = errs;
  2050         @Override
  2051         public void accept(Visitor v) { v.visitErroneous(this); }
  2053         public Kind getKind() { return Kind.ERRONEOUS; }
  2055         public List<? extends JCTree> getErrorTrees() {
  2056             return errs;
  2059         @Override
  2060         public <R,D> R accept(TreeVisitor<R,D> v, D d) {
  2061             return v.visitErroneous(this, d);
  2063         @Override
  2064         public int getTag() {
  2065             return ERRONEOUS;
  2069     /** (let int x = 3; in x+2) */
  2070     public static class LetExpr extends JCExpression {
  2071         public List<JCVariableDecl> defs;
  2072         public JCTree expr;
  2073         protected LetExpr(List<JCVariableDecl> defs, JCTree expr) {
  2074             this.defs = defs;
  2075             this.expr = expr;
  2077         @Override
  2078         public void accept(Visitor v) { v.visitLetExpr(this); }
  2080         public Kind getKind() {
  2081             throw new AssertionError("LetExpr is not part of a public API");
  2083         @Override
  2084         public <R,D> R accept(TreeVisitor<R,D> v, D d) {
  2085             throw new AssertionError("LetExpr is not part of a public API");
  2087         @Override
  2088         public int getTag() {
  2089             return LETEXPR;
  2093     /** An interface for tree factories
  2094      */
  2095     public interface Factory {
  2096         JCCompilationUnit TopLevel(List<JCAnnotation> packageAnnotations,
  2097                                    JCExpression pid,
  2098                                    List<JCTree> defs);
  2099         JCImport Import(JCTree qualid, boolean staticImport);
  2100         JCClassDecl ClassDef(JCModifiers mods,
  2101                           Name name,
  2102                           List<JCTypeParameter> typarams,
  2103                           JCTree extending,
  2104                           List<JCExpression> implementing,
  2105                           List<JCTree> defs);
  2106         JCMethodDecl MethodDef(JCModifiers mods,
  2107                             Name name,
  2108                             JCExpression restype,
  2109                             List<JCTypeParameter> typarams,
  2110                             List<JCVariableDecl> params,
  2111                             List<JCTypeAnnotation> receiver,
  2112                             List<JCExpression> thrown,
  2113                             JCBlock body,
  2114                             JCExpression defaultValue);
  2115         JCVariableDecl VarDef(JCModifiers mods,
  2116                       Name name,
  2117                       JCExpression vartype,
  2118                       JCExpression init);
  2119         JCSkip Skip();
  2120         JCBlock Block(long flags, List<JCStatement> stats);
  2121         JCDoWhileLoop DoLoop(JCStatement body, JCExpression cond);
  2122         JCWhileLoop WhileLoop(JCExpression cond, JCStatement body);
  2123         JCForLoop ForLoop(List<JCStatement> init,
  2124                         JCExpression cond,
  2125                         List<JCExpressionStatement> step,
  2126                         JCStatement body);
  2127         JCEnhancedForLoop ForeachLoop(JCVariableDecl var, JCExpression expr, JCStatement body);
  2128         JCLabeledStatement Labelled(Name label, JCStatement body);
  2129         JCSwitch Switch(JCExpression selector, List<JCCase> cases);
  2130         JCCase Case(JCExpression pat, List<JCStatement> stats);
  2131         JCSynchronized Synchronized(JCExpression lock, JCBlock body);
  2132         JCTry Try(JCBlock body, List<JCCatch> catchers, JCBlock finalizer);
  2133         JCCatch Catch(JCVariableDecl param, JCBlock body);
  2134         JCConditional Conditional(JCExpression cond,
  2135                                 JCExpression thenpart,
  2136                                 JCExpression elsepart);
  2137         JCIf If(JCExpression cond, JCStatement thenpart, JCStatement elsepart);
  2138         JCExpressionStatement Exec(JCExpression expr);
  2139         JCBreak Break(Name label);
  2140         JCContinue Continue(Name label);
  2141         JCReturn Return(JCExpression expr);
  2142         JCThrow Throw(JCTree expr);
  2143         JCAssert Assert(JCExpression cond, JCExpression detail);
  2144         JCMethodInvocation Apply(List<JCExpression> typeargs,
  2145                     JCExpression fn,
  2146                     List<JCExpression> args);
  2147         JCNewClass NewClass(JCExpression encl,
  2148                           List<JCExpression> typeargs,
  2149                           JCExpression clazz,
  2150                           List<JCExpression> args,
  2151                           JCClassDecl def);
  2152         JCNewArray NewArray(JCExpression elemtype,
  2153                           List<JCExpression> dims,
  2154                           List<JCExpression> elems);
  2155         JCParens Parens(JCExpression expr);
  2156         JCAssign Assign(JCExpression lhs, JCExpression rhs);
  2157         JCAssignOp Assignop(int opcode, JCTree lhs, JCTree rhs);
  2158         JCUnary Unary(int opcode, JCExpression arg);
  2159         JCBinary Binary(int opcode, JCExpression lhs, JCExpression rhs);
  2160         JCTypeCast TypeCast(JCTree expr, JCExpression type);
  2161         JCInstanceOf TypeTest(JCExpression expr, JCTree clazz);
  2162         JCArrayAccess Indexed(JCExpression indexed, JCExpression index);
  2163         JCFieldAccess Select(JCExpression selected, Name selector);
  2164         JCIdent Ident(Name idname);
  2165         JCLiteral Literal(int tag, Object value);
  2166         JCPrimitiveTypeTree TypeIdent(int typetag);
  2167         JCArrayTypeTree TypeArray(JCExpression elemtype);
  2168         JCTypeApply TypeApply(JCExpression clazz, List<JCExpression> arguments);
  2169         JCTypeParameter TypeParameter(Name name, List<JCExpression> bounds);
  2170         JCWildcard Wildcard(TypeBoundKind kind, JCTree type);
  2171         TypeBoundKind TypeBoundKind(BoundKind kind);
  2172         JCAnnotation Annotation(JCTree annotationType, List<JCExpression> args);
  2173         JCModifiers Modifiers(long flags, List<JCAnnotation> annotations);
  2174         JCErroneous Erroneous(List<? extends JCTree> errs);
  2175         LetExpr LetExpr(List<JCVariableDecl> defs, JCTree expr);
  2178     /** A generic visitor class for trees.
  2179      */
  2180     public static abstract class Visitor {
  2181         public void visitTopLevel(JCCompilationUnit that)    { visitTree(that); }
  2182         public void visitImport(JCImport that)               { visitTree(that); }
  2183         public void visitClassDef(JCClassDecl that)          { visitTree(that); }
  2184         public void visitMethodDef(JCMethodDecl that)        { visitTree(that); }
  2185         public void visitVarDef(JCVariableDecl that)         { visitTree(that); }
  2186         public void visitSkip(JCSkip that)                   { visitTree(that); }
  2187         public void visitBlock(JCBlock that)                 { visitTree(that); }
  2188         public void visitDoLoop(JCDoWhileLoop that)          { visitTree(that); }
  2189         public void visitWhileLoop(JCWhileLoop that)         { visitTree(that); }
  2190         public void visitForLoop(JCForLoop that)             { visitTree(that); }
  2191         public void visitForeachLoop(JCEnhancedForLoop that) { visitTree(that); }
  2192         public void visitLabelled(JCLabeledStatement that)   { visitTree(that); }
  2193         public void visitSwitch(JCSwitch that)               { visitTree(that); }
  2194         public void visitCase(JCCase that)                   { visitTree(that); }
  2195         public void visitSynchronized(JCSynchronized that)   { visitTree(that); }
  2196         public void visitTry(JCTry that)                     { visitTree(that); }
  2197         public void visitCatch(JCCatch that)                 { visitTree(that); }
  2198         public void visitConditional(JCConditional that)     { visitTree(that); }
  2199         public void visitIf(JCIf that)                       { visitTree(that); }
  2200         public void visitExec(JCExpressionStatement that)    { visitTree(that); }
  2201         public void visitBreak(JCBreak that)                 { visitTree(that); }
  2202         public void visitContinue(JCContinue that)           { visitTree(that); }
  2203         public void visitReturn(JCReturn that)               { visitTree(that); }
  2204         public void visitThrow(JCThrow that)                 { visitTree(that); }
  2205         public void visitAssert(JCAssert that)               { visitTree(that); }
  2206         public void visitApply(JCMethodInvocation that)      { visitTree(that); }
  2207         public void visitNewClass(JCNewClass that)           { visitTree(that); }
  2208         public void visitNewArray(JCNewArray that)           { visitTree(that); }
  2209         public void visitParens(JCParens that)               { visitTree(that); }
  2210         public void visitAssign(JCAssign that)               { visitTree(that); }
  2211         public void visitAssignop(JCAssignOp that)           { visitTree(that); }
  2212         public void visitUnary(JCUnary that)                 { visitTree(that); }
  2213         public void visitBinary(JCBinary that)               { visitTree(that); }
  2214         public void visitTypeCast(JCTypeCast that)           { visitTree(that); }
  2215         public void visitTypeTest(JCInstanceOf that)         { visitTree(that); }
  2216         public void visitIndexed(JCArrayAccess that)         { visitTree(that); }
  2217         public void visitSelect(JCFieldAccess that)          { visitTree(that); }
  2218         public void visitIdent(JCIdent that)                 { visitTree(that); }
  2219         public void visitLiteral(JCLiteral that)             { visitTree(that); }
  2220         public void visitTypeIdent(JCPrimitiveTypeTree that) { visitTree(that); }
  2221         public void visitTypeArray(JCArrayTypeTree that)     { visitTree(that); }
  2222         public void visitTypeApply(JCTypeApply that)         { visitTree(that); }
  2223         public void visitTypeParameter(JCTypeParameter that) { visitTree(that); }
  2224         public void visitWildcard(JCWildcard that)           { visitTree(that); }
  2225         public void visitTypeBoundKind(TypeBoundKind that)   { visitTree(that); }
  2226         public void visitAnnotation(JCAnnotation that)       { visitTree(that); }
  2227         public void visitModifiers(JCModifiers that)         { visitTree(that); }
  2228         public void visitAnnotatedType(JCAnnotatedType that) { visitTree(that); }
  2229         public void visitErroneous(JCErroneous that)         { visitTree(that); }
  2230         public void visitLetExpr(LetExpr that)               { visitTree(that); }
  2232         public void visitTree(JCTree that)                   { assert false; }

mercurial