< prev index next >

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

Print this page




  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  */
  25 
  26 package com.sun.tools.javac.tree;
  27 
  28 import java.io.IOException;
  29 import java.io.StringWriter;
  30 import java.util.*;
  31 
  32 import javax.lang.model.element.Modifier;
  33 import javax.lang.model.type.TypeKind;
  34 import javax.tools.JavaFileObject;
  35 
  36 import com.sun.source.tree.*;
  37 import com.sun.tools.javac.code.*;
  38 import com.sun.tools.javac.code.Directive.RequiresDirective;
  39 import com.sun.tools.javac.code.Scope.*;
  40 import com.sun.tools.javac.code.Symbol.*;

  41 import com.sun.tools.javac.util.*;
  42 import com.sun.tools.javac.util.DefinedBy.Api;
  43 import com.sun.tools.javac.util.JCDiagnostic.DiagnosticPosition;
  44 import com.sun.tools.javac.util.List;
  45 
  46 import static com.sun.tools.javac.tree.JCTree.Tag.*;
  47 
  48 import javax.tools.JavaFileManager.Location;
  49 
  50 import com.sun.source.tree.CaseTree.CaseKind;
  51 import com.sun.source.tree.ModuleTree.ModuleKind;
  52 import com.sun.tools.javac.code.Directive.ExportsDirective;
  53 import com.sun.tools.javac.code.Directive.OpensDirective;
  54 import com.sun.tools.javac.code.Type.ModuleType;
  55 import com.sun.tools.javac.tree.JCTree.JCPolyExpression.PolyKind;
  56 
  57 /**
  58  * Root class for abstract syntax tree nodes. It provides definitions
  59  * for specific tree nodes as subclasses nested inside.
  60  *


 222         /** Lambda expression, of type Lambda.
 223          */
 224         LAMBDA,
 225 
 226         /** Parenthesized subexpressions, of type Parens.
 227          */
 228         PARENS,
 229 
 230         /** Assignment expressions, of type Assign.
 231          */
 232         ASSIGN,
 233 
 234         /** Type cast expressions, of type TypeCast.
 235          */
 236         TYPECAST,
 237 
 238         /** Type test expressions, of type TypeTest.
 239          */
 240         TYPETEST,
 241 




 242         /** Indexed array expressions, of type Indexed.
 243          */
 244         INDEXED,
 245 
 246         /** Selections, of type Select.
 247          */
 248         SELECT,
 249 
 250         /** Member references, of type Reference.
 251          */
 252         REFERENCE,
 253 
 254         /** Simple identifiers, of type Ident.
 255          */
 256         IDENT,
 257 
 258         /** Literals, of type Literal.
 259          */
 260         LITERAL,
 261 


 743 
 744         public Type getDescriptorType(Types types) {
 745             return target != null ? types.findDescriptorType(target) : types.createErrorType(null);
 746         }
 747     }
 748 
 749     /**
 750      * A class definition.
 751      */
 752     public static class JCClassDecl extends JCStatement implements ClassTree {
 753         /** the modifiers */
 754         public JCModifiers mods;
 755         /** the name of the class */
 756         public Name name;
 757         /** formal class parameters */
 758         public List<JCTypeParameter> typarams;
 759         /** the classes this class extends */
 760         public JCExpression extending;
 761         /** the interfaces implemented by this class */
 762         public List<JCExpression> implementing;


 763         /** all variables and methods defined in this class */
 764         public List<JCTree> defs;
 765         /** the symbol */
 766         public ClassSymbol sym;
 767         protected JCClassDecl(JCModifiers mods,
 768                            Name name,
 769                            List<JCTypeParameter> typarams,
 770                            JCExpression extending,
 771                            List<JCExpression> implementing,

 772                            List<JCTree> defs,
 773                            ClassSymbol sym)
 774         {
 775             this.mods = mods;
 776             this.name = name;
 777             this.typarams = typarams;
 778             this.extending = extending;
 779             this.implementing = implementing;

 780             this.defs = defs;
 781             this.sym = sym;
 782         }
 783         @Override
 784         public void accept(Visitor v) { v.visitClassDef(this); }
 785 
 786         @DefinedBy(Api.COMPILER_TREE)
 787         public Kind getKind() {
 788             if ((mods.flags & Flags.ANNOTATION) != 0)
 789                 return Kind.ANNOTATION_TYPE;
 790             else if ((mods.flags & Flags.INTERFACE) != 0)
 791                 return Kind.INTERFACE;
 792             else if ((mods.flags & Flags.ENUM) != 0)
 793                 return Kind.ENUM;
 794             else
 795                 return Kind.CLASS;
 796         }
 797 
 798         @DefinedBy(Api.COMPILER_TREE)
 799         public JCModifiers getModifiers() { return mods; }


 915   }
 916 
 917     /**
 918      * A variable definition.
 919      */
 920     public static class JCVariableDecl extends JCStatement implements VariableTree {
 921         /** variable modifiers */
 922         public JCModifiers mods;
 923         /** variable name */
 924         public Name name;
 925         /** variable name expression */
 926         public JCExpression nameexpr;
 927         /** type of the variable */
 928         public JCExpression vartype;
 929         /** variable's initial value */
 930         public JCExpression init;
 931         /** symbol */
 932         public VarSymbol sym;
 933         /** explicit start pos */
 934         public int startPos = Position.NOPOS;


 935 
 936         protected JCVariableDecl(JCModifiers mods,
 937                          Name name,
 938                          JCExpression vartype,
 939                          JCExpression init,
 940                          VarSymbol sym) {

 941             this.mods = mods;
 942             this.name = name;
 943             this.vartype = vartype;
 944             this.init = init;
 945             this.sym = sym;

 946         }
 947 
 948         protected JCVariableDecl(JCModifiers mods,
 949                          JCExpression nameexpr,
 950                          JCExpression vartype) {
 951             this(mods, null, vartype, null, null);
 952             this.nameexpr = nameexpr;
 953             if (nameexpr.hasTag(Tag.IDENT)) {
 954                 this.name = ((JCIdent)nameexpr).name;
 955             } else {
 956                 // Only other option is qualified name x.y.this;
 957                 this.name = ((JCFieldAccess)nameexpr).name;
 958             }
 959         }
 960 
 961         public boolean isImplicitlyTyped() {
 962             return vartype == null;
 963         }
 964 
 965         @Override
 966         public void accept(Visitor v) { v.visitVarDef(this); }
 967 
 968         @DefinedBy(Api.COMPILER_TREE)
 969         public Kind getKind() { return Kind.VARIABLE; }
 970         @DefinedBy(Api.COMPILER_TREE)
 971         public JCModifiers getModifiers() { return mods; }


2128         public Kind getKind() { return Kind.TYPE_CAST; }
2129         @DefinedBy(Api.COMPILER_TREE)
2130         public JCTree getType() { return clazz; }
2131         @DefinedBy(Api.COMPILER_TREE)
2132         public JCExpression getExpression() { return expr; }
2133         @Override @DefinedBy(Api.COMPILER_TREE)
2134         public <R,D> R accept(TreeVisitor<R,D> v, D d) {
2135             return v.visitTypeCast(this, d);
2136         }
2137         @Override
2138         public Tag getTag() {
2139             return TYPECAST;
2140         }
2141     }
2142 
2143     /**
2144      * A type test.
2145      */
2146     public static class JCInstanceOf extends JCExpression implements InstanceOfTree {
2147         public JCExpression expr;
2148         public JCTree clazz;
2149         protected JCInstanceOf(JCExpression expr, JCTree clazz) {
2150             this.expr = expr;
2151             this.clazz = clazz;
2152         }
2153         @Override
2154         public void accept(Visitor v) { v.visitTypeTest(this); }
2155 
2156         @DefinedBy(Api.COMPILER_TREE)
2157         public Kind getKind() { return Kind.INSTANCE_OF; }
2158         @DefinedBy(Api.COMPILER_TREE)
2159         public JCTree getType() { return clazz; }






2160         @DefinedBy(Api.COMPILER_TREE)
2161         public JCExpression getExpression() { return expr; }
2162         @Override @DefinedBy(Api.COMPILER_TREE)
2163         public <R,D> R accept(TreeVisitor<R,D> v, D d) {
2164             return v.visitInstanceOf(this, d);
2165         }
2166         @Override
2167         public Tag getTag() {
2168             return TYPETEST;
2169         }
2170     }
2171 
2172     /**






















































2173      * An array selection
2174      */
2175     public static class JCArrayAccess extends JCExpression implements ArrayAccessTree {
2176         public JCExpression indexed;
2177         public JCExpression index;
2178         protected JCArrayAccess(JCExpression indexed, JCExpression index) {
2179             this.indexed = indexed;
2180             this.index = index;
2181         }
2182         @Override
2183         public void accept(Visitor v) { v.visitIndexed(this); }
2184 
2185         @DefinedBy(Api.COMPILER_TREE)
2186         public Kind getKind() { return Kind.ARRAY_ACCESS; }
2187         @DefinedBy(Api.COMPILER_TREE)
2188         public JCExpression getExpression() { return indexed; }
2189         @DefinedBy(Api.COMPILER_TREE)
2190         public JCExpression getIndex() { return index; }
2191         @Override @DefinedBy(Api.COMPILER_TREE)
2192         public <R,D> R accept(TreeVisitor<R,D> v, D d) {


3126         JCThrow Throw(JCExpression expr);
3127         JCAssert Assert(JCExpression cond, JCExpression detail);
3128         JCMethodInvocation Apply(List<JCExpression> typeargs,
3129                     JCExpression fn,
3130                     List<JCExpression> args);
3131         JCNewClass NewClass(JCExpression encl,
3132                           List<JCExpression> typeargs,
3133                           JCExpression clazz,
3134                           List<JCExpression> args,
3135                           JCClassDecl def);
3136         JCNewArray NewArray(JCExpression elemtype,
3137                           List<JCExpression> dims,
3138                           List<JCExpression> elems);
3139         JCParens Parens(JCExpression expr);
3140         JCAssign Assign(JCExpression lhs, JCExpression rhs);
3141         JCAssignOp Assignop(Tag opcode, JCTree lhs, JCTree rhs);
3142         JCUnary Unary(Tag opcode, JCExpression arg);
3143         JCBinary Binary(Tag opcode, JCExpression lhs, JCExpression rhs);
3144         JCTypeCast TypeCast(JCTree expr, JCExpression type);
3145         JCInstanceOf TypeTest(JCExpression expr, JCTree clazz);

3146         JCArrayAccess Indexed(JCExpression indexed, JCExpression index);
3147         JCFieldAccess Select(JCExpression selected, Name selector);
3148         JCIdent Ident(Name idname);
3149         JCLiteral Literal(TypeTag tag, Object value);
3150         JCPrimitiveTypeTree TypeIdent(TypeTag typetag);
3151         JCArrayTypeTree TypeArray(JCExpression elemtype);
3152         JCTypeApply TypeApply(JCExpression clazz, List<JCExpression> arguments);
3153         JCTypeParameter TypeParameter(Name name, List<JCExpression> bounds);
3154         JCWildcard Wildcard(TypeBoundKind kind, JCTree type);
3155         TypeBoundKind TypeBoundKind(BoundKind kind);
3156         JCAnnotation Annotation(JCTree annotationType, List<JCExpression> args);
3157         JCModifiers Modifiers(long flags, List<JCAnnotation> annotations);
3158         JCErroneous Erroneous(List<? extends JCTree> errs);
3159         JCModuleDecl ModuleDef(JCModifiers mods, ModuleKind kind, JCExpression qualId, List<JCDirective> directives);
3160         JCExports Exports(JCExpression qualId, List<JCExpression> moduleNames);
3161         JCOpens Opens(JCExpression qualId, List<JCExpression> moduleNames);
3162         JCProvides Provides(JCExpression serviceName, List<JCExpression> implNames);
3163         JCRequires Requires(boolean isTransitive, boolean isStaticPhase, JCExpression qualId);
3164         JCUses Uses(JCExpression qualId);
3165         LetExpr LetExpr(List<JCStatement> defs, JCExpression expr);


3190         public void visitConditional(JCConditional that)     { visitTree(that); }
3191         public void visitIf(JCIf that)                       { visitTree(that); }
3192         public void visitExec(JCExpressionStatement that)    { visitTree(that); }
3193         public void visitBreak(JCBreak that)                 { visitTree(that); }
3194         public void visitYield(JCYield that)                 { visitTree(that); }
3195         public void visitContinue(JCContinue that)           { visitTree(that); }
3196         public void visitReturn(JCReturn that)               { visitTree(that); }
3197         public void visitThrow(JCThrow that)                 { visitTree(that); }
3198         public void visitAssert(JCAssert that)               { visitTree(that); }
3199         public void visitApply(JCMethodInvocation that)      { visitTree(that); }
3200         public void visitNewClass(JCNewClass that)           { visitTree(that); }
3201         public void visitNewArray(JCNewArray that)           { visitTree(that); }
3202         public void visitLambda(JCLambda that)               { visitTree(that); }
3203         public void visitParens(JCParens that)               { visitTree(that); }
3204         public void visitAssign(JCAssign that)               { visitTree(that); }
3205         public void visitAssignop(JCAssignOp that)           { visitTree(that); }
3206         public void visitUnary(JCUnary that)                 { visitTree(that); }
3207         public void visitBinary(JCBinary that)               { visitTree(that); }
3208         public void visitTypeCast(JCTypeCast that)           { visitTree(that); }
3209         public void visitTypeTest(JCInstanceOf that)         { visitTree(that); }

3210         public void visitIndexed(JCArrayAccess that)         { visitTree(that); }
3211         public void visitSelect(JCFieldAccess that)          { visitTree(that); }
3212         public void visitReference(JCMemberReference that)   { visitTree(that); }
3213         public void visitIdent(JCIdent that)                 { visitTree(that); }
3214         public void visitLiteral(JCLiteral that)             { visitTree(that); }
3215         public void visitTypeIdent(JCPrimitiveTypeTree that) { visitTree(that); }
3216         public void visitTypeArray(JCArrayTypeTree that)     { visitTree(that); }
3217         public void visitTypeApply(JCTypeApply that)         { visitTree(that); }
3218         public void visitTypeUnion(JCTypeUnion that)         { visitTree(that); }
3219         public void visitTypeIntersection(JCTypeIntersection that)  { visitTree(that); }
3220         public void visitTypeParameter(JCTypeParameter that) { visitTree(that); }
3221         public void visitWildcard(JCWildcard that)           { visitTree(that); }
3222         public void visitTypeBoundKind(TypeBoundKind that)   { visitTree(that); }
3223         public void visitAnnotation(JCAnnotation that)       { visitTree(that); }
3224         public void visitModifiers(JCModifiers that)         { visitTree(that); }
3225         public void visitAnnotatedType(JCAnnotatedType that) { visitTree(that); }
3226         public void visitErroneous(JCErroneous that)         { visitTree(that); }
3227         public void visitModuleDef(JCModuleDecl that)        { visitTree(that); }
3228         public void visitExports(JCExports that)             { visitTree(that); }
3229         public void visitOpens(JCOpens that)                 { visitTree(that); }


  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  */
  25 
  26 package com.sun.tools.javac.tree;
  27 
  28 import java.io.IOException;
  29 import java.io.StringWriter;
  30 import java.util.*;
  31 
  32 import javax.lang.model.element.Modifier;
  33 import javax.lang.model.type.TypeKind;
  34 import javax.tools.JavaFileObject;
  35 
  36 import com.sun.source.tree.*;
  37 import com.sun.tools.javac.code.*;
  38 import com.sun.tools.javac.code.Directive.RequiresDirective;
  39 import com.sun.tools.javac.code.Scope.*;
  40 import com.sun.tools.javac.code.Symbol.*;
  41 import com.sun.tools.javac.comp.MatchBindingsComputer.BindingSymbol;
  42 import com.sun.tools.javac.util.*;
  43 import com.sun.tools.javac.util.DefinedBy.Api;
  44 import com.sun.tools.javac.util.JCDiagnostic.DiagnosticPosition;
  45 import com.sun.tools.javac.util.List;
  46 
  47 import static com.sun.tools.javac.tree.JCTree.Tag.*;
  48 
  49 import javax.tools.JavaFileManager.Location;
  50 
  51 import com.sun.source.tree.CaseTree.CaseKind;
  52 import com.sun.source.tree.ModuleTree.ModuleKind;
  53 import com.sun.tools.javac.code.Directive.ExportsDirective;
  54 import com.sun.tools.javac.code.Directive.OpensDirective;
  55 import com.sun.tools.javac.code.Type.ModuleType;
  56 import com.sun.tools.javac.tree.JCTree.JCPolyExpression.PolyKind;
  57 
  58 /**
  59  * Root class for abstract syntax tree nodes. It provides definitions
  60  * for specific tree nodes as subclasses nested inside.
  61  *


 223         /** Lambda expression, of type Lambda.
 224          */
 225         LAMBDA,
 226 
 227         /** Parenthesized subexpressions, of type Parens.
 228          */
 229         PARENS,
 230 
 231         /** Assignment expressions, of type Assign.
 232          */
 233         ASSIGN,
 234 
 235         /** Type cast expressions, of type TypeCast.
 236          */
 237         TYPECAST,
 238 
 239         /** Type test expressions, of type TypeTest.
 240          */
 241         TYPETEST,
 242 
 243         /** Patterns.
 244          */
 245         BINDINGPATTERN,
 246 
 247         /** Indexed array expressions, of type Indexed.
 248          */
 249         INDEXED,
 250 
 251         /** Selections, of type Select.
 252          */
 253         SELECT,
 254 
 255         /** Member references, of type Reference.
 256          */
 257         REFERENCE,
 258 
 259         /** Simple identifiers, of type Ident.
 260          */
 261         IDENT,
 262 
 263         /** Literals, of type Literal.
 264          */
 265         LITERAL,
 266 


 748 
 749         public Type getDescriptorType(Types types) {
 750             return target != null ? types.findDescriptorType(target) : types.createErrorType(null);
 751         }
 752     }
 753 
 754     /**
 755      * A class definition.
 756      */
 757     public static class JCClassDecl extends JCStatement implements ClassTree {
 758         /** the modifiers */
 759         public JCModifiers mods;
 760         /** the name of the class */
 761         public Name name;
 762         /** formal class parameters */
 763         public List<JCTypeParameter> typarams;
 764         /** the classes this class extends */
 765         public JCExpression extending;
 766         /** the interfaces implemented by this class */
 767         public List<JCExpression> implementing;
 768         /** the subclasses allowed to extend this class, if sealed */
 769         public List<JCExpression> permitting;
 770         /** all variables and methods defined in this class */
 771         public List<JCTree> defs;
 772         /** the symbol */
 773         public ClassSymbol sym;
 774         protected JCClassDecl(JCModifiers mods,
 775                            Name name,
 776                            List<JCTypeParameter> typarams,
 777                            JCExpression extending,
 778                            List<JCExpression> implementing,
 779                            List<JCExpression> permitting,
 780                            List<JCTree> defs,
 781                            ClassSymbol sym)
 782         {
 783             this.mods = mods;
 784             this.name = name;
 785             this.typarams = typarams;
 786             this.extending = extending;
 787             this.implementing = implementing;
 788             this.permitting = permitting;
 789             this.defs = defs;
 790             this.sym = sym;
 791         }
 792         @Override
 793         public void accept(Visitor v) { v.visitClassDef(this); }
 794 
 795         @DefinedBy(Api.COMPILER_TREE)
 796         public Kind getKind() {
 797             if ((mods.flags & Flags.ANNOTATION) != 0)
 798                 return Kind.ANNOTATION_TYPE;
 799             else if ((mods.flags & Flags.INTERFACE) != 0)
 800                 return Kind.INTERFACE;
 801             else if ((mods.flags & Flags.ENUM) != 0)
 802                 return Kind.ENUM;
 803             else
 804                 return Kind.CLASS;
 805         }
 806 
 807         @DefinedBy(Api.COMPILER_TREE)
 808         public JCModifiers getModifiers() { return mods; }


 924   }
 925 
 926     /**
 927      * A variable definition.
 928      */
 929     public static class JCVariableDecl extends JCStatement implements VariableTree {
 930         /** variable modifiers */
 931         public JCModifiers mods;
 932         /** variable name */
 933         public Name name;
 934         /** variable name expression */
 935         public JCExpression nameexpr;
 936         /** type of the variable */
 937         public JCExpression vartype;
 938         /** variable's initial value */
 939         public JCExpression init;
 940         /** symbol */
 941         public VarSymbol sym;
 942         /** explicit start pos */
 943         public int startPos = Position.NOPOS;
 944         /** accessors */
 945         public List<Pair<Accessors.Kind, Name>> accessors;
 946 
 947         protected JCVariableDecl(JCModifiers mods,
 948                          Name name,
 949                          JCExpression vartype,
 950                          JCExpression init,
 951                          VarSymbol sym,
 952                          List<Pair<Accessors.Kind, Name>> accessors) {
 953             this.mods = mods;
 954             this.name = name;
 955             this.vartype = vartype;
 956             this.init = init;
 957             this.sym = sym;
 958             this.accessors = accessors;
 959         }
 960 
 961         protected JCVariableDecl(JCModifiers mods,
 962                          JCExpression nameexpr,
 963                          JCExpression vartype) {
 964             this(mods, null, vartype, null, null, null);
 965             this.nameexpr = nameexpr;
 966             if (nameexpr.hasTag(Tag.IDENT)) {
 967                 this.name = ((JCIdent)nameexpr).name;
 968             } else {
 969                 // Only other option is qualified name x.y.this;
 970                 this.name = ((JCFieldAccess)nameexpr).name;
 971             }
 972         }
 973 
 974         public boolean isImplicitlyTyped() {
 975             return vartype == null;
 976         }
 977 
 978         @Override
 979         public void accept(Visitor v) { v.visitVarDef(this); }
 980 
 981         @DefinedBy(Api.COMPILER_TREE)
 982         public Kind getKind() { return Kind.VARIABLE; }
 983         @DefinedBy(Api.COMPILER_TREE)
 984         public JCModifiers getModifiers() { return mods; }


2141         public Kind getKind() { return Kind.TYPE_CAST; }
2142         @DefinedBy(Api.COMPILER_TREE)
2143         public JCTree getType() { return clazz; }
2144         @DefinedBy(Api.COMPILER_TREE)
2145         public JCExpression getExpression() { return expr; }
2146         @Override @DefinedBy(Api.COMPILER_TREE)
2147         public <R,D> R accept(TreeVisitor<R,D> v, D d) {
2148             return v.visitTypeCast(this, d);
2149         }
2150         @Override
2151         public Tag getTag() {
2152             return TYPECAST;
2153         }
2154     }
2155 
2156     /**
2157      * A type test.
2158      */
2159     public static class JCInstanceOf extends JCExpression implements InstanceOfTree {
2160         public JCExpression expr;
2161         public JCTree pattern;
2162         protected JCInstanceOf(JCExpression expr, JCTree pattern) {
2163             this.expr = expr;
2164             this.pattern = pattern;
2165         }
2166         @Override
2167         public void accept(Visitor v) { v.visitTypeTest(this); }
2168 
2169         @DefinedBy(Api.COMPILER_TREE)
2170         public Kind getKind() { return Kind.INSTANCE_OF; }
2171         @DefinedBy(Api.COMPILER_TREE)
2172         public JCTree getType() { return pattern instanceof JCPattern ? pattern.hasTag(BINDINGPATTERN) ? ((JCBindingPattern) pattern).vartype : null : pattern; }
2173 
2174         @Override @DefinedBy(Api.COMPILER_TREE)
2175         public JCPattern getPattern() {
2176             return pattern instanceof JCPattern ? (JCPattern) pattern : null;
2177         }
2178 
2179         @DefinedBy(Api.COMPILER_TREE)
2180         public JCExpression getExpression() { return expr; }
2181         @Override @DefinedBy(Api.COMPILER_TREE)
2182         public <R,D> R accept(TreeVisitor<R,D> v, D d) {
2183             return v.visitInstanceOf(this, d);
2184         }
2185         @Override
2186         public Tag getTag() {
2187             return TYPETEST;
2188         }
2189     }
2190 
2191     /**
2192      * Pattern matching forms.
2193      */
2194     public static abstract class JCPattern extends JCTree
2195             implements PatternTree {
2196         public JCExpression constExpression() {
2197             return null;
2198         }
2199     }
2200 
2201     public static class JCBindingPattern extends JCPattern
2202             implements BindingPatternTree {
2203         public Name name;
2204         public BindingSymbol symbol;
2205         public JCTree vartype;
2206 
2207         protected JCBindingPattern(Name name, BindingSymbol symbol, JCTree vartype) {
2208             this.name = name;
2209             this.symbol = symbol;
2210             this.vartype = vartype;
2211         }
2212 
2213         @DefinedBy(Api.COMPILER_TREE)
2214         public Name getBinding() {
2215             return name;
2216         }
2217 
2218         @Override @DefinedBy(Api.COMPILER_TREE)
2219         public Tree getType() {
2220             return vartype;
2221         }
2222 
2223         @Override
2224         public void accept(Visitor v) {
2225             v.visitBindingPattern(this);
2226         }
2227 
2228         @DefinedBy(Api.COMPILER_TREE)
2229         public Kind getKind() {
2230             return Kind.BINDING_PATTERN;
2231         }
2232 
2233         @Override
2234         @DefinedBy(Api.COMPILER_TREE)
2235         public <R, D> R accept(TreeVisitor<R, D> v, D d) {
2236             return v.visitBindingPattern(this, d);
2237         }
2238 
2239         @Override
2240         public Tag getTag() {
2241             return BINDINGPATTERN;
2242         }
2243     }
2244 
2245     /**
2246      * An array selection
2247      */
2248     public static class JCArrayAccess extends JCExpression implements ArrayAccessTree {
2249         public JCExpression indexed;
2250         public JCExpression index;
2251         protected JCArrayAccess(JCExpression indexed, JCExpression index) {
2252             this.indexed = indexed;
2253             this.index = index;
2254         }
2255         @Override
2256         public void accept(Visitor v) { v.visitIndexed(this); }
2257 
2258         @DefinedBy(Api.COMPILER_TREE)
2259         public Kind getKind() { return Kind.ARRAY_ACCESS; }
2260         @DefinedBy(Api.COMPILER_TREE)
2261         public JCExpression getExpression() { return indexed; }
2262         @DefinedBy(Api.COMPILER_TREE)
2263         public JCExpression getIndex() { return index; }
2264         @Override @DefinedBy(Api.COMPILER_TREE)
2265         public <R,D> R accept(TreeVisitor<R,D> v, D d) {


3199         JCThrow Throw(JCExpression expr);
3200         JCAssert Assert(JCExpression cond, JCExpression detail);
3201         JCMethodInvocation Apply(List<JCExpression> typeargs,
3202                     JCExpression fn,
3203                     List<JCExpression> args);
3204         JCNewClass NewClass(JCExpression encl,
3205                           List<JCExpression> typeargs,
3206                           JCExpression clazz,
3207                           List<JCExpression> args,
3208                           JCClassDecl def);
3209         JCNewArray NewArray(JCExpression elemtype,
3210                           List<JCExpression> dims,
3211                           List<JCExpression> elems);
3212         JCParens Parens(JCExpression expr);
3213         JCAssign Assign(JCExpression lhs, JCExpression rhs);
3214         JCAssignOp Assignop(Tag opcode, JCTree lhs, JCTree rhs);
3215         JCUnary Unary(Tag opcode, JCExpression arg);
3216         JCBinary Binary(Tag opcode, JCExpression lhs, JCExpression rhs);
3217         JCTypeCast TypeCast(JCTree expr, JCExpression type);
3218         JCInstanceOf TypeTest(JCExpression expr, JCTree clazz);
3219         JCBindingPattern BindingPattern(Name name, JCTree vartype);
3220         JCArrayAccess Indexed(JCExpression indexed, JCExpression index);
3221         JCFieldAccess Select(JCExpression selected, Name selector);
3222         JCIdent Ident(Name idname);
3223         JCLiteral Literal(TypeTag tag, Object value);
3224         JCPrimitiveTypeTree TypeIdent(TypeTag typetag);
3225         JCArrayTypeTree TypeArray(JCExpression elemtype);
3226         JCTypeApply TypeApply(JCExpression clazz, List<JCExpression> arguments);
3227         JCTypeParameter TypeParameter(Name name, List<JCExpression> bounds);
3228         JCWildcard Wildcard(TypeBoundKind kind, JCTree type);
3229         TypeBoundKind TypeBoundKind(BoundKind kind);
3230         JCAnnotation Annotation(JCTree annotationType, List<JCExpression> args);
3231         JCModifiers Modifiers(long flags, List<JCAnnotation> annotations);
3232         JCErroneous Erroneous(List<? extends JCTree> errs);
3233         JCModuleDecl ModuleDef(JCModifiers mods, ModuleKind kind, JCExpression qualId, List<JCDirective> directives);
3234         JCExports Exports(JCExpression qualId, List<JCExpression> moduleNames);
3235         JCOpens Opens(JCExpression qualId, List<JCExpression> moduleNames);
3236         JCProvides Provides(JCExpression serviceName, List<JCExpression> implNames);
3237         JCRequires Requires(boolean isTransitive, boolean isStaticPhase, JCExpression qualId);
3238         JCUses Uses(JCExpression qualId);
3239         LetExpr LetExpr(List<JCStatement> defs, JCExpression expr);


3264         public void visitConditional(JCConditional that)     { visitTree(that); }
3265         public void visitIf(JCIf that)                       { visitTree(that); }
3266         public void visitExec(JCExpressionStatement that)    { visitTree(that); }
3267         public void visitBreak(JCBreak that)                 { visitTree(that); }
3268         public void visitYield(JCYield that)                 { visitTree(that); }
3269         public void visitContinue(JCContinue that)           { visitTree(that); }
3270         public void visitReturn(JCReturn that)               { visitTree(that); }
3271         public void visitThrow(JCThrow that)                 { visitTree(that); }
3272         public void visitAssert(JCAssert that)               { visitTree(that); }
3273         public void visitApply(JCMethodInvocation that)      { visitTree(that); }
3274         public void visitNewClass(JCNewClass that)           { visitTree(that); }
3275         public void visitNewArray(JCNewArray that)           { visitTree(that); }
3276         public void visitLambda(JCLambda that)               { visitTree(that); }
3277         public void visitParens(JCParens that)               { visitTree(that); }
3278         public void visitAssign(JCAssign that)               { visitTree(that); }
3279         public void visitAssignop(JCAssignOp that)           { visitTree(that); }
3280         public void visitUnary(JCUnary that)                 { visitTree(that); }
3281         public void visitBinary(JCBinary that)               { visitTree(that); }
3282         public void visitTypeCast(JCTypeCast that)           { visitTree(that); }
3283         public void visitTypeTest(JCInstanceOf that)         { visitTree(that); }
3284         public void visitBindingPattern(JCBindingPattern that) { visitTree(that); }
3285         public void visitIndexed(JCArrayAccess that)         { visitTree(that); }
3286         public void visitSelect(JCFieldAccess that)          { visitTree(that); }
3287         public void visitReference(JCMemberReference that)   { visitTree(that); }
3288         public void visitIdent(JCIdent that)                 { visitTree(that); }
3289         public void visitLiteral(JCLiteral that)             { visitTree(that); }
3290         public void visitTypeIdent(JCPrimitiveTypeTree that) { visitTree(that); }
3291         public void visitTypeArray(JCArrayTypeTree that)     { visitTree(that); }
3292         public void visitTypeApply(JCTypeApply that)         { visitTree(that); }
3293         public void visitTypeUnion(JCTypeUnion that)         { visitTree(that); }
3294         public void visitTypeIntersection(JCTypeIntersection that)  { visitTree(that); }
3295         public void visitTypeParameter(JCTypeParameter that) { visitTree(that); }
3296         public void visitWildcard(JCWildcard that)           { visitTree(that); }
3297         public void visitTypeBoundKind(TypeBoundKind that)   { visitTree(that); }
3298         public void visitAnnotation(JCAnnotation that)       { visitTree(that); }
3299         public void visitModifiers(JCModifiers that)         { visitTree(that); }
3300         public void visitAnnotatedType(JCAnnotatedType that) { visitTree(that); }
3301         public void visitErroneous(JCErroneous that)         { visitTree(that); }
3302         public void visitModuleDef(JCModuleDecl that)        { visitTree(that); }
3303         public void visitExports(JCExports that)             { visitTree(that); }
3304         public void visitOpens(JCOpens that)                 { visitTree(that); }
< prev index next >