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

Mon, 14 Nov 2011 15:11:10 -0800

author
ksrini
date
Mon, 14 Nov 2011 15:11:10 -0800
changeset 1138
7375d4979bd3
parent 1127
ca49d50318dc
child 1142
c896d95e7469
permissions
-rw-r--r--

7106166: (javac) re-factor EndPos parser
Reviewed-by: 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.tools.javac.parser.EndPosTable;
    43 import com.sun.source.tree.*;
    45 import static com.sun.tools.javac.code.BoundKind.*;
    46 import static com.sun.tools.javac.tree.JCTree.Tag.*;
    48 /**
    49  * Root class for abstract syntax tree nodes. It provides definitions
    50  * for specific tree nodes as subclasses nested inside.
    51  *
    52  * <p>Each subclass is highly standardized.  It generally contains
    53  * only tree fields for the syntactic subcomponents of the node.  Some
    54  * classes that represent identifier uses or definitions also define a
    55  * Symbol field that denotes the represented identifier.  Classes for
    56  * non-local jumps also carry the jump target as a field.  The root
    57  * class Tree itself defines fields for the tree's type and position.
    58  * No other fields are kept in a tree node; instead parameters are
    59  * passed to methods accessing the node.
    60  *
    61  * <p>Except for the methods defined by com.sun.source, the only
    62  * method defined in subclasses is `visit' which applies a given
    63  * visitor to the tree. The actual tree processing is done by visitor
    64  * classes in other packages. The abstract class Visitor, as well as
    65  * an Factory interface for trees, are defined as inner classes in
    66  * Tree.
    67  *
    68  * <p>To avoid ambiguities with the Tree API in com.sun.source all sub
    69  * classes should, by convention, start with JC (javac).
    70  *
    71  * <p><b>This is NOT part of any supported API.
    72  * If you write code that depends on this, you do so at your own risk.
    73  * This code and its internal interfaces are subject to change or
    74  * deletion without notice.</b>
    75  *
    76  * @see TreeMaker
    77  * @see TreeInfo
    78  * @see TreeTranslator
    79  * @see Pretty
    80  */
    81 public abstract class JCTree implements Tree, Cloneable, DiagnosticPosition {
    83     /* Tree tag values, identifying kinds of trees */
    84     public enum Tag{
    85         /** For methods that return an invalid tag if a given condition is not met
    86          */
    87         NO_TAG,
    89         /** Toplevel nodes, of type TopLevel, representing entire source files.
    90         */
    91         TOPLEVEL,
    93         /** Import clauses, of type Import.
    94          */
    95         IMPORT,
    97         /** Class definitions, of type ClassDef.
    98          */
    99         CLASSDEF,
   101         /** Method definitions, of type MethodDef.
   102          */
   103         METHODDEF,
   105         /** Variable definitions, of type VarDef.
   106          */
   107         VARDEF,
   109         /** The no-op statement ";", of type Skip
   110          */
   111         SKIP,
   113         /** Blocks, of type Block.
   114          */
   115         BLOCK,
   117         /** Do-while loops, of type DoLoop.
   118          */
   119         DOLOOP,
   121         /** While-loops, of type WhileLoop.
   122          */
   123         WHILELOOP,
   125         /** For-loops, of type ForLoop.
   126          */
   127         FORLOOP,
   129         /** Foreach-loops, of type ForeachLoop.
   130          */
   131         FOREACHLOOP,
   133         /** Labelled statements, of type Labelled.
   134          */
   135         LABELLED,
   137         /** Switch statements, of type Switch.
   138          */
   139         SWITCH,
   141         /** Case parts in switch statements, of type Case.
   142          */
   143         CASE,
   145         /** Synchronized statements, of type Synchonized.
   146          */
   147         SYNCHRONIZED,
   149         /** Try statements, of type Try.
   150          */
   151         TRY,
   153         /** Catch clauses in try statements, of type Catch.
   154          */
   155         CATCH,
   157         /** Conditional expressions, of type Conditional.
   158          */
   159         CONDEXPR,
   161         /** Conditional statements, of type If.
   162          */
   163         IF,
   165         /** Expression statements, of type Exec.
   166          */
   167         EXEC,
   169         /** Break statements, of type Break.
   170          */
   171         BREAK,
   173         /** Continue statements, of type Continue.
   174          */
   175         CONTINUE,
   177         /** Return statements, of type Return.
   178          */
   179         RETURN,
   181         /** Throw statements, of type Throw.
   182          */
   183         THROW,
   185         /** Assert statements, of type Assert.
   186          */
   187         ASSERT,
   189         /** Method invocation expressions, of type Apply.
   190          */
   191         APPLY,
   193         /** Class instance creation expressions, of type NewClass.
   194          */
   195         NEWCLASS,
   197         /** Array creation expressions, of type NewArray.
   198          */
   199         NEWARRAY,
   201         /** Parenthesized subexpressions, of type Parens.
   202          */
   203         PARENS,
   205         /** Assignment expressions, of type Assign.
   206          */
   207         ASSIGN,
   209         /** Type cast expressions, of type TypeCast.
   210          */
   211         TYPECAST,
   213         /** Type test expressions, of type TypeTest.
   214          */
   215         TYPETEST,
   217         /** Indexed array expressions, of type Indexed.
   218          */
   219         INDEXED,
   221         /** Selections, of type Select.
   222          */
   223         SELECT,
   225         /** Simple identifiers, of type Ident.
   226          */
   227         IDENT,
   229         /** Literals, of type Literal.
   230          */
   231         LITERAL,
   233         /** Basic type identifiers, of type TypeIdent.
   234          */
   235         TYPEIDENT,
   237         /** Array types, of type TypeArray.
   238          */
   239         TYPEARRAY,
   241         /** Parameterized types, of type TypeApply.
   242          */
   243         TYPEAPPLY,
   245         /** Union types, of type TypeUnion
   246          */
   247         TYPEUNION,
   249         /** Formal type parameters, of type TypeParameter.
   250          */
   251         TYPEPARAMETER,
   253         /** Type argument.
   254          */
   255         WILDCARD,
   257         /** Bound kind: extends, super, exact, or unbound
   258          */
   259         TYPEBOUNDKIND,
   261         /** metadata: Annotation.
   262          */
   263         ANNOTATION,
   265         /** metadata: Modifiers
   266          */
   267         MODIFIERS,
   269         ANNOTATED_TYPE,
   271         /** Error trees, of type Erroneous.
   272          */
   273         ERRONEOUS,
   275         /** Unary operators, of type Unary.
   276          */
   277         POS,                             // +
   278         NEG,                             // -
   279         NOT,                             // !
   280         COMPL,                           // ~
   281         PREINC,                          // ++ _
   282         PREDEC,                          // -- _
   283         POSTINC,                         // _ ++
   284         POSTDEC,                         // _ --
   286         /** unary operator for null reference checks, only used internally.
   287          */
   288         NULLCHK,
   290         /** Binary operators, of type Binary.
   291          */
   292         OR,                              // ||
   293         AND,                             // &&
   294         BITOR,                           // |
   295         BITXOR,                          // ^
   296         BITAND,                          // &
   297         EQ,                              // ==
   298         NE,                              // !=
   299         LT,                              // <
   300         GT,                              // >
   301         LE,                              // <=
   302         GE,                              // >=
   303         SL,                              // <<
   304         SR,                              // >>
   305         USR,                             // >>>
   306         PLUS,                            // +
   307         MINUS,                           // -
   308         MUL,                             // *
   309         DIV,                             // /
   310         MOD,                             // %
   312         /** Assignment operators, of type Assignop.
   313          */
   314         BITOR_ASG(BITOR),                // |=
   315         BITXOR_ASG(BITXOR),              // ^=
   316         BITAND_ASG(BITAND),              // &=
   318         SL_ASG(SL),                      // <<=
   319         SR_ASG(SR),                      // >>=
   320         USR_ASG(USR),                    // >>>=
   321         PLUS_ASG(PLUS),                  // +=
   322         MINUS_ASG(MINUS),                // -=
   323         MUL_ASG(MUL),                    // *=
   324         DIV_ASG(DIV),                    // /=
   325         MOD_ASG(MOD),                    // %=
   327         /** A synthetic let expression, of type LetExpr.
   328          */
   329         LETEXPR;                         // ala scheme
   331         private Tag noAssignTag;
   333         private static int numberOfOperators = MOD.ordinal() - POS.ordinal() + 1;
   335         private Tag(Tag noAssignTag) {
   336             this.noAssignTag = noAssignTag;
   337         }
   339         private Tag() { }
   341         public static int getNumberOfOperators() {
   342             return numberOfOperators;
   343         }
   345         public Tag noAssignOp() {
   346             if (noAssignTag != null)
   347                 return noAssignTag;
   348             throw new AssertionError("noAssignOp() method is not available for non assignment tags");
   349         }
   351         public boolean isPostUnaryOp() {
   352             return (this == POSTINC || this == POSTDEC);
   353         }
   355         public boolean isIncOrDecUnaryOp() {
   356             return (this == PREINC || this == PREDEC || this == POSTINC || this == POSTDEC);
   357         }
   359         public boolean isAssignop() {
   360             return noAssignTag != null;
   361         }
   363         public int operatorIndex() {
   364             return (this.ordinal() - POS.ordinal());
   365         }
   366     }
   368     /* The (encoded) position in the source file. @see util.Position.
   369      */
   370     public int pos;
   372     /* The type of this node.
   373      */
   374     public Type type;
   376     /* The tag of this node -- one of the constants declared above.
   377      */
   378     public abstract Tag getTag();
   380     /* Returns true if the tag of this node is equals to tag.
   381      */
   382     public boolean hasTag(Tag tag) {
   383         return tag == getTag();
   384     }
   386     /** Convert a tree to a pretty-printed string. */
   387     @Override
   388     public String toString() {
   389         StringWriter s = new StringWriter();
   390         try {
   391             new Pretty(s, false).printExpr(this);
   392         }
   393         catch (IOException e) {
   394             // should never happen, because StringWriter is defined
   395             // never to throw any IOExceptions
   396             throw new AssertionError(e);
   397         }
   398         return s.toString();
   399     }
   401     /** Set position field and return this tree.
   402      */
   403     public JCTree setPos(int pos) {
   404         this.pos = pos;
   405         return this;
   406     }
   408     /** Set type field and return this tree.
   409      */
   410     public JCTree setType(Type type) {
   411         this.type = type;
   412         return this;
   413     }
   415     /** Visit this tree with a given visitor.
   416      */
   417     public abstract void accept(Visitor v);
   419     public abstract <R,D> R accept(TreeVisitor<R,D> v, D d);
   421     /** Return a shallow copy of this tree.
   422      */
   423     @Override
   424     public Object clone() {
   425         try {
   426             return super.clone();
   427         } catch(CloneNotSupportedException e) {
   428             throw new RuntimeException(e);
   429         }
   430     }
   432     /** Get a default position for this tree node.
   433      */
   434     public DiagnosticPosition pos() {
   435         return this;
   436     }
   438     // for default DiagnosticPosition
   439     public JCTree getTree() {
   440         return this;
   441     }
   443     // for default DiagnosticPosition
   444     public int getStartPosition() {
   445         return TreeInfo.getStartPos(this);
   446     }
   448     // for default DiagnosticPosition
   449     public int getPreferredPosition() {
   450         return pos;
   451     }
   453     // for default DiagnosticPosition
   454     public int getEndPosition(EndPosTable endPosTable) {
   455         return TreeInfo.getEndPos(this, endPosTable);
   456     }
   458     /**
   459      * Everything in one source file is kept in a TopLevel structure.
   460      * @param pid              The tree representing the package clause.
   461      * @param sourcefile       The source file name.
   462      * @param defs             All definitions in this file (ClassDef, Import, and Skip)
   463      * @param packge           The package it belongs to.
   464      * @param namedImportScope A scope for all named imports.
   465      * @param starImportScope  A scope for all import-on-demands.
   466      * @param lineMap          Line starting positions, defined only
   467      *                         if option -g is set.
   468      * @param docComments      A hashtable that stores all documentation comments
   469      *                         indexed by the tree nodes they refer to.
   470      *                         defined only if option -s is set.
   471      * @param endPositions     An object encapsulating ending positions of source
   472      *                         ranges indexed by the tree nodes they belong to.
   473      *                         Defined only if option -Xjcov is set.
   474      */
   475     public static class JCCompilationUnit extends JCTree implements CompilationUnitTree {
   476         public List<JCAnnotation> packageAnnotations;
   477         public JCExpression pid;
   478         public List<JCTree> defs;
   479         public JavaFileObject sourcefile;
   480         public PackageSymbol packge;
   481         public ImportScope namedImportScope;
   482         public StarImportScope starImportScope;
   483         public Position.LineMap lineMap = null;
   484         public Map<JCTree, String> docComments = null;
   485         public EndPosTable endPositions = null;
   486         protected JCCompilationUnit(List<JCAnnotation> packageAnnotations,
   487                         JCExpression pid,
   488                         List<JCTree> defs,
   489                         JavaFileObject sourcefile,
   490                         PackageSymbol packge,
   491                         ImportScope namedImportScope,
   492                         StarImportScope starImportScope) {
   493             this.packageAnnotations = packageAnnotations;
   494             this.pid = pid;
   495             this.defs = defs;
   496             this.sourcefile = sourcefile;
   497             this.packge = packge;
   498             this.namedImportScope = namedImportScope;
   499             this.starImportScope = starImportScope;
   500         }
   501         @Override
   502         public void accept(Visitor v) { v.visitTopLevel(this); }
   504         public Kind getKind() { return Kind.COMPILATION_UNIT; }
   505         public List<JCAnnotation> getPackageAnnotations() {
   506             return packageAnnotations;
   507         }
   508         public List<JCImport> getImports() {
   509             ListBuffer<JCImport> imports = new ListBuffer<JCImport>();
   510             for (JCTree tree : defs) {
   511                 if (tree.hasTag(IMPORT))
   512                     imports.append((JCImport)tree);
   513                 else if (!tree.hasTag(SKIP))
   514                     break;
   515             }
   516             return imports.toList();
   517         }
   518         public JCExpression getPackageName() { return pid; }
   519         public JavaFileObject getSourceFile() {
   520             return sourcefile;
   521         }
   522         public Position.LineMap getLineMap() {
   523             return lineMap;
   524         }
   525         public List<JCTree> getTypeDecls() {
   526             List<JCTree> typeDefs;
   527             for (typeDefs = defs; !typeDefs.isEmpty(); typeDefs = typeDefs.tail)
   528                 if (!typeDefs.head.hasTag(IMPORT))
   529                     break;
   530             return typeDefs;
   531         }
   532         @Override
   533         public <R,D> R accept(TreeVisitor<R,D> v, D d) {
   534             return v.visitCompilationUnit(this, d);
   535         }
   537         @Override
   538         public Tag getTag() {
   539             return TOPLEVEL;
   540         }
   541     }
   543     /**
   544      * An import clause.
   545      * @param qualid    The imported class(es).
   546      */
   547     public static class JCImport extends JCTree implements ImportTree {
   548         public boolean staticImport;
   549         public JCTree qualid;
   550         protected JCImport(JCTree qualid, boolean importStatic) {
   551             this.qualid = qualid;
   552             this.staticImport = importStatic;
   553         }
   554         @Override
   555         public void accept(Visitor v) { v.visitImport(this); }
   557         public boolean isStatic() { return staticImport; }
   558         public JCTree getQualifiedIdentifier() { return qualid; }
   560         public Kind getKind() { return Kind.IMPORT; }
   561         @Override
   562         public <R,D> R accept(TreeVisitor<R,D> v, D d) {
   563             return v.visitImport(this, d);
   564         }
   566         @Override
   567         public Tag getTag() {
   568             return IMPORT;
   569         }
   570     }
   572     public static abstract class JCStatement extends JCTree implements StatementTree {
   573         @Override
   574         public JCStatement setType(Type type) {
   575             super.setType(type);
   576             return this;
   577         }
   578         @Override
   579         public JCStatement setPos(int pos) {
   580             super.setPos(pos);
   581             return this;
   582         }
   583     }
   585     public static abstract class JCExpression extends JCTree implements ExpressionTree {
   586         @Override
   587         public JCExpression setType(Type type) {
   588             super.setType(type);
   589             return this;
   590         }
   591         @Override
   592         public JCExpression setPos(int pos) {
   593             super.setPos(pos);
   594             return this;
   595         }
   596     }
   598     /**
   599      * A class definition.
   600      * @param modifiers the modifiers
   601      * @param name the name of the class
   602      * @param typarams formal class parameters
   603      * @param extending the classes this class extends
   604      * @param implementing the interfaces implemented by this class
   605      * @param defs all variables and methods defined in this class
   606      * @param sym the symbol
   607      */
   608     public static class JCClassDecl extends JCStatement implements ClassTree {
   609         public JCModifiers mods;
   610         public Name name;
   611         public List<JCTypeParameter> typarams;
   612         public JCExpression extending;
   613         public List<JCExpression> implementing;
   614         public List<JCTree> defs;
   615         public ClassSymbol sym;
   616         protected JCClassDecl(JCModifiers mods,
   617                            Name name,
   618                            List<JCTypeParameter> typarams,
   619                            JCExpression extending,
   620                            List<JCExpression> implementing,
   621                            List<JCTree> defs,
   622                            ClassSymbol sym)
   623         {
   624             this.mods = mods;
   625             this.name = name;
   626             this.typarams = typarams;
   627             this.extending = extending;
   628             this.implementing = implementing;
   629             this.defs = defs;
   630             this.sym = sym;
   631         }
   632         @Override
   633         public void accept(Visitor v) { v.visitClassDef(this); }
   635         public Kind getKind() {
   636             if ((mods.flags & Flags.ANNOTATION) != 0)
   637                 return Kind.ANNOTATION_TYPE;
   638             else if ((mods.flags & Flags.INTERFACE) != 0)
   639                 return Kind.INTERFACE;
   640             else if ((mods.flags & Flags.ENUM) != 0)
   641                 return Kind.ENUM;
   642             else
   643                 return Kind.CLASS;
   644         }
   646         public JCModifiers getModifiers() { return mods; }
   647         public Name getSimpleName() { return name; }
   648         public List<JCTypeParameter> getTypeParameters() {
   649             return typarams;
   650         }
   651         public JCTree getExtendsClause() { return extending; }
   652         public List<JCExpression> getImplementsClause() {
   653             return implementing;
   654         }
   655         public List<JCTree> getMembers() {
   656             return defs;
   657         }
   658         @Override
   659         public <R,D> R accept(TreeVisitor<R,D> v, D d) {
   660             return v.visitClass(this, d);
   661         }
   663         @Override
   664         public Tag getTag() {
   665             return CLASSDEF;
   666         }
   667     }
   669     /**
   670      * A method definition.
   671      * @param modifiers method modifiers
   672      * @param name method name
   673      * @param restype type of method return value
   674      * @param typarams type parameters
   675      * @param params value parameters
   676      * @param thrown exceptions thrown by this method
   677      * @param stats statements in the method
   678      * @param sym method symbol
   679      */
   680     public static class JCMethodDecl extends JCTree implements MethodTree {
   681         public JCModifiers mods;
   682         public Name name;
   683         public JCExpression restype;
   684         public List<JCTypeParameter> typarams;
   685         public List<JCVariableDecl> params;
   686         public List<JCExpression> thrown;
   687         public JCBlock body;
   688         public JCExpression defaultValue; // for annotation types
   689         public MethodSymbol sym;
   690         protected JCMethodDecl(JCModifiers mods,
   691                             Name name,
   692                             JCExpression restype,
   693                             List<JCTypeParameter> typarams,
   694                             List<JCVariableDecl> params,
   695                             List<JCExpression> thrown,
   696                             JCBlock body,
   697                             JCExpression defaultValue,
   698                             MethodSymbol sym)
   699         {
   700             this.mods = mods;
   701             this.name = name;
   702             this.restype = restype;
   703             this.typarams = typarams;
   704             this.params = params;
   705             this.thrown = thrown;
   706             this.body = body;
   707             this.defaultValue = defaultValue;
   708             this.sym = sym;
   709         }
   710         @Override
   711         public void accept(Visitor v) { v.visitMethodDef(this); }
   713         public Kind getKind() { return Kind.METHOD; }
   714         public JCModifiers getModifiers() { return mods; }
   715         public Name getName() { return name; }
   716         public JCTree getReturnType() { return restype; }
   717         public List<JCTypeParameter> getTypeParameters() {
   718             return typarams;
   719         }
   720         public List<JCVariableDecl> getParameters() {
   721             return params;
   722         }
   723         public List<JCExpression> getThrows() {
   724             return thrown;
   725         }
   726         public JCBlock getBody() { return body; }
   727         public JCTree getDefaultValue() { // for annotation types
   728             return defaultValue;
   729         }
   730         @Override
   731         public <R,D> R accept(TreeVisitor<R,D> v, D d) {
   732             return v.visitMethod(this, d);
   733         }
   735         @Override
   736         public Tag getTag() {
   737             return METHODDEF;
   738         }
   739   }
   741     /**
   742      * A variable definition.
   743      * @param modifiers variable modifiers
   744      * @param name variable name
   745      * @param vartype type of the variable
   746      * @param init variables initial value
   747      * @param sym symbol
   748      */
   749     public static class JCVariableDecl extends JCStatement implements VariableTree {
   750         public JCModifiers mods;
   751         public Name name;
   752         public JCExpression vartype;
   753         public JCExpression init;
   754         public VarSymbol sym;
   755         protected JCVariableDecl(JCModifiers mods,
   756                          Name name,
   757                          JCExpression vartype,
   758                          JCExpression init,
   759                          VarSymbol sym) {
   760             this.mods = mods;
   761             this.name = name;
   762             this.vartype = vartype;
   763             this.init = init;
   764             this.sym = sym;
   765         }
   766         @Override
   767         public void accept(Visitor v) { v.visitVarDef(this); }
   769         public Kind getKind() { return Kind.VARIABLE; }
   770         public JCModifiers getModifiers() { return mods; }
   771         public Name getName() { return name; }
   772         public JCTree getType() { return vartype; }
   773         public JCExpression getInitializer() {
   774             return init;
   775         }
   776         @Override
   777         public <R,D> R accept(TreeVisitor<R,D> v, D d) {
   778             return v.visitVariable(this, d);
   779         }
   781         @Override
   782         public Tag getTag() {
   783             return VARDEF;
   784         }
   785     }
   787       /**
   788      * A no-op statement ";".
   789      */
   790     public static class JCSkip extends JCStatement implements EmptyStatementTree {
   791         protected JCSkip() {
   792         }
   793         @Override
   794         public void accept(Visitor v) { v.visitSkip(this); }
   796         public Kind getKind() { return Kind.EMPTY_STATEMENT; }
   797         @Override
   798         public <R,D> R accept(TreeVisitor<R,D> v, D d) {
   799             return v.visitEmptyStatement(this, d);
   800         }
   802         @Override
   803         public Tag getTag() {
   804             return SKIP;
   805         }
   806     }
   808     /**
   809      * A statement block.
   810      * @param stats statements
   811      * @param flags flags
   812      */
   813     public static class JCBlock extends JCStatement implements BlockTree {
   814         public long flags;
   815         public List<JCStatement> stats;
   816         /** Position of closing brace, optional. */
   817         public int endpos = Position.NOPOS;
   818         protected JCBlock(long flags, List<JCStatement> stats) {
   819             this.stats = stats;
   820             this.flags = flags;
   821         }
   822         @Override
   823         public void accept(Visitor v) { v.visitBlock(this); }
   825         public Kind getKind() { return Kind.BLOCK; }
   826         public List<JCStatement> getStatements() {
   827             return stats;
   828         }
   829         public boolean isStatic() { return (flags & Flags.STATIC) != 0; }
   830         @Override
   831         public <R,D> R accept(TreeVisitor<R,D> v, D d) {
   832             return v.visitBlock(this, d);
   833         }
   835         @Override
   836         public Tag getTag() {
   837             return BLOCK;
   838         }
   839     }
   841     /**
   842      * A do loop
   843      */
   844     public static class JCDoWhileLoop extends JCStatement implements DoWhileLoopTree {
   845         public JCStatement body;
   846         public JCExpression cond;
   847         protected JCDoWhileLoop(JCStatement body, JCExpression cond) {
   848             this.body = body;
   849             this.cond = cond;
   850         }
   851         @Override
   852         public void accept(Visitor v) { v.visitDoLoop(this); }
   854         public Kind getKind() { return Kind.DO_WHILE_LOOP; }
   855         public JCExpression getCondition() { return cond; }
   856         public JCStatement getStatement() { return body; }
   857         @Override
   858         public <R,D> R accept(TreeVisitor<R,D> v, D d) {
   859             return v.visitDoWhileLoop(this, d);
   860         }
   862         @Override
   863         public Tag getTag() {
   864             return DOLOOP;
   865         }
   866     }
   868     /**
   869      * A while loop
   870      */
   871     public static class JCWhileLoop extends JCStatement implements WhileLoopTree {
   872         public JCExpression cond;
   873         public JCStatement body;
   874         protected JCWhileLoop(JCExpression cond, JCStatement body) {
   875             this.cond = cond;
   876             this.body = body;
   877         }
   878         @Override
   879         public void accept(Visitor v) { v.visitWhileLoop(this); }
   881         public Kind getKind() { return Kind.WHILE_LOOP; }
   882         public JCExpression getCondition() { return cond; }
   883         public JCStatement getStatement() { return body; }
   884         @Override
   885         public <R,D> R accept(TreeVisitor<R,D> v, D d) {
   886             return v.visitWhileLoop(this, d);
   887         }
   889         @Override
   890         public Tag getTag() {
   891             return WHILELOOP;
   892         }
   893     }
   895     /**
   896      * A for loop.
   897      */
   898     public static class JCForLoop extends JCStatement implements ForLoopTree {
   899         public List<JCStatement> init;
   900         public JCExpression cond;
   901         public List<JCExpressionStatement> step;
   902         public JCStatement body;
   903         protected JCForLoop(List<JCStatement> init,
   904                           JCExpression cond,
   905                           List<JCExpressionStatement> update,
   906                           JCStatement body)
   907         {
   908             this.init = init;
   909             this.cond = cond;
   910             this.step = update;
   911             this.body = body;
   912         }
   913         @Override
   914         public void accept(Visitor v) { v.visitForLoop(this); }
   916         public Kind getKind() { return Kind.FOR_LOOP; }
   917         public JCExpression getCondition() { return cond; }
   918         public JCStatement getStatement() { return body; }
   919         public List<JCStatement> getInitializer() {
   920             return init;
   921         }
   922         public List<JCExpressionStatement> getUpdate() {
   923             return step;
   924         }
   925         @Override
   926         public <R,D> R accept(TreeVisitor<R,D> v, D d) {
   927             return v.visitForLoop(this, d);
   928         }
   930         @Override
   931         public Tag getTag() {
   932             return FORLOOP;
   933         }
   934     }
   936     /**
   937      * The enhanced for loop.
   938      */
   939     public static class JCEnhancedForLoop extends JCStatement implements EnhancedForLoopTree {
   940         public JCVariableDecl var;
   941         public JCExpression expr;
   942         public JCStatement body;
   943         protected JCEnhancedForLoop(JCVariableDecl var, JCExpression expr, JCStatement body) {
   944             this.var = var;
   945             this.expr = expr;
   946             this.body = body;
   947         }
   948         @Override
   949         public void accept(Visitor v) { v.visitForeachLoop(this); }
   951         public Kind getKind() { return Kind.ENHANCED_FOR_LOOP; }
   952         public JCVariableDecl getVariable() { return var; }
   953         public JCExpression getExpression() { return expr; }
   954         public JCStatement getStatement() { return body; }
   955         @Override
   956         public <R,D> R accept(TreeVisitor<R,D> v, D d) {
   957             return v.visitEnhancedForLoop(this, d);
   958         }
   959         @Override
   960         public Tag getTag() {
   961             return FOREACHLOOP;
   962         }
   963     }
   965     /**
   966      * A labelled expression or statement.
   967      */
   968     public static class JCLabeledStatement extends JCStatement implements LabeledStatementTree {
   969         public Name label;
   970         public JCStatement body;
   971         protected JCLabeledStatement(Name label, JCStatement body) {
   972             this.label = label;
   973             this.body = body;
   974         }
   975         @Override
   976         public void accept(Visitor v) { v.visitLabelled(this); }
   977         public Kind getKind() { return Kind.LABELED_STATEMENT; }
   978         public Name getLabel() { return label; }
   979         public JCStatement getStatement() { return body; }
   980         @Override
   981         public <R,D> R accept(TreeVisitor<R,D> v, D d) {
   982             return v.visitLabeledStatement(this, d);
   983         }
   984         @Override
   985         public Tag getTag() {
   986             return LABELLED;
   987         }
   988     }
   990     /**
   991      * A "switch ( ) { }" construction.
   992      */
   993     public static class JCSwitch extends JCStatement implements SwitchTree {
   994         public JCExpression selector;
   995         public List<JCCase> cases;
   996         protected JCSwitch(JCExpression selector, List<JCCase> cases) {
   997             this.selector = selector;
   998             this.cases = cases;
   999         }
  1000         @Override
  1001         public void accept(Visitor v) { v.visitSwitch(this); }
  1003         public Kind getKind() { return Kind.SWITCH; }
  1004         public JCExpression getExpression() { return selector; }
  1005         public List<JCCase> getCases() { return cases; }
  1006         @Override
  1007         public <R,D> R accept(TreeVisitor<R,D> v, D d) {
  1008             return v.visitSwitch(this, d);
  1010         @Override
  1011         public Tag getTag() {
  1012             return SWITCH;
  1016     /**
  1017      * A "case  :" of a switch.
  1018      */
  1019     public static class JCCase extends JCStatement implements CaseTree {
  1020         public JCExpression pat;
  1021         public List<JCStatement> stats;
  1022         protected JCCase(JCExpression pat, List<JCStatement> stats) {
  1023             this.pat = pat;
  1024             this.stats = stats;
  1026         @Override
  1027         public void accept(Visitor v) { v.visitCase(this); }
  1029         public Kind getKind() { return Kind.CASE; }
  1030         public JCExpression getExpression() { return pat; }
  1031         public List<JCStatement> getStatements() { return stats; }
  1032         @Override
  1033         public <R,D> R accept(TreeVisitor<R,D> v, D d) {
  1034             return v.visitCase(this, d);
  1036         @Override
  1037         public Tag getTag() {
  1038             return CASE;
  1042     /**
  1043      * A synchronized block.
  1044      */
  1045     public static class JCSynchronized extends JCStatement implements SynchronizedTree {
  1046         public JCExpression lock;
  1047         public JCBlock body;
  1048         protected JCSynchronized(JCExpression lock, JCBlock body) {
  1049             this.lock = lock;
  1050             this.body = body;
  1052         @Override
  1053         public void accept(Visitor v) { v.visitSynchronized(this); }
  1055         public Kind getKind() { return Kind.SYNCHRONIZED; }
  1056         public JCExpression getExpression() { return lock; }
  1057         public JCBlock getBlock() { return body; }
  1058         @Override
  1059         public <R,D> R accept(TreeVisitor<R,D> v, D d) {
  1060             return v.visitSynchronized(this, d);
  1062         @Override
  1063         public Tag getTag() {
  1064             return SYNCHRONIZED;
  1068     /**
  1069      * A "try { } catch ( ) { } finally { }" block.
  1070      */
  1071     public static class JCTry extends JCStatement implements TryTree {
  1072         public JCBlock body;
  1073         public List<JCCatch> catchers;
  1074         public JCBlock finalizer;
  1075         public List<JCTree> resources;
  1076         protected JCTry(List<JCTree> resources,
  1077                         JCBlock body,
  1078                         List<JCCatch> catchers,
  1079                         JCBlock finalizer) {
  1080             this.body = body;
  1081             this.catchers = catchers;
  1082             this.finalizer = finalizer;
  1083             this.resources = resources;
  1085         @Override
  1086         public void accept(Visitor v) { v.visitTry(this); }
  1088         public Kind getKind() { return Kind.TRY; }
  1089         public JCBlock getBlock() { return body; }
  1090         public List<JCCatch> getCatches() {
  1091             return catchers;
  1093         public JCBlock getFinallyBlock() { return finalizer; }
  1094         @Override
  1095         public <R,D> R accept(TreeVisitor<R,D> v, D d) {
  1096             return v.visitTry(this, d);
  1098         @Override
  1099         public List<? extends JCTree> getResources() {
  1100             return resources;
  1102         @Override
  1103         public Tag getTag() {
  1104             return TRY;
  1108     /**
  1109      * A catch block.
  1110      */
  1111     public static class JCCatch extends JCTree implements CatchTree {
  1112         public JCVariableDecl param;
  1113         public JCBlock body;
  1114         protected JCCatch(JCVariableDecl param, JCBlock body) {
  1115             this.param = param;
  1116             this.body = body;
  1118         @Override
  1119         public void accept(Visitor v) { v.visitCatch(this); }
  1121         public Kind getKind() { return Kind.CATCH; }
  1122         public JCVariableDecl getParameter() { return param; }
  1123         public JCBlock getBlock() { return body; }
  1124         @Override
  1125         public <R,D> R accept(TreeVisitor<R,D> v, D d) {
  1126             return v.visitCatch(this, d);
  1128         @Override
  1129         public Tag getTag() {
  1130             return CATCH;
  1134     /**
  1135      * A ( ) ? ( ) : ( ) conditional expression
  1136      */
  1137     public static class JCConditional extends JCExpression implements ConditionalExpressionTree {
  1138         public JCExpression cond;
  1139         public JCExpression truepart;
  1140         public JCExpression falsepart;
  1141         protected JCConditional(JCExpression cond,
  1142                               JCExpression truepart,
  1143                               JCExpression falsepart)
  1145             this.cond = cond;
  1146             this.truepart = truepart;
  1147             this.falsepart = falsepart;
  1149         @Override
  1150         public void accept(Visitor v) { v.visitConditional(this); }
  1152         public Kind getKind() { return Kind.CONDITIONAL_EXPRESSION; }
  1153         public JCExpression getCondition() { return cond; }
  1154         public JCExpression getTrueExpression() { return truepart; }
  1155         public JCExpression getFalseExpression() { return falsepart; }
  1156         @Override
  1157         public <R,D> R accept(TreeVisitor<R,D> v, D d) {
  1158             return v.visitConditionalExpression(this, d);
  1160         @Override
  1161         public Tag getTag() {
  1162             return CONDEXPR;
  1166     /**
  1167      * An "if ( ) { } else { }" block
  1168      */
  1169     public static class JCIf extends JCStatement implements IfTree {
  1170         public JCExpression cond;
  1171         public JCStatement thenpart;
  1172         public JCStatement elsepart;
  1173         protected JCIf(JCExpression cond,
  1174                      JCStatement thenpart,
  1175                      JCStatement elsepart)
  1177             this.cond = cond;
  1178             this.thenpart = thenpart;
  1179             this.elsepart = elsepart;
  1181         @Override
  1182         public void accept(Visitor v) { v.visitIf(this); }
  1184         public Kind getKind() { return Kind.IF; }
  1185         public JCExpression getCondition() { return cond; }
  1186         public JCStatement getThenStatement() { return thenpart; }
  1187         public JCStatement getElseStatement() { return elsepart; }
  1188         @Override
  1189         public <R,D> R accept(TreeVisitor<R,D> v, D d) {
  1190             return v.visitIf(this, d);
  1192         @Override
  1193         public Tag getTag() {
  1194             return IF;
  1198     /**
  1199      * an expression statement
  1200      * @param expr expression structure
  1201      */
  1202     public static class JCExpressionStatement extends JCStatement implements ExpressionStatementTree {
  1203         public JCExpression expr;
  1204         protected JCExpressionStatement(JCExpression expr)
  1206             this.expr = expr;
  1208         @Override
  1209         public void accept(Visitor v) { v.visitExec(this); }
  1211         public Kind getKind() { return Kind.EXPRESSION_STATEMENT; }
  1212         public JCExpression getExpression() { return expr; }
  1213         @Override
  1214         public <R,D> R accept(TreeVisitor<R,D> v, D d) {
  1215             return v.visitExpressionStatement(this, d);
  1217         @Override
  1218         public Tag getTag() {
  1219             return EXEC;
  1222         /** Convert a expression-statement tree to a pretty-printed string. */
  1223         @Override
  1224         public String toString() {
  1225             StringWriter s = new StringWriter();
  1226             try {
  1227                 new Pretty(s, false).printStat(this);
  1229             catch (IOException e) {
  1230                 // should never happen, because StringWriter is defined
  1231                 // never to throw any IOExceptions
  1232                 throw new AssertionError(e);
  1234             return s.toString();
  1238     /**
  1239      * A break from a loop or switch.
  1240      */
  1241     public static class JCBreak extends JCStatement implements BreakTree {
  1242         public Name label;
  1243         public JCTree target;
  1244         protected JCBreak(Name label, JCTree target) {
  1245             this.label = label;
  1246             this.target = target;
  1248         @Override
  1249         public void accept(Visitor v) { v.visitBreak(this); }
  1251         public Kind getKind() { return Kind.BREAK; }
  1252         public Name getLabel() { return label; }
  1253         @Override
  1254         public <R,D> R accept(TreeVisitor<R,D> v, D d) {
  1255             return v.visitBreak(this, d);
  1257         @Override
  1258         public Tag getTag() {
  1259             return BREAK;
  1263     /**
  1264      * A continue of a loop.
  1265      */
  1266     public static class JCContinue extends JCStatement implements ContinueTree {
  1267         public Name label;
  1268         public JCTree target;
  1269         protected JCContinue(Name label, JCTree target) {
  1270             this.label = label;
  1271             this.target = target;
  1273         @Override
  1274         public void accept(Visitor v) { v.visitContinue(this); }
  1276         public Kind getKind() { return Kind.CONTINUE; }
  1277         public Name getLabel() { return label; }
  1278         @Override
  1279         public <R,D> R accept(TreeVisitor<R,D> v, D d) {
  1280             return v.visitContinue(this, d);
  1282         @Override
  1283         public Tag getTag() {
  1284             return CONTINUE;
  1288     /**
  1289      * A return statement.
  1290      */
  1291     public static class JCReturn extends JCStatement implements ReturnTree {
  1292         public JCExpression expr;
  1293         protected JCReturn(JCExpression expr) {
  1294             this.expr = expr;
  1296         @Override
  1297         public void accept(Visitor v) { v.visitReturn(this); }
  1299         public Kind getKind() { return Kind.RETURN; }
  1300         public JCExpression getExpression() { return expr; }
  1301         @Override
  1302         public <R,D> R accept(TreeVisitor<R,D> v, D d) {
  1303             return v.visitReturn(this, d);
  1305         @Override
  1306         public Tag getTag() {
  1307             return RETURN;
  1311     /**
  1312      * A throw statement.
  1313      */
  1314     public static class JCThrow extends JCStatement implements ThrowTree {
  1315         public JCExpression expr;
  1316         protected JCThrow(JCTree expr) {
  1317             this.expr = (JCExpression)expr;
  1319         @Override
  1320         public void accept(Visitor v) { v.visitThrow(this); }
  1322         public Kind getKind() { return Kind.THROW; }
  1323         public JCExpression getExpression() { return expr; }
  1324         @Override
  1325         public <R,D> R accept(TreeVisitor<R,D> v, D d) {
  1326             return v.visitThrow(this, d);
  1328         @Override
  1329         public Tag getTag() {
  1330             return THROW;
  1334     /**
  1335      * An assert statement.
  1336      */
  1337     public static class JCAssert extends JCStatement implements AssertTree {
  1338         public JCExpression cond;
  1339         public JCExpression detail;
  1340         protected JCAssert(JCExpression cond, JCExpression detail) {
  1341             this.cond = cond;
  1342             this.detail = detail;
  1344         @Override
  1345         public void accept(Visitor v) { v.visitAssert(this); }
  1347         public Kind getKind() { return Kind.ASSERT; }
  1348         public JCExpression getCondition() { return cond; }
  1349         public JCExpression getDetail() { return detail; }
  1350         @Override
  1351         public <R,D> R accept(TreeVisitor<R,D> v, D d) {
  1352             return v.visitAssert(this, d);
  1354         @Override
  1355         public Tag getTag() {
  1356             return ASSERT;
  1360     /**
  1361      * A method invocation
  1362      */
  1363     public static class JCMethodInvocation extends JCExpression implements MethodInvocationTree {
  1364         public List<JCExpression> typeargs;
  1365         public JCExpression meth;
  1366         public List<JCExpression> args;
  1367         public Type varargsElement;
  1368         protected JCMethodInvocation(List<JCExpression> typeargs,
  1369                         JCExpression meth,
  1370                         List<JCExpression> args)
  1372             this.typeargs = (typeargs == null) ? List.<JCExpression>nil()
  1373                                                : typeargs;
  1374             this.meth = meth;
  1375             this.args = args;
  1377         @Override
  1378         public void accept(Visitor v) { v.visitApply(this); }
  1380         public Kind getKind() { return Kind.METHOD_INVOCATION; }
  1381         public List<JCExpression> getTypeArguments() {
  1382             return typeargs;
  1384         public JCExpression getMethodSelect() { return meth; }
  1385         public List<JCExpression> getArguments() {
  1386             return args;
  1388         @Override
  1389         public <R,D> R accept(TreeVisitor<R,D> v, D d) {
  1390             return v.visitMethodInvocation(this, d);
  1392         @Override
  1393         public JCMethodInvocation setType(Type type) {
  1394             super.setType(type);
  1395             return this;
  1397         @Override
  1398         public Tag getTag() {
  1399             return(APPLY);
  1403     /**
  1404      * A new(...) operation.
  1405      */
  1406     public static class JCNewClass extends JCExpression implements NewClassTree {
  1407         public JCExpression encl;
  1408         public List<JCExpression> typeargs;
  1409         public JCExpression clazz;
  1410         public List<JCExpression> args;
  1411         public JCClassDecl def;
  1412         public Symbol constructor;
  1413         public Type varargsElement;
  1414         public Type constructorType;
  1415         protected JCNewClass(JCExpression encl,
  1416                            List<JCExpression> typeargs,
  1417                            JCExpression clazz,
  1418                            List<JCExpression> args,
  1419                            JCClassDecl def)
  1421             this.encl = encl;
  1422             this.typeargs = (typeargs == null) ? List.<JCExpression>nil()
  1423                                                : typeargs;
  1424             this.clazz = clazz;
  1425             this.args = args;
  1426             this.def = def;
  1428         @Override
  1429         public void accept(Visitor v) { v.visitNewClass(this); }
  1431         public Kind getKind() { return Kind.NEW_CLASS; }
  1432         public JCExpression getEnclosingExpression() { // expr.new C< ... > ( ... )
  1433             return encl;
  1435         public List<JCExpression> getTypeArguments() {
  1436             return typeargs;
  1438         public JCExpression getIdentifier() { return clazz; }
  1439         public List<JCExpression> getArguments() {
  1440             return args;
  1442         public JCClassDecl getClassBody() { return def; }
  1443         @Override
  1444         public <R,D> R accept(TreeVisitor<R,D> v, D d) {
  1445             return v.visitNewClass(this, d);
  1447         @Override
  1448         public Tag getTag() {
  1449             return NEWCLASS;
  1453     /**
  1454      * A new[...] operation.
  1455      */
  1456     public static class JCNewArray extends JCExpression implements NewArrayTree {
  1457         public JCExpression elemtype;
  1458         public List<JCExpression> dims;
  1459         public List<JCExpression> elems;
  1460         protected JCNewArray(JCExpression elemtype,
  1461                            List<JCExpression> dims,
  1462                            List<JCExpression> elems)
  1464             this.elemtype = elemtype;
  1465             this.dims = dims;
  1466             this.elems = elems;
  1468         @Override
  1469         public void accept(Visitor v) { v.visitNewArray(this); }
  1471         public Kind getKind() { return Kind.NEW_ARRAY; }
  1472         public JCExpression getType() { return elemtype; }
  1473         public List<JCExpression> getDimensions() {
  1474             return dims;
  1476         public List<JCExpression> getInitializers() {
  1477             return elems;
  1479         @Override
  1480         public <R,D> R accept(TreeVisitor<R,D> v, D d) {
  1481             return v.visitNewArray(this, d);
  1483         @Override
  1484         public Tag getTag() {
  1485             return NEWARRAY;
  1489     /**
  1490      * A parenthesized subexpression ( ... )
  1491      */
  1492     public static class JCParens extends JCExpression implements ParenthesizedTree {
  1493         public JCExpression expr;
  1494         protected JCParens(JCExpression expr) {
  1495             this.expr = expr;
  1497         @Override
  1498         public void accept(Visitor v) { v.visitParens(this); }
  1500         public Kind getKind() { return Kind.PARENTHESIZED; }
  1501         public JCExpression getExpression() { return expr; }
  1502         @Override
  1503         public <R,D> R accept(TreeVisitor<R,D> v, D d) {
  1504             return v.visitParenthesized(this, d);
  1506         @Override
  1507         public Tag getTag() {
  1508             return PARENS;
  1512     /**
  1513      * A assignment with "=".
  1514      */
  1515     public static class JCAssign extends JCExpression implements AssignmentTree {
  1516         public JCExpression lhs;
  1517         public JCExpression rhs;
  1518         protected JCAssign(JCExpression lhs, JCExpression rhs) {
  1519             this.lhs = lhs;
  1520             this.rhs = rhs;
  1522         @Override
  1523         public void accept(Visitor v) { v.visitAssign(this); }
  1525         public Kind getKind() { return Kind.ASSIGNMENT; }
  1526         public JCExpression getVariable() { return lhs; }
  1527         public JCExpression getExpression() { return rhs; }
  1528         @Override
  1529         public <R,D> R accept(TreeVisitor<R,D> v, D d) {
  1530             return v.visitAssignment(this, d);
  1532         @Override
  1533         public Tag getTag() {
  1534             return ASSIGN;
  1538     /**
  1539      * An assignment with "+=", "|=" ...
  1540      */
  1541     public static class JCAssignOp extends JCExpression implements CompoundAssignmentTree {
  1542         private Tag opcode;
  1543         public JCExpression lhs;
  1544         public JCExpression rhs;
  1545         public Symbol operator;
  1546         protected JCAssignOp(Tag opcode, JCTree lhs, JCTree rhs, Symbol operator) {
  1547             this.opcode = opcode;
  1548             this.lhs = (JCExpression)lhs;
  1549             this.rhs = (JCExpression)rhs;
  1550             this.operator = operator;
  1552         @Override
  1553         public void accept(Visitor v) { v.visitAssignop(this); }
  1555         public Kind getKind() { return TreeInfo.tagToKind(getTag()); }
  1556         public JCExpression getVariable() { return lhs; }
  1557         public JCExpression getExpression() { return rhs; }
  1558         public Symbol getOperator() {
  1559             return operator;
  1561         @Override
  1562         public <R,D> R accept(TreeVisitor<R,D> v, D d) {
  1563             return v.visitCompoundAssignment(this, d);
  1565         @Override
  1566         public Tag getTag() {
  1567             return opcode;
  1571     /**
  1572      * A unary operation.
  1573      */
  1574     public static class JCUnary extends JCExpression implements UnaryTree {
  1575         private Tag opcode;
  1576         public JCExpression arg;
  1577         public Symbol operator;
  1578         protected JCUnary(Tag opcode, JCExpression arg) {
  1579             this.opcode = opcode;
  1580             this.arg = arg;
  1582         @Override
  1583         public void accept(Visitor v) { v.visitUnary(this); }
  1585         public Kind getKind() { return TreeInfo.tagToKind(getTag()); }
  1586         public JCExpression getExpression() { return arg; }
  1587         public Symbol getOperator() {
  1588             return operator;
  1590         @Override
  1591         public <R,D> R accept(TreeVisitor<R,D> v, D d) {
  1592             return v.visitUnary(this, d);
  1594         @Override
  1595         public Tag getTag() {
  1596             return opcode;
  1599         public void setTag(Tag tag) {
  1600             opcode = tag;
  1604     /**
  1605      * A binary operation.
  1606      */
  1607     public static class JCBinary extends JCExpression implements BinaryTree {
  1608         private Tag opcode;
  1609         public JCExpression lhs;
  1610         public JCExpression rhs;
  1611         public Symbol operator;
  1612         protected JCBinary(Tag opcode,
  1613                          JCExpression lhs,
  1614                          JCExpression rhs,
  1615                          Symbol operator) {
  1616             this.opcode = opcode;
  1617             this.lhs = lhs;
  1618             this.rhs = rhs;
  1619             this.operator = operator;
  1621         @Override
  1622         public void accept(Visitor v) { v.visitBinary(this); }
  1624         public Kind getKind() { return TreeInfo.tagToKind(getTag()); }
  1625         public JCExpression getLeftOperand() { return lhs; }
  1626         public JCExpression getRightOperand() { return rhs; }
  1627         public Symbol getOperator() {
  1628             return operator;
  1630         @Override
  1631         public <R,D> R accept(TreeVisitor<R,D> v, D d) {
  1632             return v.visitBinary(this, d);
  1634         @Override
  1635         public Tag getTag() {
  1636             return opcode;
  1640     /**
  1641      * A type cast.
  1642      */
  1643     public static class JCTypeCast extends JCExpression implements TypeCastTree {
  1644         public JCTree clazz;
  1645         public JCExpression expr;
  1646         protected JCTypeCast(JCTree clazz, JCExpression expr) {
  1647             this.clazz = clazz;
  1648             this.expr = expr;
  1650         @Override
  1651         public void accept(Visitor v) { v.visitTypeCast(this); }
  1653         public Kind getKind() { return Kind.TYPE_CAST; }
  1654         public JCTree getType() { return clazz; }
  1655         public JCExpression getExpression() { return expr; }
  1656         @Override
  1657         public <R,D> R accept(TreeVisitor<R,D> v, D d) {
  1658             return v.visitTypeCast(this, d);
  1660         @Override
  1661         public Tag getTag() {
  1662             return TYPECAST;
  1666     /**
  1667      * A type test.
  1668      */
  1669     public static class JCInstanceOf extends JCExpression implements InstanceOfTree {
  1670         public JCExpression expr;
  1671         public JCTree clazz;
  1672         protected JCInstanceOf(JCExpression expr, JCTree clazz) {
  1673             this.expr = expr;
  1674             this.clazz = clazz;
  1676         @Override
  1677         public void accept(Visitor v) { v.visitTypeTest(this); }
  1679         public Kind getKind() { return Kind.INSTANCE_OF; }
  1680         public JCTree getType() { return clazz; }
  1681         public JCExpression getExpression() { return expr; }
  1682         @Override
  1683         public <R,D> R accept(TreeVisitor<R,D> v, D d) {
  1684             return v.visitInstanceOf(this, d);
  1686         @Override
  1687         public Tag getTag() {
  1688             return TYPETEST;
  1692     /**
  1693      * An array selection
  1694      */
  1695     public static class JCArrayAccess extends JCExpression implements ArrayAccessTree {
  1696         public JCExpression indexed;
  1697         public JCExpression index;
  1698         protected JCArrayAccess(JCExpression indexed, JCExpression index) {
  1699             this.indexed = indexed;
  1700             this.index = index;
  1702         @Override
  1703         public void accept(Visitor v) { v.visitIndexed(this); }
  1705         public Kind getKind() { return Kind.ARRAY_ACCESS; }
  1706         public JCExpression getExpression() { return indexed; }
  1707         public JCExpression getIndex() { return index; }
  1708         @Override
  1709         public <R,D> R accept(TreeVisitor<R,D> v, D d) {
  1710             return v.visitArrayAccess(this, d);
  1712         @Override
  1713         public Tag getTag() {
  1714             return INDEXED;
  1718     /**
  1719      * Selects through packages and classes
  1720      * @param selected selected Tree hierarchie
  1721      * @param selector name of field to select thru
  1722      * @param sym symbol of the selected class
  1723      */
  1724     public static class JCFieldAccess extends JCExpression implements MemberSelectTree {
  1725         public JCExpression selected;
  1726         public Name name;
  1727         public Symbol sym;
  1728         protected JCFieldAccess(JCExpression selected, Name name, Symbol sym) {
  1729             this.selected = selected;
  1730             this.name = name;
  1731             this.sym = sym;
  1733         @Override
  1734         public void accept(Visitor v) { v.visitSelect(this); }
  1736         public Kind getKind() { return Kind.MEMBER_SELECT; }
  1737         public JCExpression getExpression() { return selected; }
  1738         @Override
  1739         public <R,D> R accept(TreeVisitor<R,D> v, D d) {
  1740             return v.visitMemberSelect(this, d);
  1742         public Name getIdentifier() { return name; }
  1743         @Override
  1744         public Tag getTag() {
  1745             return SELECT;
  1749     /**
  1750      * An identifier
  1751      * @param idname the name
  1752      * @param sym the symbol
  1753      */
  1754     public static class JCIdent extends JCExpression implements IdentifierTree {
  1755         public Name name;
  1756         public Symbol sym;
  1757         protected JCIdent(Name name, Symbol sym) {
  1758             this.name = name;
  1759             this.sym = sym;
  1761         @Override
  1762         public void accept(Visitor v) { v.visitIdent(this); }
  1764         public Kind getKind() { return Kind.IDENTIFIER; }
  1765         public Name getName() { return name; }
  1766         @Override
  1767         public <R,D> R accept(TreeVisitor<R,D> v, D d) {
  1768             return v.visitIdentifier(this, d);
  1770         @Override
  1771         public Tag getTag() {
  1772             return IDENT;
  1776     /**
  1777      * A constant value given literally.
  1778      * @param value value representation
  1779      */
  1780     public static class JCLiteral extends JCExpression implements LiteralTree {
  1781         public int typetag;
  1782         public Object value;
  1783         protected JCLiteral(int typetag, Object value) {
  1784             this.typetag = typetag;
  1785             this.value = value;
  1787         @Override
  1788         public void accept(Visitor v) { v.visitLiteral(this); }
  1790         public Kind getKind() {
  1791             switch (typetag) {
  1792             case TypeTags.INT:
  1793                 return Kind.INT_LITERAL;
  1794             case TypeTags.LONG:
  1795                 return Kind.LONG_LITERAL;
  1796             case TypeTags.FLOAT:
  1797                 return Kind.FLOAT_LITERAL;
  1798             case TypeTags.DOUBLE:
  1799                 return Kind.DOUBLE_LITERAL;
  1800             case TypeTags.BOOLEAN:
  1801                 return Kind.BOOLEAN_LITERAL;
  1802             case TypeTags.CHAR:
  1803                 return Kind.CHAR_LITERAL;
  1804             case TypeTags.CLASS:
  1805                 return Kind.STRING_LITERAL;
  1806             case TypeTags.BOT:
  1807                 return Kind.NULL_LITERAL;
  1808             default:
  1809                 throw new AssertionError("unknown literal kind " + this);
  1812         public Object getValue() {
  1813             switch (typetag) {
  1814                 case TypeTags.BOOLEAN:
  1815                     int bi = (Integer) value;
  1816                     return (bi != 0);
  1817                 case TypeTags.CHAR:
  1818                     int ci = (Integer) value;
  1819                     char c = (char) ci;
  1820                     if (c != ci)
  1821                         throw new AssertionError("bad value for char literal");
  1822                     return c;
  1823                 default:
  1824                     return value;
  1827         @Override
  1828         public <R,D> R accept(TreeVisitor<R,D> v, D d) {
  1829             return v.visitLiteral(this, d);
  1831         @Override
  1832         public JCLiteral setType(Type type) {
  1833             super.setType(type);
  1834             return this;
  1836         @Override
  1837         public Tag getTag() {
  1838             return LITERAL;
  1842     /**
  1843      * Identifies a basic type.
  1844      * @param tag the basic type id
  1845      * @see TypeTags
  1846      */
  1847     public static class JCPrimitiveTypeTree extends JCExpression implements PrimitiveTypeTree {
  1848         public int typetag;
  1849         protected JCPrimitiveTypeTree(int typetag) {
  1850             this.typetag = typetag;
  1852         @Override
  1853         public void accept(Visitor v) { v.visitTypeIdent(this); }
  1855         public Kind getKind() { return Kind.PRIMITIVE_TYPE; }
  1856         public TypeKind getPrimitiveTypeKind() {
  1857             switch (typetag) {
  1858             case TypeTags.BOOLEAN:
  1859                 return TypeKind.BOOLEAN;
  1860             case TypeTags.BYTE:
  1861                 return TypeKind.BYTE;
  1862             case TypeTags.SHORT:
  1863                 return TypeKind.SHORT;
  1864             case TypeTags.INT:
  1865                 return TypeKind.INT;
  1866             case TypeTags.LONG:
  1867                 return TypeKind.LONG;
  1868             case TypeTags.CHAR:
  1869                 return TypeKind.CHAR;
  1870             case TypeTags.FLOAT:
  1871                 return TypeKind.FLOAT;
  1872             case TypeTags.DOUBLE:
  1873                 return TypeKind.DOUBLE;
  1874             case TypeTags.VOID:
  1875                 return TypeKind.VOID;
  1876             default:
  1877                 throw new AssertionError("unknown primitive type " + this);
  1880         @Override
  1881         public <R,D> R accept(TreeVisitor<R,D> v, D d) {
  1882             return v.visitPrimitiveType(this, d);
  1884         @Override
  1885         public Tag getTag() {
  1886             return TYPEIDENT;
  1890     /**
  1891      * An array type, A[]
  1892      */
  1893     public static class JCArrayTypeTree extends JCExpression implements ArrayTypeTree {
  1894         public JCExpression elemtype;
  1895         protected JCArrayTypeTree(JCExpression elemtype) {
  1896             this.elemtype = elemtype;
  1898         @Override
  1899         public void accept(Visitor v) { v.visitTypeArray(this); }
  1901         public Kind getKind() { return Kind.ARRAY_TYPE; }
  1902         public JCTree getType() { return elemtype; }
  1903         @Override
  1904         public <R,D> R accept(TreeVisitor<R,D> v, D d) {
  1905             return v.visitArrayType(this, d);
  1907         @Override
  1908         public Tag getTag() {
  1909             return TYPEARRAY;
  1913     /**
  1914      * A parameterized type, T<...>
  1915      */
  1916     public static class JCTypeApply extends JCExpression implements ParameterizedTypeTree {
  1917         public JCExpression clazz;
  1918         public List<JCExpression> arguments;
  1919         protected JCTypeApply(JCExpression clazz, List<JCExpression> arguments) {
  1920             this.clazz = clazz;
  1921             this.arguments = arguments;
  1923         @Override
  1924         public void accept(Visitor v) { v.visitTypeApply(this); }
  1926         public Kind getKind() { return Kind.PARAMETERIZED_TYPE; }
  1927         public JCTree getType() { return clazz; }
  1928         public List<JCExpression> getTypeArguments() {
  1929             return arguments;
  1931         @Override
  1932         public <R,D> R accept(TreeVisitor<R,D> v, D d) {
  1933             return v.visitParameterizedType(this, d);
  1935         @Override
  1936         public Tag getTag() {
  1937             return TYPEAPPLY;
  1941     /**
  1942      * A union type, T1 | T2 | ... Tn (used in multicatch statements)
  1943      */
  1944     public static class JCTypeUnion extends JCExpression implements UnionTypeTree {
  1946         public List<JCExpression> alternatives;
  1948         protected JCTypeUnion(List<JCExpression> components) {
  1949             this.alternatives = components;
  1951         @Override
  1952         public void accept(Visitor v) { v.visitTypeUnion(this); }
  1954         public Kind getKind() { return Kind.UNION_TYPE; }
  1956         public List<JCExpression> getTypeAlternatives() {
  1957             return alternatives;
  1959         @Override
  1960         public <R,D> R accept(TreeVisitor<R,D> v, D d) {
  1961             return v.visitUnionType(this, d);
  1963         @Override
  1964         public Tag getTag() {
  1965             return TYPEUNION;
  1969     /**
  1970      * A formal class parameter.
  1971      * @param name name
  1972      * @param bounds bounds
  1973      */
  1974     public static class JCTypeParameter extends JCTree implements TypeParameterTree {
  1975         public Name name;
  1976         public List<JCExpression> bounds;
  1977         protected JCTypeParameter(Name name, List<JCExpression> bounds) {
  1978             this.name = name;
  1979             this.bounds = bounds;
  1981         @Override
  1982         public void accept(Visitor v) { v.visitTypeParameter(this); }
  1984         public Kind getKind() { return Kind.TYPE_PARAMETER; }
  1985         public Name getName() { return name; }
  1986         public List<JCExpression> getBounds() {
  1987             return bounds;
  1989         @Override
  1990         public <R,D> R accept(TreeVisitor<R,D> v, D d) {
  1991             return v.visitTypeParameter(this, d);
  1993         @Override
  1994         public Tag getTag() {
  1995             return TYPEPARAMETER;
  1999     public static class JCWildcard extends JCExpression implements WildcardTree {
  2000         public TypeBoundKind kind;
  2001         public JCTree inner;
  2002         protected JCWildcard(TypeBoundKind kind, JCTree inner) {
  2003             kind.getClass(); // null-check
  2004             this.kind = kind;
  2005             this.inner = inner;
  2007         @Override
  2008         public void accept(Visitor v) { v.visitWildcard(this); }
  2010         public Kind getKind() {
  2011             switch (kind.kind) {
  2012             case UNBOUND:
  2013                 return Kind.UNBOUNDED_WILDCARD;
  2014             case EXTENDS:
  2015                 return Kind.EXTENDS_WILDCARD;
  2016             case SUPER:
  2017                 return Kind.SUPER_WILDCARD;
  2018             default:
  2019                 throw new AssertionError("Unknown wildcard bound " + kind);
  2022         public JCTree getBound() { return inner; }
  2023         @Override
  2024         public <R,D> R accept(TreeVisitor<R,D> v, D d) {
  2025             return v.visitWildcard(this, d);
  2027         @Override
  2028         public Tag getTag() {
  2029             return WILDCARD;
  2033     public static class TypeBoundKind extends JCTree {
  2034         public BoundKind kind;
  2035         protected TypeBoundKind(BoundKind kind) {
  2036             this.kind = kind;
  2038         @Override
  2039         public void accept(Visitor v) { v.visitTypeBoundKind(this); }
  2041         public Kind getKind() {
  2042             throw new AssertionError("TypeBoundKind is not part of a public API");
  2044         @Override
  2045         public <R,D> R accept(TreeVisitor<R,D> v, D d) {
  2046             throw new AssertionError("TypeBoundKind is not part of a public API");
  2048         @Override
  2049         public Tag getTag() {
  2050             return TYPEBOUNDKIND;
  2054     public static class JCAnnotation extends JCExpression implements AnnotationTree {
  2055         public JCTree annotationType;
  2056         public List<JCExpression> args;
  2057         protected JCAnnotation(JCTree annotationType, List<JCExpression> args) {
  2058             this.annotationType = annotationType;
  2059             this.args = args;
  2061         @Override
  2062         public void accept(Visitor v) { v.visitAnnotation(this); }
  2064         public Kind getKind() { return Kind.ANNOTATION; }
  2065         public JCTree getAnnotationType() { return annotationType; }
  2066         public List<JCExpression> getArguments() {
  2067             return args;
  2069         @Override
  2070         public <R,D> R accept(TreeVisitor<R,D> v, D d) {
  2071             return v.visitAnnotation(this, d);
  2073         @Override
  2074         public Tag getTag() {
  2075             return ANNOTATION;
  2079     public static class JCModifiers extends JCTree implements com.sun.source.tree.ModifiersTree {
  2080         public long flags;
  2081         public List<JCAnnotation> annotations;
  2082         protected JCModifiers(long flags, List<JCAnnotation> annotations) {
  2083             this.flags = flags;
  2084             this.annotations = annotations;
  2086         @Override
  2087         public void accept(Visitor v) { v.visitModifiers(this); }
  2089         public Kind getKind() { return Kind.MODIFIERS; }
  2090         public Set<Modifier> getFlags() {
  2091             return Flags.asModifierSet(flags);
  2093         public List<JCAnnotation> getAnnotations() {
  2094             return annotations;
  2096         @Override
  2097         public <R,D> R accept(TreeVisitor<R,D> v, D d) {
  2098             return v.visitModifiers(this, d);
  2100         @Override
  2101         public Tag getTag() {
  2102             return MODIFIERS;
  2106     public static class JCErroneous extends JCExpression
  2107             implements com.sun.source.tree.ErroneousTree {
  2108         public List<? extends JCTree> errs;
  2109         protected JCErroneous(List<? extends JCTree> errs) {
  2110             this.errs = errs;
  2112         @Override
  2113         public void accept(Visitor v) { v.visitErroneous(this); }
  2115         public Kind getKind() { return Kind.ERRONEOUS; }
  2117         public List<? extends JCTree> getErrorTrees() {
  2118             return errs;
  2121         @Override
  2122         public <R,D> R accept(TreeVisitor<R,D> v, D d) {
  2123             return v.visitErroneous(this, d);
  2125         @Override
  2126         public Tag getTag() {
  2127             return ERRONEOUS;
  2131     /** (let int x = 3; in x+2) */
  2132     public static class LetExpr extends JCExpression {
  2133         public List<JCVariableDecl> defs;
  2134         public JCTree expr;
  2135         protected LetExpr(List<JCVariableDecl> defs, JCTree expr) {
  2136             this.defs = defs;
  2137             this.expr = expr;
  2139         @Override
  2140         public void accept(Visitor v) { v.visitLetExpr(this); }
  2142         public Kind getKind() {
  2143             throw new AssertionError("LetExpr is not part of a public API");
  2145         @Override
  2146         public <R,D> R accept(TreeVisitor<R,D> v, D d) {
  2147             throw new AssertionError("LetExpr is not part of a public API");
  2149         @Override
  2150         public Tag getTag() {
  2151             return LETEXPR;
  2155     /** An interface for tree factories
  2156      */
  2157     public interface Factory {
  2158         JCCompilationUnit TopLevel(List<JCAnnotation> packageAnnotations,
  2159                                    JCExpression pid,
  2160                                    List<JCTree> defs);
  2161         JCImport Import(JCTree qualid, boolean staticImport);
  2162         JCClassDecl ClassDef(JCModifiers mods,
  2163                           Name name,
  2164                           List<JCTypeParameter> typarams,
  2165                           JCExpression extending,
  2166                           List<JCExpression> implementing,
  2167                           List<JCTree> defs);
  2168         JCMethodDecl MethodDef(JCModifiers mods,
  2169                             Name name,
  2170                             JCExpression restype,
  2171                             List<JCTypeParameter> typarams,
  2172                             List<JCVariableDecl> params,
  2173                             List<JCExpression> thrown,
  2174                             JCBlock body,
  2175                             JCExpression defaultValue);
  2176         JCVariableDecl VarDef(JCModifiers mods,
  2177                       Name name,
  2178                       JCExpression vartype,
  2179                       JCExpression init);
  2180         JCSkip Skip();
  2181         JCBlock Block(long flags, List<JCStatement> stats);
  2182         JCDoWhileLoop DoLoop(JCStatement body, JCExpression cond);
  2183         JCWhileLoop WhileLoop(JCExpression cond, JCStatement body);
  2184         JCForLoop ForLoop(List<JCStatement> init,
  2185                         JCExpression cond,
  2186                         List<JCExpressionStatement> step,
  2187                         JCStatement body);
  2188         JCEnhancedForLoop ForeachLoop(JCVariableDecl var, JCExpression expr, JCStatement body);
  2189         JCLabeledStatement Labelled(Name label, JCStatement body);
  2190         JCSwitch Switch(JCExpression selector, List<JCCase> cases);
  2191         JCCase Case(JCExpression pat, List<JCStatement> stats);
  2192         JCSynchronized Synchronized(JCExpression lock, JCBlock body);
  2193         JCTry Try(JCBlock body, List<JCCatch> catchers, JCBlock finalizer);
  2194         JCTry Try(List<JCTree> resources,
  2195                   JCBlock body,
  2196                   List<JCCatch> catchers,
  2197                   JCBlock finalizer);
  2198         JCCatch Catch(JCVariableDecl param, JCBlock body);
  2199         JCConditional Conditional(JCExpression cond,
  2200                                 JCExpression thenpart,
  2201                                 JCExpression elsepart);
  2202         JCIf If(JCExpression cond, JCStatement thenpart, JCStatement elsepart);
  2203         JCExpressionStatement Exec(JCExpression expr);
  2204         JCBreak Break(Name label);
  2205         JCContinue Continue(Name label);
  2206         JCReturn Return(JCExpression expr);
  2207         JCThrow Throw(JCTree expr);
  2208         JCAssert Assert(JCExpression cond, JCExpression detail);
  2209         JCMethodInvocation Apply(List<JCExpression> typeargs,
  2210                     JCExpression fn,
  2211                     List<JCExpression> args);
  2212         JCNewClass NewClass(JCExpression encl,
  2213                           List<JCExpression> typeargs,
  2214                           JCExpression clazz,
  2215                           List<JCExpression> args,
  2216                           JCClassDecl def);
  2217         JCNewArray NewArray(JCExpression elemtype,
  2218                           List<JCExpression> dims,
  2219                           List<JCExpression> elems);
  2220         JCParens Parens(JCExpression expr);
  2221         JCAssign Assign(JCExpression lhs, JCExpression rhs);
  2222         JCAssignOp Assignop(Tag opcode, JCTree lhs, JCTree rhs);
  2223         JCUnary Unary(Tag opcode, JCExpression arg);
  2224         JCBinary Binary(Tag opcode, JCExpression lhs, JCExpression rhs);
  2225         JCTypeCast TypeCast(JCTree expr, JCExpression type);
  2226         JCInstanceOf TypeTest(JCExpression expr, JCTree clazz);
  2227         JCArrayAccess Indexed(JCExpression indexed, JCExpression index);
  2228         JCFieldAccess Select(JCExpression selected, Name selector);
  2229         JCIdent Ident(Name idname);
  2230         JCLiteral Literal(int tag, Object value);
  2231         JCPrimitiveTypeTree TypeIdent(int typetag);
  2232         JCArrayTypeTree TypeArray(JCExpression elemtype);
  2233         JCTypeApply TypeApply(JCExpression clazz, List<JCExpression> arguments);
  2234         JCTypeParameter TypeParameter(Name name, List<JCExpression> bounds);
  2235         JCWildcard Wildcard(TypeBoundKind kind, JCTree type);
  2236         TypeBoundKind TypeBoundKind(BoundKind kind);
  2237         JCAnnotation Annotation(JCTree annotationType, List<JCExpression> args);
  2238         JCModifiers Modifiers(long flags, List<JCAnnotation> annotations);
  2239         JCErroneous Erroneous(List<? extends JCTree> errs);
  2240         LetExpr LetExpr(List<JCVariableDecl> defs, JCTree expr);
  2243     /** A generic visitor class for trees.
  2244      */
  2245     public static abstract class Visitor {
  2246         public void visitTopLevel(JCCompilationUnit that)    { visitTree(that); }
  2247         public void visitImport(JCImport that)               { visitTree(that); }
  2248         public void visitClassDef(JCClassDecl that)          { visitTree(that); }
  2249         public void visitMethodDef(JCMethodDecl that)        { visitTree(that); }
  2250         public void visitVarDef(JCVariableDecl that)         { visitTree(that); }
  2251         public void visitSkip(JCSkip that)                   { visitTree(that); }
  2252         public void visitBlock(JCBlock that)                 { visitTree(that); }
  2253         public void visitDoLoop(JCDoWhileLoop that)          { visitTree(that); }
  2254         public void visitWhileLoop(JCWhileLoop that)         { visitTree(that); }
  2255         public void visitForLoop(JCForLoop that)             { visitTree(that); }
  2256         public void visitForeachLoop(JCEnhancedForLoop that) { visitTree(that); }
  2257         public void visitLabelled(JCLabeledStatement that)   { visitTree(that); }
  2258         public void visitSwitch(JCSwitch that)               { visitTree(that); }
  2259         public void visitCase(JCCase that)                   { visitTree(that); }
  2260         public void visitSynchronized(JCSynchronized that)   { visitTree(that); }
  2261         public void visitTry(JCTry that)                     { visitTree(that); }
  2262         public void visitCatch(JCCatch that)                 { visitTree(that); }
  2263         public void visitConditional(JCConditional that)     { visitTree(that); }
  2264         public void visitIf(JCIf that)                       { visitTree(that); }
  2265         public void visitExec(JCExpressionStatement that)    { visitTree(that); }
  2266         public void visitBreak(JCBreak that)                 { visitTree(that); }
  2267         public void visitContinue(JCContinue that)           { visitTree(that); }
  2268         public void visitReturn(JCReturn that)               { visitTree(that); }
  2269         public void visitThrow(JCThrow that)                 { visitTree(that); }
  2270         public void visitAssert(JCAssert that)               { visitTree(that); }
  2271         public void visitApply(JCMethodInvocation that)      { visitTree(that); }
  2272         public void visitNewClass(JCNewClass that)           { visitTree(that); }
  2273         public void visitNewArray(JCNewArray that)           { visitTree(that); }
  2274         public void visitParens(JCParens that)               { visitTree(that); }
  2275         public void visitAssign(JCAssign that)               { visitTree(that); }
  2276         public void visitAssignop(JCAssignOp that)           { visitTree(that); }
  2277         public void visitUnary(JCUnary that)                 { visitTree(that); }
  2278         public void visitBinary(JCBinary that)               { visitTree(that); }
  2279         public void visitTypeCast(JCTypeCast that)           { visitTree(that); }
  2280         public void visitTypeTest(JCInstanceOf that)         { visitTree(that); }
  2281         public void visitIndexed(JCArrayAccess that)         { visitTree(that); }
  2282         public void visitSelect(JCFieldAccess that)          { visitTree(that); }
  2283         public void visitIdent(JCIdent that)                 { visitTree(that); }
  2284         public void visitLiteral(JCLiteral that)             { visitTree(that); }
  2285         public void visitTypeIdent(JCPrimitiveTypeTree that) { visitTree(that); }
  2286         public void visitTypeArray(JCArrayTypeTree that)     { visitTree(that); }
  2287         public void visitTypeApply(JCTypeApply that)         { visitTree(that); }
  2288         public void visitTypeUnion(JCTypeUnion that)         { visitTree(that); }
  2289         public void visitTypeParameter(JCTypeParameter that) { visitTree(that); }
  2290         public void visitWildcard(JCWildcard that)           { visitTree(that); }
  2291         public void visitTypeBoundKind(TypeBoundKind that)   { visitTree(that); }
  2292         public void visitAnnotation(JCAnnotation that)       { visitTree(that); }
  2293         public void visitModifiers(JCModifiers that)         { visitTree(that); }
  2294         public void visitErroneous(JCErroneous that)         { visitTree(that); }
  2295         public void visitLetExpr(LetExpr that)               { visitTree(that); }
  2297         public void visitTree(JCTree that)                   { Assert.error(); }

mercurial