Mon, 06 Sep 2010 12:55:09 -0700
6930507: Symbols for anonymous and local classes made too late for use by java tree API
Reviewed-by: mcimadamore
1 /*
2 * Copyright (c) 1999, 2009, Oracle and/or its affiliates. All rights reserved.
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4 *
5 * This code is free software; you can redistribute it and/or modify it
6 * under the terms of the GNU General Public License version 2 only, as
7 * published by the Free Software Foundation. Oracle designates this
8 * particular file as subject to the "Classpath" exception as provided
9 * by Oracle in the LICENSE file that accompanied this code.
10 *
11 * This code is distributed in the hope that it will be useful, but WITHOUT
12 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
13 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
14 * version 2 for more details (a copy is included in the LICENSE file that
15 * accompanied this code).
16 *
17 * You should have received a copy of the GNU General Public License version
18 * 2 along with this work; if not, write to the Free Software Foundation,
19 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
20 *
21 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
22 * or visit www.oracle.com if you need additional information or have any
23 * questions.
24 */
26 package com.sun.tools.javac.tree;
28 import java.util.*;
30 import java.io.IOException;
31 import java.io.StringWriter;
32 import javax.lang.model.element.Modifier;
33 import javax.lang.model.type.TypeKind;
34 import javax.tools.JavaFileObject;
36 import com.sun.tools.javac.util.*;
37 import com.sun.tools.javac.util.JCDiagnostic.DiagnosticPosition;
38 import com.sun.tools.javac.util.List;
39 import com.sun.tools.javac.code.*;
40 import com.sun.tools.javac.code.Scope;
41 import com.sun.tools.javac.code.Symbol.*;
42 import com.sun.source.tree.*;
44 import static com.sun.tools.javac.code.BoundKind.*;
46 /**
47 * Root class for abstract syntax tree nodes. It provides definitions
48 * for specific tree nodes as subclasses nested inside.
49 *
50 * <p>Each subclass is highly standardized. It generally contains
51 * only tree fields for the syntactic subcomponents of the node. Some
52 * classes that represent identifier uses or definitions also define a
53 * Symbol field that denotes the represented identifier. Classes for
54 * non-local jumps also carry the jump target as a field. The root
55 * class Tree itself defines fields for the tree's type and position.
56 * No other fields are kept in a tree node; instead parameters are
57 * passed to methods accessing the node.
58 *
59 * <p>Except for the methods defined by com.sun.source, the only
60 * method defined in subclasses is `visit' which applies a given
61 * visitor to the tree. The actual tree processing is done by visitor
62 * classes in other packages. The abstract class Visitor, as well as
63 * an Factory interface for trees, are defined as inner classes in
64 * Tree.
65 *
66 * <p>To avoid ambiguities with the Tree API in com.sun.source all sub
67 * classes should, by convention, start with JC (javac).
68 *
69 * <p><b>This is NOT part of any supported API.
70 * If you write code that depends on this, you do so at your own risk.
71 * This code and its internal interfaces are subject to change or
72 * deletion without notice.</b>
73 *
74 * @see TreeMaker
75 * @see TreeInfo
76 * @see TreeTranslator
77 * @see Pretty
78 */
79 public abstract class JCTree implements Tree, Cloneable, DiagnosticPosition {
81 /* Tree tag values, identifying kinds of trees */
83 /** Toplevel nodes, of type TopLevel, representing entire source files.
84 */
85 public static final int TOPLEVEL = 1;
87 /** Import clauses, of type Import.
88 */
89 public static final int IMPORT = TOPLEVEL + 1;
91 /** Class definitions, of type ClassDef.
92 */
93 public static final int CLASSDEF = IMPORT + 1;
95 /** Method definitions, of type MethodDef.
96 */
97 public static final int METHODDEF = CLASSDEF + 1;
99 /** Variable definitions, of type VarDef.
100 */
101 public static final int VARDEF = METHODDEF + 1;
103 /** The no-op statement ";", of type Skip
104 */
105 public static final int SKIP = VARDEF + 1;
107 /** Blocks, of type Block.
108 */
109 public static final int BLOCK = SKIP + 1;
111 /** Do-while loops, of type DoLoop.
112 */
113 public static final int DOLOOP = BLOCK + 1;
115 /** While-loops, of type WhileLoop.
116 */
117 public static final int WHILELOOP = DOLOOP + 1;
119 /** For-loops, of type ForLoop.
120 */
121 public static final int FORLOOP = WHILELOOP + 1;
123 /** Foreach-loops, of type ForeachLoop.
124 */
125 public static final int FOREACHLOOP = FORLOOP + 1;
127 /** Labelled statements, of type Labelled.
128 */
129 public static final int LABELLED = FOREACHLOOP + 1;
131 /** Switch statements, of type Switch.
132 */
133 public static final int SWITCH = LABELLED + 1;
135 /** Case parts in switch statements, of type Case.
136 */
137 public static final int CASE = SWITCH + 1;
139 /** Synchronized statements, of type Synchonized.
140 */
141 public static final int SYNCHRONIZED = CASE + 1;
143 /** Try statements, of type Try.
144 */
145 public static final int TRY = SYNCHRONIZED + 1;
147 /** Catch clauses in try statements, of type Catch.
148 */
149 public static final int CATCH = TRY + 1;
151 /** Conditional expressions, of type Conditional.
152 */
153 public static final int CONDEXPR = CATCH + 1;
155 /** Conditional statements, of type If.
156 */
157 public static final int IF = CONDEXPR + 1;
159 /** Expression statements, of type Exec.
160 */
161 public static final int EXEC = IF + 1;
163 /** Break statements, of type Break.
164 */
165 public static final int BREAK = EXEC + 1;
167 /** Continue statements, of type Continue.
168 */
169 public static final int CONTINUE = BREAK + 1;
171 /** Return statements, of type Return.
172 */
173 public static final int RETURN = CONTINUE + 1;
175 /** Throw statements, of type Throw.
176 */
177 public static final int THROW = RETURN + 1;
179 /** Assert statements, of type Assert.
180 */
181 public static final int ASSERT = THROW + 1;
183 /** Method invocation expressions, of type Apply.
184 */
185 public static final int APPLY = ASSERT + 1;
187 /** Class instance creation expressions, of type NewClass.
188 */
189 public static final int NEWCLASS = APPLY + 1;
191 /** Array creation expressions, of type NewArray.
192 */
193 public static final int NEWARRAY = NEWCLASS + 1;
195 /** Parenthesized subexpressions, of type Parens.
196 */
197 public static final int PARENS = NEWARRAY + 1;
199 /** Assignment expressions, of type Assign.
200 */
201 public static final int ASSIGN = PARENS + 1;
203 /** Type cast expressions, of type TypeCast.
204 */
205 public static final int TYPECAST = ASSIGN + 1;
207 /** Type test expressions, of type TypeTest.
208 */
209 public static final int TYPETEST = TYPECAST + 1;
211 /** Indexed array expressions, of type Indexed.
212 */
213 public static final int INDEXED = TYPETEST + 1;
215 /** Selections, of type Select.
216 */
217 public static final int SELECT = INDEXED + 1;
219 /** Simple identifiers, of type Ident.
220 */
221 public static final int IDENT = SELECT + 1;
223 /** Literals, of type Literal.
224 */
225 public static final int LITERAL = IDENT + 1;
227 /** Basic type identifiers, of type TypeIdent.
228 */
229 public static final int TYPEIDENT = LITERAL + 1;
231 /** Array types, of type TypeArray.
232 */
233 public static final int TYPEARRAY = TYPEIDENT + 1;
235 /** Parameterized types, of type TypeApply.
236 */
237 public static final int TYPEAPPLY = TYPEARRAY + 1;
239 /** Disjunctive types, of type TypeDisjoint.
240 */
241 public static final int TYPEDISJOINT = TYPEAPPLY + 1;
243 /** Formal type parameters, of type TypeParameter.
244 */
245 public static final int TYPEPARAMETER = TYPEDISJOINT + 1;
247 /** Type argument.
248 */
249 public static final int WILDCARD = TYPEPARAMETER + 1;
251 /** Bound kind: extends, super, exact, or unbound
252 */
253 public static final int TYPEBOUNDKIND = WILDCARD + 1;
255 /** metadata: Annotation.
256 */
257 public static final int ANNOTATION = TYPEBOUNDKIND + 1;
259 /** metadata: Modifiers
260 */
261 public static final int MODIFIERS = ANNOTATION + 1;
263 public static final int ANNOTATED_TYPE = MODIFIERS + 1;
265 /** Error trees, of type Erroneous.
266 */
267 public static final int ERRONEOUS = ANNOTATED_TYPE + 1;
269 /** Unary operators, of type Unary.
270 */
271 public static final int POS = ERRONEOUS + 1; // +
272 public static final int NEG = POS + 1; // -
273 public static final int NOT = NEG + 1; // !
274 public static final int COMPL = NOT + 1; // ~
275 public static final int PREINC = COMPL + 1; // ++ _
276 public static final int PREDEC = PREINC + 1; // -- _
277 public static final int POSTINC = PREDEC + 1; // _ ++
278 public static final int POSTDEC = POSTINC + 1; // _ --
280 /** unary operator for null reference checks, only used internally.
281 */
282 public static final int NULLCHK = POSTDEC + 1;
284 /** Binary operators, of type Binary.
285 */
286 public static final int OR = NULLCHK + 1; // ||
287 public static final int AND = OR + 1; // &&
288 public static final int BITOR = AND + 1; // |
289 public static final int BITXOR = BITOR + 1; // ^
290 public static final int BITAND = BITXOR + 1; // &
291 public static final int EQ = BITAND + 1; // ==
292 public static final int NE = EQ + 1; // !=
293 public static final int LT = NE + 1; // <
294 public static final int GT = LT + 1; // >
295 public static final int LE = GT + 1; // <=
296 public static final int GE = LE + 1; // >=
297 public static final int SL = GE + 1; // <<
298 public static final int SR = SL + 1; // >>
299 public static final int USR = SR + 1; // >>>
300 public static final int PLUS = USR + 1; // +
301 public static final int MINUS = PLUS + 1; // -
302 public static final int MUL = MINUS + 1; // *
303 public static final int DIV = MUL + 1; // /
304 public static final int MOD = DIV + 1; // %
306 /** Assignment operators, of type Assignop.
307 */
308 public static final int BITOR_ASG = MOD + 1; // |=
309 public static final int BITXOR_ASG = BITOR_ASG + 1; // ^=
310 public static final int BITAND_ASG = BITXOR_ASG + 1; // &=
312 public static final int SL_ASG = SL + BITOR_ASG - BITOR; // <<=
313 public static final int SR_ASG = SL_ASG + 1; // >>=
314 public static final int USR_ASG = SR_ASG + 1; // >>>=
315 public static final int PLUS_ASG = USR_ASG + 1; // +=
316 public static final int MINUS_ASG = PLUS_ASG + 1; // -=
317 public static final int MUL_ASG = MINUS_ASG + 1; // *=
318 public static final int DIV_ASG = MUL_ASG + 1; // /=
319 public static final int MOD_ASG = DIV_ASG + 1; // %=
321 /** A synthetic let expression, of type LetExpr.
322 */
323 public static final int LETEXPR = MOD_ASG + 1; // ala scheme
326 /** The offset between assignment operators and normal operators.
327 */
328 public static final int ASGOffset = BITOR_ASG - BITOR;
330 /* The (encoded) position in the source file. @see util.Position.
331 */
332 public int pos;
334 /* The type of this node.
335 */
336 public Type type;
338 /* The tag of this node -- one of the constants declared above.
339 */
340 public abstract int getTag();
342 /** Convert a tree to a pretty-printed string. */
343 @Override
344 public String toString() {
345 StringWriter s = new StringWriter();
346 try {
347 new Pretty(s, false).printExpr(this);
348 }
349 catch (IOException e) {
350 // should never happen, because StringWriter is defined
351 // never to throw any IOExceptions
352 throw new AssertionError(e);
353 }
354 return s.toString();
355 }
357 /** Set position field and return this tree.
358 */
359 public JCTree setPos(int pos) {
360 this.pos = pos;
361 return this;
362 }
364 /** Set type field and return this tree.
365 */
366 public JCTree setType(Type type) {
367 this.type = type;
368 return this;
369 }
371 /** Visit this tree with a given visitor.
372 */
373 public abstract void accept(Visitor v);
375 public abstract <R,D> R accept(TreeVisitor<R,D> v, D d);
377 /** Return a shallow copy of this tree.
378 */
379 @Override
380 public Object clone() {
381 try {
382 return super.clone();
383 } catch(CloneNotSupportedException e) {
384 throw new RuntimeException(e);
385 }
386 }
388 /** Get a default position for this tree node.
389 */
390 public DiagnosticPosition pos() {
391 return this;
392 }
394 // for default DiagnosticPosition
395 public JCTree getTree() {
396 return this;
397 }
399 // for default DiagnosticPosition
400 public int getStartPosition() {
401 return TreeInfo.getStartPos(this);
402 }
404 // for default DiagnosticPosition
405 public int getPreferredPosition() {
406 return pos;
407 }
409 // for default DiagnosticPosition
410 public int getEndPosition(Map<JCTree, Integer> endPosTable) {
411 return TreeInfo.getEndPos(this, endPosTable);
412 }
414 /**
415 * Everything in one source file is kept in a TopLevel structure.
416 * @param pid The tree representing the package clause.
417 * @param sourcefile The source file name.
418 * @param defs All definitions in this file (ClassDef, Import, and Skip)
419 * @param packge The package it belongs to.
420 * @param namedImportScope A scope for all named imports.
421 * @param starImportScope A scope for all import-on-demands.
422 * @param lineMap Line starting positions, defined only
423 * if option -g is set.
424 * @param docComments A hashtable that stores all documentation comments
425 * indexed by the tree nodes they refer to.
426 * defined only if option -s is set.
427 * @param endPositions A hashtable that stores ending positions of source
428 * ranges indexed by the tree nodes they belong to.
429 * Defined only if option -Xjcov is set.
430 */
431 public static class JCCompilationUnit extends JCTree implements CompilationUnitTree {
432 public List<JCAnnotation> packageAnnotations;
433 public JCExpression pid;
434 public List<JCTree> defs;
435 public JavaFileObject sourcefile;
436 public PackageSymbol packge;
437 public Scope namedImportScope;
438 public Scope starImportScope;
439 public long flags;
440 public Position.LineMap lineMap = null;
441 public Map<JCTree, String> docComments = null;
442 public Map<JCTree, Integer> endPositions = null;
443 protected JCCompilationUnit(List<JCAnnotation> packageAnnotations,
444 JCExpression pid,
445 List<JCTree> defs,
446 JavaFileObject sourcefile,
447 PackageSymbol packge,
448 Scope namedImportScope,
449 Scope starImportScope) {
450 this.packageAnnotations = packageAnnotations;
451 this.pid = pid;
452 this.defs = defs;
453 this.sourcefile = sourcefile;
454 this.packge = packge;
455 this.namedImportScope = namedImportScope;
456 this.starImportScope = starImportScope;
457 }
458 @Override
459 public void accept(Visitor v) { v.visitTopLevel(this); }
461 public Kind getKind() { return Kind.COMPILATION_UNIT; }
462 public List<JCAnnotation> getPackageAnnotations() {
463 return packageAnnotations;
464 }
465 public List<JCImport> getImports() {
466 ListBuffer<JCImport> imports = new ListBuffer<JCImport>();
467 for (JCTree tree : defs) {
468 if (tree.getTag() == IMPORT)
469 imports.append((JCImport)tree);
470 else
471 break;
472 }
473 return imports.toList();
474 }
475 public JCExpression getPackageName() { return pid; }
476 public JavaFileObject getSourceFile() {
477 return sourcefile;
478 }
479 public Position.LineMap getLineMap() {
480 return lineMap;
481 }
482 public List<JCTree> getTypeDecls() {
483 List<JCTree> typeDefs;
484 for (typeDefs = defs; !typeDefs.isEmpty(); typeDefs = typeDefs.tail)
485 if (typeDefs.head.getTag() != IMPORT)
486 break;
487 return typeDefs;
488 }
489 @Override
490 public <R,D> R accept(TreeVisitor<R,D> v, D d) {
491 return v.visitCompilationUnit(this, d);
492 }
494 @Override
495 public int getTag() {
496 return TOPLEVEL;
497 }
498 }
500 /**
501 * An import clause.
502 * @param qualid The imported class(es).
503 */
504 public static class JCImport extends JCTree implements ImportTree {
505 public boolean staticImport;
506 public JCTree qualid;
507 protected JCImport(JCTree qualid, boolean importStatic) {
508 this.qualid = qualid;
509 this.staticImport = importStatic;
510 }
511 @Override
512 public void accept(Visitor v) { v.visitImport(this); }
514 public boolean isStatic() { return staticImport; }
515 public JCTree getQualifiedIdentifier() { return qualid; }
517 public Kind getKind() { return Kind.IMPORT; }
518 @Override
519 public <R,D> R accept(TreeVisitor<R,D> v, D d) {
520 return v.visitImport(this, d);
521 }
523 @Override
524 public int getTag() {
525 return IMPORT;
526 }
527 }
529 public static abstract class JCStatement extends JCTree implements StatementTree {
530 @Override
531 public JCStatement setType(Type type) {
532 super.setType(type);
533 return this;
534 }
535 @Override
536 public JCStatement setPos(int pos) {
537 super.setPos(pos);
538 return this;
539 }
540 }
542 public static abstract class JCExpression extends JCTree implements ExpressionTree {
543 @Override
544 public JCExpression setType(Type type) {
545 super.setType(type);
546 return this;
547 }
548 @Override
549 public JCExpression setPos(int pos) {
550 super.setPos(pos);
551 return this;
552 }
553 }
555 /**
556 * A class definition.
557 * @param modifiers the modifiers
558 * @param name the name of the class
559 * @param typarams formal class parameters
560 * @param extending the classes this class extends
561 * @param implementing the interfaces implemented by this class
562 * @param defs all variables and methods defined in this class
563 * @param sym the symbol
564 */
565 public static class JCClassDecl extends JCStatement implements ClassTree {
566 public JCModifiers mods;
567 public Name name;
568 public List<JCTypeParameter> typarams;
569 public JCTree extending;
570 public List<JCExpression> implementing;
571 public List<JCTree> defs;
572 public ClassSymbol sym;
573 protected JCClassDecl(JCModifiers mods,
574 Name name,
575 List<JCTypeParameter> typarams,
576 JCTree extending,
577 List<JCExpression> implementing,
578 List<JCTree> defs,
579 ClassSymbol sym)
580 {
581 this.mods = mods;
582 this.name = name;
583 this.typarams = typarams;
584 this.extending = extending;
585 this.implementing = implementing;
586 this.defs = defs;
587 this.sym = sym;
588 }
589 @Override
590 public void accept(Visitor v) { v.visitClassDef(this); }
592 public Kind getKind() {
593 if ((mods.flags & Flags.ANNOTATION) != 0)
594 return Kind.ANNOTATION_TYPE;
595 else if ((mods.flags & Flags.INTERFACE) != 0)
596 return Kind.INTERFACE;
597 else if ((mods.flags & Flags.ENUM) != 0)
598 return Kind.ENUM;
599 else
600 return Kind.CLASS;
601 }
603 public JCModifiers getModifiers() { return mods; }
604 public Name getSimpleName() { return name; }
605 public List<JCTypeParameter> getTypeParameters() {
606 return typarams;
607 }
608 public JCTree getExtendsClause() { return extending; }
609 public List<JCExpression> getImplementsClause() {
610 return implementing;
611 }
612 public List<JCTree> getMembers() {
613 return defs;
614 }
615 @Override
616 public <R,D> R accept(TreeVisitor<R,D> v, D d) {
617 return v.visitClass(this, d);
618 }
620 @Override
621 public int getTag() {
622 return CLASSDEF;
623 }
624 }
626 /**
627 * A method definition.
628 * @param modifiers method modifiers
629 * @param name method name
630 * @param restype type of method return value
631 * @param typarams type parameters
632 * @param params value parameters
633 * @param thrown exceptions thrown by this method
634 * @param stats statements in the method
635 * @param sym method symbol
636 */
637 public static class JCMethodDecl extends JCTree implements MethodTree {
638 public JCModifiers mods;
639 public Name name;
640 public JCExpression restype;
641 public List<JCTypeParameter> typarams;
642 public List<JCVariableDecl> params;
643 public List<JCTypeAnnotation> receiverAnnotations;
644 public List<JCExpression> thrown;
645 public JCBlock body;
646 public JCExpression defaultValue; // for annotation types
647 public MethodSymbol sym;
648 protected JCMethodDecl(JCModifiers mods,
649 Name name,
650 JCExpression restype,
651 List<JCTypeParameter> typarams,
652 List<JCVariableDecl> params,
653 List<JCTypeAnnotation> receiver,
654 List<JCExpression> thrown,
655 JCBlock body,
656 JCExpression defaultValue,
657 MethodSymbol sym)
658 {
659 this.mods = mods;
660 this.name = name;
661 this.restype = restype;
662 this.typarams = typarams;
663 this.params = params;
664 this.receiverAnnotations = (receiver != null ? receiver : List.<JCTypeAnnotation>nil());
665 this.thrown = thrown;
666 this.body = body;
667 this.defaultValue = defaultValue;
668 this.sym = sym;
669 }
670 @Override
671 public void accept(Visitor v) { v.visitMethodDef(this); }
673 public Kind getKind() { return Kind.METHOD; }
674 public JCModifiers getModifiers() { return mods; }
675 public Name getName() { return name; }
676 public JCTree getReturnType() { return restype; }
677 public List<JCTypeParameter> getTypeParameters() {
678 return typarams;
679 }
680 public List<JCVariableDecl> getParameters() {
681 return params;
682 }
683 public List<JCTypeAnnotation> getReceiverAnnotations() { return receiverAnnotations; }
684 public List<JCExpression> getThrows() {
685 return thrown;
686 }
687 public JCBlock getBody() { return body; }
688 public JCTree getDefaultValue() { // for annotation types
689 return defaultValue;
690 }
691 @Override
692 public <R,D> R accept(TreeVisitor<R,D> v, D d) {
693 return v.visitMethod(this, d);
694 }
696 @Override
697 public int getTag() {
698 return METHODDEF;
699 }
700 }
702 /**
703 * A variable definition.
704 * @param modifiers variable modifiers
705 * @param name variable name
706 * @param vartype type of the variable
707 * @param init variables initial value
708 * @param sym symbol
709 */
710 public static class JCVariableDecl extends JCStatement implements VariableTree {
711 public JCModifiers mods;
712 public Name name;
713 public JCExpression vartype;
714 public JCExpression init;
715 public VarSymbol sym;
716 protected JCVariableDecl(JCModifiers mods,
717 Name name,
718 JCExpression vartype,
719 JCExpression init,
720 VarSymbol sym) {
721 this.mods = mods;
722 this.name = name;
723 this.vartype = vartype;
724 this.init = init;
725 this.sym = sym;
726 }
727 @Override
728 public void accept(Visitor v) { v.visitVarDef(this); }
730 public Kind getKind() { return Kind.VARIABLE; }
731 public JCModifiers getModifiers() { return mods; }
732 public Name getName() { return name; }
733 public JCTree getType() { return vartype; }
734 public JCExpression getInitializer() {
735 return init;
736 }
737 @Override
738 public <R,D> R accept(TreeVisitor<R,D> v, D d) {
739 return v.visitVariable(this, d);
740 }
742 @Override
743 public int getTag() {
744 return VARDEF;
745 }
746 }
748 /**
749 * A no-op statement ";".
750 */
751 public static class JCSkip extends JCStatement implements EmptyStatementTree {
752 protected JCSkip() {
753 }
754 @Override
755 public void accept(Visitor v) { v.visitSkip(this); }
757 public Kind getKind() { return Kind.EMPTY_STATEMENT; }
758 @Override
759 public <R,D> R accept(TreeVisitor<R,D> v, D d) {
760 return v.visitEmptyStatement(this, d);
761 }
763 @Override
764 public int getTag() {
765 return SKIP;
766 }
767 }
769 /**
770 * A statement block.
771 * @param stats statements
772 * @param flags flags
773 */
774 public static class JCBlock extends JCStatement implements BlockTree {
775 public long flags;
776 public List<JCStatement> stats;
777 /** Position of closing brace, optional. */
778 public int endpos = Position.NOPOS;
779 protected JCBlock(long flags, List<JCStatement> stats) {
780 this.stats = stats;
781 this.flags = flags;
782 }
783 @Override
784 public void accept(Visitor v) { v.visitBlock(this); }
786 public Kind getKind() { return Kind.BLOCK; }
787 public List<JCStatement> getStatements() {
788 return stats;
789 }
790 public boolean isStatic() { return (flags & Flags.STATIC) != 0; }
791 @Override
792 public <R,D> R accept(TreeVisitor<R,D> v, D d) {
793 return v.visitBlock(this, d);
794 }
796 @Override
797 public int getTag() {
798 return BLOCK;
799 }
800 }
802 /**
803 * A do loop
804 */
805 public static class JCDoWhileLoop extends JCStatement implements DoWhileLoopTree {
806 public JCStatement body;
807 public JCExpression cond;
808 protected JCDoWhileLoop(JCStatement body, JCExpression cond) {
809 this.body = body;
810 this.cond = cond;
811 }
812 @Override
813 public void accept(Visitor v) { v.visitDoLoop(this); }
815 public Kind getKind() { return Kind.DO_WHILE_LOOP; }
816 public JCExpression getCondition() { return cond; }
817 public JCStatement getStatement() { return body; }
818 @Override
819 public <R,D> R accept(TreeVisitor<R,D> v, D d) {
820 return v.visitDoWhileLoop(this, d);
821 }
823 @Override
824 public int getTag() {
825 return DOLOOP;
826 }
827 }
829 /**
830 * A while loop
831 */
832 public static class JCWhileLoop extends JCStatement implements WhileLoopTree {
833 public JCExpression cond;
834 public JCStatement body;
835 protected JCWhileLoop(JCExpression cond, JCStatement body) {
836 this.cond = cond;
837 this.body = body;
838 }
839 @Override
840 public void accept(Visitor v) { v.visitWhileLoop(this); }
842 public Kind getKind() { return Kind.WHILE_LOOP; }
843 public JCExpression getCondition() { return cond; }
844 public JCStatement getStatement() { return body; }
845 @Override
846 public <R,D> R accept(TreeVisitor<R,D> v, D d) {
847 return v.visitWhileLoop(this, d);
848 }
850 @Override
851 public int getTag() {
852 return WHILELOOP;
853 }
854 }
856 /**
857 * A for loop.
858 */
859 public static class JCForLoop extends JCStatement implements ForLoopTree {
860 public List<JCStatement> init;
861 public JCExpression cond;
862 public List<JCExpressionStatement> step;
863 public JCStatement body;
864 protected JCForLoop(List<JCStatement> init,
865 JCExpression cond,
866 List<JCExpressionStatement> update,
867 JCStatement body)
868 {
869 this.init = init;
870 this.cond = cond;
871 this.step = update;
872 this.body = body;
873 }
874 @Override
875 public void accept(Visitor v) { v.visitForLoop(this); }
877 public Kind getKind() { return Kind.FOR_LOOP; }
878 public JCExpression getCondition() { return cond; }
879 public JCStatement getStatement() { return body; }
880 public List<JCStatement> getInitializer() {
881 return init;
882 }
883 public List<JCExpressionStatement> getUpdate() {
884 return step;
885 }
886 @Override
887 public <R,D> R accept(TreeVisitor<R,D> v, D d) {
888 return v.visitForLoop(this, d);
889 }
891 @Override
892 public int getTag() {
893 return FORLOOP;
894 }
895 }
897 /**
898 * The enhanced for loop.
899 */
900 public static class JCEnhancedForLoop extends JCStatement implements EnhancedForLoopTree {
901 public JCVariableDecl var;
902 public JCExpression expr;
903 public JCStatement body;
904 protected JCEnhancedForLoop(JCVariableDecl var, JCExpression expr, JCStatement body) {
905 this.var = var;
906 this.expr = expr;
907 this.body = body;
908 }
909 @Override
910 public void accept(Visitor v) { v.visitForeachLoop(this); }
912 public Kind getKind() { return Kind.ENHANCED_FOR_LOOP; }
913 public JCVariableDecl getVariable() { return var; }
914 public JCExpression getExpression() { return expr; }
915 public JCStatement getStatement() { return body; }
916 @Override
917 public <R,D> R accept(TreeVisitor<R,D> v, D d) {
918 return v.visitEnhancedForLoop(this, d);
919 }
920 @Override
921 public int getTag() {
922 return FOREACHLOOP;
923 }
924 }
926 /**
927 * A labelled expression or statement.
928 */
929 public static class JCLabeledStatement extends JCStatement implements LabeledStatementTree {
930 public Name label;
931 public JCStatement body;
932 protected JCLabeledStatement(Name label, JCStatement body) {
933 this.label = label;
934 this.body = body;
935 }
936 @Override
937 public void accept(Visitor v) { v.visitLabelled(this); }
938 public Kind getKind() { return Kind.LABELED_STATEMENT; }
939 public Name getLabel() { return label; }
940 public JCStatement getStatement() { return body; }
941 @Override
942 public <R,D> R accept(TreeVisitor<R,D> v, D d) {
943 return v.visitLabeledStatement(this, d);
944 }
945 @Override
946 public int getTag() {
947 return LABELLED;
948 }
949 }
951 /**
952 * A "switch ( ) { }" construction.
953 */
954 public static class JCSwitch extends JCStatement implements SwitchTree {
955 public JCExpression selector;
956 public List<JCCase> cases;
957 protected JCSwitch(JCExpression selector, List<JCCase> cases) {
958 this.selector = selector;
959 this.cases = cases;
960 }
961 @Override
962 public void accept(Visitor v) { v.visitSwitch(this); }
964 public Kind getKind() { return Kind.SWITCH; }
965 public JCExpression getExpression() { return selector; }
966 public List<JCCase> getCases() { return cases; }
967 @Override
968 public <R,D> R accept(TreeVisitor<R,D> v, D d) {
969 return v.visitSwitch(this, d);
970 }
971 @Override
972 public int getTag() {
973 return SWITCH;
974 }
975 }
977 /**
978 * A "case :" of a switch.
979 */
980 public static class JCCase extends JCStatement implements CaseTree {
981 public JCExpression pat;
982 public List<JCStatement> stats;
983 protected JCCase(JCExpression pat, List<JCStatement> stats) {
984 this.pat = pat;
985 this.stats = stats;
986 }
987 @Override
988 public void accept(Visitor v) { v.visitCase(this); }
990 public Kind getKind() { return Kind.CASE; }
991 public JCExpression getExpression() { return pat; }
992 public List<JCStatement> getStatements() { return stats; }
993 @Override
994 public <R,D> R accept(TreeVisitor<R,D> v, D d) {
995 return v.visitCase(this, d);
996 }
997 @Override
998 public int getTag() {
999 return CASE;
1000 }
1001 }
1003 /**
1004 * A synchronized block.
1005 */
1006 public static class JCSynchronized extends JCStatement implements SynchronizedTree {
1007 public JCExpression lock;
1008 public JCBlock body;
1009 protected JCSynchronized(JCExpression lock, JCBlock body) {
1010 this.lock = lock;
1011 this.body = body;
1012 }
1013 @Override
1014 public void accept(Visitor v) { v.visitSynchronized(this); }
1016 public Kind getKind() { return Kind.SYNCHRONIZED; }
1017 public JCExpression getExpression() { return lock; }
1018 public JCBlock getBlock() { return body; }
1019 @Override
1020 public <R,D> R accept(TreeVisitor<R,D> v, D d) {
1021 return v.visitSynchronized(this, d);
1022 }
1023 @Override
1024 public int getTag() {
1025 return SYNCHRONIZED;
1026 }
1027 }
1029 /**
1030 * A "try { } catch ( ) { } finally { }" block.
1031 */
1032 public static class JCTry extends JCStatement implements TryTree {
1033 public JCBlock body;
1034 public List<JCCatch> catchers;
1035 public JCBlock finalizer;
1036 public List<JCTree> resources;
1037 protected JCTry(List<JCTree> resources,
1038 JCBlock body,
1039 List<JCCatch> catchers,
1040 JCBlock finalizer) {
1041 this.body = body;
1042 this.catchers = catchers;
1043 this.finalizer = finalizer;
1044 this.resources = resources;
1045 }
1046 @Override
1047 public void accept(Visitor v) { v.visitTry(this); }
1049 public Kind getKind() { return Kind.TRY; }
1050 public JCBlock getBlock() { return body; }
1051 public List<JCCatch> getCatches() {
1052 return catchers;
1053 }
1054 public JCBlock getFinallyBlock() { return finalizer; }
1055 @Override
1056 public <R,D> R accept(TreeVisitor<R,D> v, D d) {
1057 return v.visitTry(this, d);
1058 }
1059 @Override
1060 public List<? extends JCTree> getResources() {
1061 return resources;
1062 }
1063 @Override
1064 public int getTag() {
1065 return TRY;
1066 }
1067 }
1069 /**
1070 * A catch block.
1071 */
1072 public static class JCCatch extends JCTree implements CatchTree {
1073 public JCVariableDecl param;
1074 public JCBlock body;
1075 protected JCCatch(JCVariableDecl param, JCBlock body) {
1076 this.param = param;
1077 this.body = body;
1078 }
1079 @Override
1080 public void accept(Visitor v) { v.visitCatch(this); }
1082 public Kind getKind() { return Kind.CATCH; }
1083 public JCVariableDecl getParameter() { return param; }
1084 public JCBlock getBlock() { return body; }
1085 @Override
1086 public <R,D> R accept(TreeVisitor<R,D> v, D d) {
1087 return v.visitCatch(this, d);
1088 }
1089 @Override
1090 public int getTag() {
1091 return CATCH;
1092 }
1093 }
1095 /**
1096 * A ( ) ? ( ) : ( ) conditional expression
1097 */
1098 public static class JCConditional extends JCExpression implements ConditionalExpressionTree {
1099 public JCExpression cond;
1100 public JCExpression truepart;
1101 public JCExpression falsepart;
1102 protected JCConditional(JCExpression cond,
1103 JCExpression truepart,
1104 JCExpression falsepart)
1105 {
1106 this.cond = cond;
1107 this.truepart = truepart;
1108 this.falsepart = falsepart;
1109 }
1110 @Override
1111 public void accept(Visitor v) { v.visitConditional(this); }
1113 public Kind getKind() { return Kind.CONDITIONAL_EXPRESSION; }
1114 public JCExpression getCondition() { return cond; }
1115 public JCExpression getTrueExpression() { return truepart; }
1116 public JCExpression getFalseExpression() { return falsepart; }
1117 @Override
1118 public <R,D> R accept(TreeVisitor<R,D> v, D d) {
1119 return v.visitConditionalExpression(this, d);
1120 }
1121 @Override
1122 public int getTag() {
1123 return CONDEXPR;
1124 }
1125 }
1127 /**
1128 * An "if ( ) { } else { }" block
1129 */
1130 public static class JCIf extends JCStatement implements IfTree {
1131 public JCExpression cond;
1132 public JCStatement thenpart;
1133 public JCStatement elsepart;
1134 protected JCIf(JCExpression cond,
1135 JCStatement thenpart,
1136 JCStatement elsepart)
1137 {
1138 this.cond = cond;
1139 this.thenpart = thenpart;
1140 this.elsepart = elsepart;
1141 }
1142 @Override
1143 public void accept(Visitor v) { v.visitIf(this); }
1145 public Kind getKind() { return Kind.IF; }
1146 public JCExpression getCondition() { return cond; }
1147 public JCStatement getThenStatement() { return thenpart; }
1148 public JCStatement getElseStatement() { return elsepart; }
1149 @Override
1150 public <R,D> R accept(TreeVisitor<R,D> v, D d) {
1151 return v.visitIf(this, d);
1152 }
1153 @Override
1154 public int getTag() {
1155 return IF;
1156 }
1157 }
1159 /**
1160 * an expression statement
1161 * @param expr expression structure
1162 */
1163 public static class JCExpressionStatement extends JCStatement implements ExpressionStatementTree {
1164 public JCExpression expr;
1165 protected JCExpressionStatement(JCExpression expr)
1166 {
1167 this.expr = expr;
1168 }
1169 @Override
1170 public void accept(Visitor v) { v.visitExec(this); }
1172 public Kind getKind() { return Kind.EXPRESSION_STATEMENT; }
1173 public JCExpression getExpression() { return expr; }
1174 @Override
1175 public <R,D> R accept(TreeVisitor<R,D> v, D d) {
1176 return v.visitExpressionStatement(this, d);
1177 }
1178 @Override
1179 public int getTag() {
1180 return EXEC;
1181 }
1182 }
1184 /**
1185 * A break from a loop or switch.
1186 */
1187 public static class JCBreak extends JCStatement implements BreakTree {
1188 public Name label;
1189 public JCTree target;
1190 protected JCBreak(Name label, JCTree target) {
1191 this.label = label;
1192 this.target = target;
1193 }
1194 @Override
1195 public void accept(Visitor v) { v.visitBreak(this); }
1197 public Kind getKind() { return Kind.BREAK; }
1198 public Name getLabel() { return label; }
1199 @Override
1200 public <R,D> R accept(TreeVisitor<R,D> v, D d) {
1201 return v.visitBreak(this, d);
1202 }
1203 @Override
1204 public int getTag() {
1205 return BREAK;
1206 }
1207 }
1209 /**
1210 * A continue of a loop.
1211 */
1212 public static class JCContinue extends JCStatement implements ContinueTree {
1213 public Name label;
1214 public JCTree target;
1215 protected JCContinue(Name label, JCTree target) {
1216 this.label = label;
1217 this.target = target;
1218 }
1219 @Override
1220 public void accept(Visitor v) { v.visitContinue(this); }
1222 public Kind getKind() { return Kind.CONTINUE; }
1223 public Name getLabel() { return label; }
1224 @Override
1225 public <R,D> R accept(TreeVisitor<R,D> v, D d) {
1226 return v.visitContinue(this, d);
1227 }
1228 @Override
1229 public int getTag() {
1230 return CONTINUE;
1231 }
1232 }
1234 /**
1235 * A return statement.
1236 */
1237 public static class JCReturn extends JCStatement implements ReturnTree {
1238 public JCExpression expr;
1239 protected JCReturn(JCExpression expr) {
1240 this.expr = expr;
1241 }
1242 @Override
1243 public void accept(Visitor v) { v.visitReturn(this); }
1245 public Kind getKind() { return Kind.RETURN; }
1246 public JCExpression getExpression() { return expr; }
1247 @Override
1248 public <R,D> R accept(TreeVisitor<R,D> v, D d) {
1249 return v.visitReturn(this, d);
1250 }
1251 @Override
1252 public int getTag() {
1253 return RETURN;
1254 }
1255 }
1257 /**
1258 * A throw statement.
1259 */
1260 public static class JCThrow extends JCStatement implements ThrowTree {
1261 public JCExpression expr;
1262 protected JCThrow(JCTree expr) {
1263 this.expr = (JCExpression)expr;
1264 }
1265 @Override
1266 public void accept(Visitor v) { v.visitThrow(this); }
1268 public Kind getKind() { return Kind.THROW; }
1269 public JCExpression getExpression() { return expr; }
1270 @Override
1271 public <R,D> R accept(TreeVisitor<R,D> v, D d) {
1272 return v.visitThrow(this, d);
1273 }
1274 @Override
1275 public int getTag() {
1276 return THROW;
1277 }
1278 }
1280 /**
1281 * An assert statement.
1282 */
1283 public static class JCAssert extends JCStatement implements AssertTree {
1284 public JCExpression cond;
1285 public JCExpression detail;
1286 protected JCAssert(JCExpression cond, JCExpression detail) {
1287 this.cond = cond;
1288 this.detail = detail;
1289 }
1290 @Override
1291 public void accept(Visitor v) { v.visitAssert(this); }
1293 public Kind getKind() { return Kind.ASSERT; }
1294 public JCExpression getCondition() { return cond; }
1295 public JCExpression getDetail() { return detail; }
1296 @Override
1297 public <R,D> R accept(TreeVisitor<R,D> v, D d) {
1298 return v.visitAssert(this, d);
1299 }
1300 @Override
1301 public int getTag() {
1302 return ASSERT;
1303 }
1304 }
1306 /**
1307 * A method invocation
1308 */
1309 public static class JCMethodInvocation extends JCExpression implements MethodInvocationTree {
1310 public List<JCExpression> typeargs;
1311 public JCExpression meth;
1312 public List<JCExpression> args;
1313 public Type varargsElement;
1314 protected JCMethodInvocation(List<JCExpression> typeargs,
1315 JCExpression meth,
1316 List<JCExpression> args)
1317 {
1318 this.typeargs = (typeargs == null) ? List.<JCExpression>nil()
1319 : typeargs;
1320 this.meth = meth;
1321 this.args = args;
1322 }
1323 @Override
1324 public void accept(Visitor v) { v.visitApply(this); }
1326 public Kind getKind() { return Kind.METHOD_INVOCATION; }
1327 public List<JCExpression> getTypeArguments() {
1328 return typeargs;
1329 }
1330 public JCExpression getMethodSelect() { return meth; }
1331 public List<JCExpression> getArguments() {
1332 return args;
1333 }
1334 @Override
1335 public <R,D> R accept(TreeVisitor<R,D> v, D d) {
1336 return v.visitMethodInvocation(this, d);
1337 }
1338 @Override
1339 public JCMethodInvocation setType(Type type) {
1340 super.setType(type);
1341 return this;
1342 }
1343 @Override
1344 public int getTag() {
1345 return(APPLY);
1346 }
1347 }
1349 /**
1350 * A new(...) operation.
1351 */
1352 public static class JCNewClass extends JCExpression implements NewClassTree {
1353 public JCExpression encl;
1354 public List<JCExpression> typeargs;
1355 public JCExpression clazz;
1356 public List<JCExpression> args;
1357 public JCClassDecl def;
1358 public Symbol constructor;
1359 public Type varargsElement;
1360 public Type constructorType;
1361 protected JCNewClass(JCExpression encl,
1362 List<JCExpression> typeargs,
1363 JCExpression clazz,
1364 List<JCExpression> args,
1365 JCClassDecl def)
1366 {
1367 this.encl = encl;
1368 this.typeargs = (typeargs == null) ? List.<JCExpression>nil()
1369 : typeargs;
1370 this.clazz = clazz;
1371 this.args = args;
1372 this.def = def;
1373 }
1374 @Override
1375 public void accept(Visitor v) { v.visitNewClass(this); }
1377 public Kind getKind() { return Kind.NEW_CLASS; }
1378 public JCExpression getEnclosingExpression() { // expr.new C< ... > ( ... )
1379 return encl;
1380 }
1381 public List<JCExpression> getTypeArguments() {
1382 return typeargs;
1383 }
1384 public JCExpression getIdentifier() { return clazz; }
1385 public List<JCExpression> getArguments() {
1386 return args;
1387 }
1388 public JCClassDecl getClassBody() { return def; }
1389 @Override
1390 public <R,D> R accept(TreeVisitor<R,D> v, D d) {
1391 return v.visitNewClass(this, d);
1392 }
1393 @Override
1394 public int getTag() {
1395 return NEWCLASS;
1396 }
1397 }
1399 /**
1400 * A new[...] operation.
1401 */
1402 public static class JCNewArray extends JCExpression implements NewArrayTree {
1403 public JCExpression elemtype;
1404 public List<JCExpression> dims;
1405 public List<JCTypeAnnotation> annotations;
1406 public List<List<JCTypeAnnotation>> dimAnnotations;
1407 public List<JCExpression> elems;
1408 protected JCNewArray(JCExpression elemtype,
1409 List<JCExpression> dims,
1410 List<JCExpression> elems)
1411 {
1412 this.elemtype = elemtype;
1413 this.dims = dims;
1414 this.annotations = List.nil();
1415 this.dimAnnotations = List.nil();
1416 this.elems = elems;
1417 }
1418 @Override
1419 public void accept(Visitor v) { v.visitNewArray(this); }
1421 public Kind getKind() { return Kind.NEW_ARRAY; }
1422 public JCExpression getType() { return elemtype; }
1423 public List<JCExpression> getDimensions() {
1424 return dims;
1425 }
1426 public List<JCExpression> getInitializers() {
1427 return elems;
1428 }
1429 @Override
1430 public <R,D> R accept(TreeVisitor<R,D> v, D d) {
1431 return v.visitNewArray(this, d);
1432 }
1433 @Override
1434 public int getTag() {
1435 return NEWARRAY;
1436 }
1437 }
1439 /**
1440 * A parenthesized subexpression ( ... )
1441 */
1442 public static class JCParens extends JCExpression implements ParenthesizedTree {
1443 public JCExpression expr;
1444 protected JCParens(JCExpression expr) {
1445 this.expr = expr;
1446 }
1447 @Override
1448 public void accept(Visitor v) { v.visitParens(this); }
1450 public Kind getKind() { return Kind.PARENTHESIZED; }
1451 public JCExpression getExpression() { return expr; }
1452 @Override
1453 public <R,D> R accept(TreeVisitor<R,D> v, D d) {
1454 return v.visitParenthesized(this, d);
1455 }
1456 @Override
1457 public int getTag() {
1458 return PARENS;
1459 }
1460 }
1462 /**
1463 * A assignment with "=".
1464 */
1465 public static class JCAssign extends JCExpression implements AssignmentTree {
1466 public JCExpression lhs;
1467 public JCExpression rhs;
1468 protected JCAssign(JCExpression lhs, JCExpression rhs) {
1469 this.lhs = lhs;
1470 this.rhs = rhs;
1471 }
1472 @Override
1473 public void accept(Visitor v) { v.visitAssign(this); }
1475 public Kind getKind() { return Kind.ASSIGNMENT; }
1476 public JCExpression getVariable() { return lhs; }
1477 public JCExpression getExpression() { return rhs; }
1478 @Override
1479 public <R,D> R accept(TreeVisitor<R,D> v, D d) {
1480 return v.visitAssignment(this, d);
1481 }
1482 @Override
1483 public int getTag() {
1484 return ASSIGN;
1485 }
1486 }
1488 /**
1489 * An assignment with "+=", "|=" ...
1490 */
1491 public static class JCAssignOp extends JCExpression implements CompoundAssignmentTree {
1492 private int opcode;
1493 public JCExpression lhs;
1494 public JCExpression rhs;
1495 public Symbol operator;
1496 protected JCAssignOp(int opcode, JCTree lhs, JCTree rhs, Symbol operator) {
1497 this.opcode = opcode;
1498 this.lhs = (JCExpression)lhs;
1499 this.rhs = (JCExpression)rhs;
1500 this.operator = operator;
1501 }
1502 @Override
1503 public void accept(Visitor v) { v.visitAssignop(this); }
1505 public Kind getKind() { return TreeInfo.tagToKind(getTag()); }
1506 public JCExpression getVariable() { return lhs; }
1507 public JCExpression getExpression() { return rhs; }
1508 public Symbol getOperator() {
1509 return operator;
1510 }
1511 @Override
1512 public <R,D> R accept(TreeVisitor<R,D> v, D d) {
1513 return v.visitCompoundAssignment(this, d);
1514 }
1515 @Override
1516 public int getTag() {
1517 return opcode;
1518 }
1519 }
1521 /**
1522 * A unary operation.
1523 */
1524 public static class JCUnary extends JCExpression implements UnaryTree {
1525 private int opcode;
1526 public JCExpression arg;
1527 public Symbol operator;
1528 protected JCUnary(int opcode, JCExpression arg) {
1529 this.opcode = opcode;
1530 this.arg = arg;
1531 }
1532 @Override
1533 public void accept(Visitor v) { v.visitUnary(this); }
1535 public Kind getKind() { return TreeInfo.tagToKind(getTag()); }
1536 public JCExpression getExpression() { return arg; }
1537 public Symbol getOperator() {
1538 return operator;
1539 }
1540 @Override
1541 public <R,D> R accept(TreeVisitor<R,D> v, D d) {
1542 return v.visitUnary(this, d);
1543 }
1544 @Override
1545 public int getTag() {
1546 return opcode;
1547 }
1549 public void setTag(int tag) {
1550 opcode = tag;
1551 }
1552 }
1554 /**
1555 * A binary operation.
1556 */
1557 public static class JCBinary extends JCExpression implements BinaryTree {
1558 private int opcode;
1559 public JCExpression lhs;
1560 public JCExpression rhs;
1561 public Symbol operator;
1562 protected JCBinary(int opcode,
1563 JCExpression lhs,
1564 JCExpression rhs,
1565 Symbol operator) {
1566 this.opcode = opcode;
1567 this.lhs = lhs;
1568 this.rhs = rhs;
1569 this.operator = operator;
1570 }
1571 @Override
1572 public void accept(Visitor v) { v.visitBinary(this); }
1574 public Kind getKind() { return TreeInfo.tagToKind(getTag()); }
1575 public JCExpression getLeftOperand() { return lhs; }
1576 public JCExpression getRightOperand() { return rhs; }
1577 public Symbol getOperator() {
1578 return operator;
1579 }
1580 @Override
1581 public <R,D> R accept(TreeVisitor<R,D> v, D d) {
1582 return v.visitBinary(this, d);
1583 }
1584 @Override
1585 public int getTag() {
1586 return opcode;
1587 }
1588 }
1590 /**
1591 * A type cast.
1592 */
1593 public static class JCTypeCast extends JCExpression implements TypeCastTree {
1594 public JCTree clazz;
1595 public JCExpression expr;
1596 protected JCTypeCast(JCTree clazz, JCExpression expr) {
1597 this.clazz = clazz;
1598 this.expr = expr;
1599 }
1600 @Override
1601 public void accept(Visitor v) { v.visitTypeCast(this); }
1603 public Kind getKind() { return Kind.TYPE_CAST; }
1604 public JCTree getType() { return clazz; }
1605 public JCExpression getExpression() { return expr; }
1606 @Override
1607 public <R,D> R accept(TreeVisitor<R,D> v, D d) {
1608 return v.visitTypeCast(this, d);
1609 }
1610 @Override
1611 public int getTag() {
1612 return TYPECAST;
1613 }
1614 }
1616 /**
1617 * A type test.
1618 */
1619 public static class JCInstanceOf extends JCExpression implements InstanceOfTree {
1620 public JCExpression expr;
1621 public JCTree clazz;
1622 protected JCInstanceOf(JCExpression expr, JCTree clazz) {
1623 this.expr = expr;
1624 this.clazz = clazz;
1625 }
1626 @Override
1627 public void accept(Visitor v) { v.visitTypeTest(this); }
1629 public Kind getKind() { return Kind.INSTANCE_OF; }
1630 public JCTree getType() { return clazz; }
1631 public JCExpression getExpression() { return expr; }
1632 @Override
1633 public <R,D> R accept(TreeVisitor<R,D> v, D d) {
1634 return v.visitInstanceOf(this, d);
1635 }
1636 @Override
1637 public int getTag() {
1638 return TYPETEST;
1639 }
1640 }
1642 /**
1643 * An array selection
1644 */
1645 public static class JCArrayAccess extends JCExpression implements ArrayAccessTree {
1646 public JCExpression indexed;
1647 public JCExpression index;
1648 protected JCArrayAccess(JCExpression indexed, JCExpression index) {
1649 this.indexed = indexed;
1650 this.index = index;
1651 }
1652 @Override
1653 public void accept(Visitor v) { v.visitIndexed(this); }
1655 public Kind getKind() { return Kind.ARRAY_ACCESS; }
1656 public JCExpression getExpression() { return indexed; }
1657 public JCExpression getIndex() { return index; }
1658 @Override
1659 public <R,D> R accept(TreeVisitor<R,D> v, D d) {
1660 return v.visitArrayAccess(this, d);
1661 }
1662 @Override
1663 public int getTag() {
1664 return INDEXED;
1665 }
1666 }
1668 /**
1669 * Selects through packages and classes
1670 * @param selected selected Tree hierarchie
1671 * @param selector name of field to select thru
1672 * @param sym symbol of the selected class
1673 */
1674 public static class JCFieldAccess extends JCExpression implements MemberSelectTree {
1675 public JCExpression selected;
1676 public Name name;
1677 public Symbol sym;
1678 protected JCFieldAccess(JCExpression selected, Name name, Symbol sym) {
1679 this.selected = selected;
1680 this.name = name;
1681 this.sym = sym;
1682 }
1683 @Override
1684 public void accept(Visitor v) { v.visitSelect(this); }
1686 public Kind getKind() { return Kind.MEMBER_SELECT; }
1687 public JCExpression getExpression() { return selected; }
1688 @Override
1689 public <R,D> R accept(TreeVisitor<R,D> v, D d) {
1690 return v.visitMemberSelect(this, d);
1691 }
1692 public Name getIdentifier() { return name; }
1693 @Override
1694 public int getTag() {
1695 return SELECT;
1696 }
1697 }
1699 /**
1700 * An identifier
1701 * @param idname the name
1702 * @param sym the symbol
1703 */
1704 public static class JCIdent extends JCExpression implements IdentifierTree {
1705 public Name name;
1706 public Symbol sym;
1707 protected JCIdent(Name name, Symbol sym) {
1708 this.name = name;
1709 this.sym = sym;
1710 }
1711 @Override
1712 public void accept(Visitor v) { v.visitIdent(this); }
1714 public Kind getKind() { return Kind.IDENTIFIER; }
1715 public Name getName() { return name; }
1716 @Override
1717 public <R,D> R accept(TreeVisitor<R,D> v, D d) {
1718 return v.visitIdentifier(this, d);
1719 }
1720 public int getTag() {
1721 return IDENT;
1722 }
1723 }
1725 /**
1726 * A constant value given literally.
1727 * @param value value representation
1728 */
1729 public static class JCLiteral extends JCExpression implements LiteralTree {
1730 public int typetag;
1731 public Object value;
1732 protected JCLiteral(int typetag, Object value) {
1733 this.typetag = typetag;
1734 this.value = value;
1735 }
1736 @Override
1737 public void accept(Visitor v) { v.visitLiteral(this); }
1739 public Kind getKind() {
1740 switch (typetag) {
1741 case TypeTags.INT:
1742 return Kind.INT_LITERAL;
1743 case TypeTags.LONG:
1744 return Kind.LONG_LITERAL;
1745 case TypeTags.FLOAT:
1746 return Kind.FLOAT_LITERAL;
1747 case TypeTags.DOUBLE:
1748 return Kind.DOUBLE_LITERAL;
1749 case TypeTags.BOOLEAN:
1750 return Kind.BOOLEAN_LITERAL;
1751 case TypeTags.CHAR:
1752 return Kind.CHAR_LITERAL;
1753 case TypeTags.CLASS:
1754 return Kind.STRING_LITERAL;
1755 case TypeTags.BOT:
1756 return Kind.NULL_LITERAL;
1757 default:
1758 throw new AssertionError("unknown literal kind " + this);
1759 }
1760 }
1761 public Object getValue() {
1762 switch (typetag) {
1763 case TypeTags.BOOLEAN:
1764 int bi = (Integer) value;
1765 return (bi != 0);
1766 case TypeTags.CHAR:
1767 int ci = (Integer) value;
1768 char c = (char) ci;
1769 if (c != ci)
1770 throw new AssertionError("bad value for char literal");
1771 return c;
1772 default:
1773 return value;
1774 }
1775 }
1776 @Override
1777 public <R,D> R accept(TreeVisitor<R,D> v, D d) {
1778 return v.visitLiteral(this, d);
1779 }
1780 @Override
1781 public JCLiteral setType(Type type) {
1782 super.setType(type);
1783 return this;
1784 }
1785 @Override
1786 public int getTag() {
1787 return LITERAL;
1788 }
1789 }
1791 /**
1792 * Identifies a basic type.
1793 * @param tag the basic type id
1794 * @see TypeTags
1795 */
1796 public static class JCPrimitiveTypeTree extends JCExpression implements PrimitiveTypeTree {
1797 public int typetag;
1798 protected JCPrimitiveTypeTree(int typetag) {
1799 this.typetag = typetag;
1800 }
1801 @Override
1802 public void accept(Visitor v) { v.visitTypeIdent(this); }
1804 public Kind getKind() { return Kind.PRIMITIVE_TYPE; }
1805 public TypeKind getPrimitiveTypeKind() {
1806 switch (typetag) {
1807 case TypeTags.BOOLEAN:
1808 return TypeKind.BOOLEAN;
1809 case TypeTags.BYTE:
1810 return TypeKind.BYTE;
1811 case TypeTags.SHORT:
1812 return TypeKind.SHORT;
1813 case TypeTags.INT:
1814 return TypeKind.INT;
1815 case TypeTags.LONG:
1816 return TypeKind.LONG;
1817 case TypeTags.CHAR:
1818 return TypeKind.CHAR;
1819 case TypeTags.FLOAT:
1820 return TypeKind.FLOAT;
1821 case TypeTags.DOUBLE:
1822 return TypeKind.DOUBLE;
1823 case TypeTags.VOID:
1824 return TypeKind.VOID;
1825 default:
1826 throw new AssertionError("unknown primitive type " + this);
1827 }
1828 }
1829 @Override
1830 public <R,D> R accept(TreeVisitor<R,D> v, D d) {
1831 return v.visitPrimitiveType(this, d);
1832 }
1833 @Override
1834 public int getTag() {
1835 return TYPEIDENT;
1836 }
1837 }
1839 /**
1840 * An array type, A[]
1841 */
1842 public static class JCArrayTypeTree extends JCExpression implements ArrayTypeTree {
1843 public JCExpression elemtype;
1844 protected JCArrayTypeTree(JCExpression elemtype) {
1845 this.elemtype = elemtype;
1846 }
1847 @Override
1848 public void accept(Visitor v) { v.visitTypeArray(this); }
1850 public Kind getKind() { return Kind.ARRAY_TYPE; }
1851 public JCTree getType() { return elemtype; }
1852 @Override
1853 public <R,D> R accept(TreeVisitor<R,D> v, D d) {
1854 return v.visitArrayType(this, d);
1855 }
1856 @Override
1857 public int getTag() {
1858 return TYPEARRAY;
1859 }
1860 }
1862 /**
1863 * A parameterized type, T<...>
1864 */
1865 public static class JCTypeApply extends JCExpression implements ParameterizedTypeTree {
1866 public JCExpression clazz;
1867 public List<JCExpression> arguments;
1868 protected JCTypeApply(JCExpression clazz, List<JCExpression> arguments) {
1869 this.clazz = clazz;
1870 this.arguments = arguments;
1871 }
1872 @Override
1873 public void accept(Visitor v) { v.visitTypeApply(this); }
1875 public Kind getKind() { return Kind.PARAMETERIZED_TYPE; }
1876 public JCTree getType() { return clazz; }
1877 public List<JCExpression> getTypeArguments() {
1878 return arguments;
1879 }
1880 @Override
1881 public <R,D> R accept(TreeVisitor<R,D> v, D d) {
1882 return v.visitParameterizedType(this, d);
1883 }
1884 @Override
1885 public int getTag() {
1886 return TYPEAPPLY;
1887 }
1888 }
1890 /**
1891 * A disjoint type, T1 | T2 | ... Tn (used in multicatch statements)
1892 */
1893 public static class JCTypeDisjoint extends JCExpression implements DisjointTypeTree {
1895 public List<JCExpression> components;
1897 protected JCTypeDisjoint(List<JCExpression> components) {
1898 this.components = components;
1899 }
1900 @Override
1901 public void accept(Visitor v) { v.visitTypeDisjoint(this); }
1903 public Kind getKind() { return Kind.DISJOINT_TYPE; }
1905 public List<JCExpression> getTypeComponents() {
1906 return components;
1907 }
1908 @Override
1909 public <R,D> R accept(TreeVisitor<R,D> v, D d) {
1910 return v.visitDisjointType(this, d);
1911 }
1912 @Override
1913 public int getTag() {
1914 return TYPEDISJOINT;
1915 }
1916 }
1918 /**
1919 * A formal class parameter.
1920 * @param name name
1921 * @param bounds bounds
1922 */
1923 public static class JCTypeParameter extends JCTree implements TypeParameterTree {
1924 public Name name;
1925 public List<JCExpression> bounds;
1926 public List<JCTypeAnnotation> annotations;
1927 protected JCTypeParameter(Name name, List<JCExpression> bounds, List<JCTypeAnnotation> annotations) {
1928 this.name = name;
1929 this.bounds = bounds;
1930 this.annotations = annotations;
1931 }
1932 @Override
1933 public void accept(Visitor v) { v.visitTypeParameter(this); }
1935 public Kind getKind() { return Kind.TYPE_PARAMETER; }
1936 public Name getName() { return name; }
1937 public List<JCExpression> getBounds() {
1938 return bounds;
1939 }
1940 public List<JCTypeAnnotation> getAnnotations() {
1941 return annotations;
1942 }
1943 @Override
1944 public <R,D> R accept(TreeVisitor<R,D> v, D d) {
1945 return v.visitTypeParameter(this, d);
1946 }
1947 @Override
1948 public int getTag() {
1949 return TYPEPARAMETER;
1950 }
1951 }
1953 public static class JCWildcard extends JCExpression implements WildcardTree {
1954 public TypeBoundKind kind;
1955 public JCTree inner;
1956 protected JCWildcard(TypeBoundKind kind, JCTree inner) {
1957 kind.getClass(); // null-check
1958 this.kind = kind;
1959 this.inner = inner;
1960 }
1961 @Override
1962 public void accept(Visitor v) { v.visitWildcard(this); }
1964 public Kind getKind() {
1965 switch (kind.kind) {
1966 case UNBOUND:
1967 return Kind.UNBOUNDED_WILDCARD;
1968 case EXTENDS:
1969 return Kind.EXTENDS_WILDCARD;
1970 case SUPER:
1971 return Kind.SUPER_WILDCARD;
1972 default:
1973 throw new AssertionError("Unknown wildcard bound " + kind);
1974 }
1975 }
1976 public JCTree getBound() { return inner; }
1977 @Override
1978 public <R,D> R accept(TreeVisitor<R,D> v, D d) {
1979 return v.visitWildcard(this, d);
1980 }
1981 @Override
1982 public int getTag() {
1983 return WILDCARD;
1984 }
1985 }
1987 public static class TypeBoundKind extends JCTree {
1988 public BoundKind kind;
1989 protected TypeBoundKind(BoundKind kind) {
1990 this.kind = kind;
1991 }
1992 @Override
1993 public void accept(Visitor v) { v.visitTypeBoundKind(this); }
1995 public Kind getKind() {
1996 throw new AssertionError("TypeBoundKind is not part of a public API");
1997 }
1998 @Override
1999 public <R,D> R accept(TreeVisitor<R,D> v, D d) {
2000 throw new AssertionError("TypeBoundKind is not part of a public API");
2001 }
2002 @Override
2003 public int getTag() {
2004 return TYPEBOUNDKIND;
2005 }
2006 }
2008 public static class JCAnnotation extends JCExpression implements AnnotationTree {
2009 public JCTree annotationType;
2010 public List<JCExpression> args;
2011 protected JCAnnotation(JCTree annotationType, List<JCExpression> args) {
2012 this.annotationType = annotationType;
2013 this.args = args;
2014 }
2015 @Override
2016 public void accept(Visitor v) { v.visitAnnotation(this); }
2018 public Kind getKind() { return Kind.ANNOTATION; }
2019 public JCTree getAnnotationType() { return annotationType; }
2020 public List<JCExpression> getArguments() {
2021 return args;
2022 }
2023 @Override
2024 public <R,D> R accept(TreeVisitor<R,D> v, D d) {
2025 return v.visitAnnotation(this, d);
2026 }
2027 @Override
2028 public int getTag() {
2029 return ANNOTATION;
2030 }
2031 }
2033 public static class JCTypeAnnotation extends JCAnnotation {
2034 public TypeAnnotationPosition annotation_position;
2035 public Attribute.TypeCompound attribute_field;
2037 protected JCTypeAnnotation(JCTree annotationType, List<JCExpression> args) {
2038 super(annotationType, args);
2039 this.annotation_position = new TypeAnnotationPosition();
2040 }
2041 }
2043 public static class JCModifiers extends JCTree implements com.sun.source.tree.ModifiersTree {
2044 public long flags;
2045 public List<JCAnnotation> annotations;
2046 protected JCModifiers(long flags, List<JCAnnotation> annotations) {
2047 this.flags = flags;
2048 this.annotations = annotations;
2049 }
2050 @Override
2051 public void accept(Visitor v) { v.visitModifiers(this); }
2053 public Kind getKind() { return Kind.MODIFIERS; }
2054 public Set<Modifier> getFlags() {
2055 return Flags.asModifierSet(flags);
2056 }
2057 public List<JCAnnotation> getAnnotations() {
2058 return annotations;
2059 }
2060 @Override
2061 public <R,D> R accept(TreeVisitor<R,D> v, D d) {
2062 return v.visitModifiers(this, d);
2063 }
2064 @Override
2065 public int getTag() {
2066 return MODIFIERS;
2067 }
2068 }
2070 public static class JCAnnotatedType extends JCExpression implements com.sun.source.tree.AnnotatedTypeTree {
2071 public List<JCTypeAnnotation> annotations;
2072 public JCExpression underlyingType;
2073 protected JCAnnotatedType(List<JCTypeAnnotation> annotations, JCExpression underlyingType) {
2074 this.annotations = annotations;
2075 this.underlyingType = underlyingType;
2076 }
2077 @Override
2078 public void accept(Visitor v) { v.visitAnnotatedType(this); }
2080 public Kind getKind() { return Kind.ANNOTATED_TYPE; }
2081 public List<JCTypeAnnotation> getAnnotations() {
2082 return annotations;
2083 }
2084 public JCExpression getUnderlyingType() {
2085 return underlyingType;
2086 }
2087 @Override
2088 public <R,D> R accept(TreeVisitor<R,D> v, D d) {
2089 return v.visitAnnotatedType(this, d);
2090 }
2091 @Override
2092 public int getTag() {
2093 return ANNOTATED_TYPE;
2094 }
2095 }
2097 public static class JCErroneous extends JCExpression
2098 implements com.sun.source.tree.ErroneousTree {
2099 public List<? extends JCTree> errs;
2100 protected JCErroneous(List<? extends JCTree> errs) {
2101 this.errs = errs;
2102 }
2103 @Override
2104 public void accept(Visitor v) { v.visitErroneous(this); }
2106 public Kind getKind() { return Kind.ERRONEOUS; }
2108 public List<? extends JCTree> getErrorTrees() {
2109 return errs;
2110 }
2112 @Override
2113 public <R,D> R accept(TreeVisitor<R,D> v, D d) {
2114 return v.visitErroneous(this, d);
2115 }
2116 @Override
2117 public int getTag() {
2118 return ERRONEOUS;
2119 }
2120 }
2122 /** (let int x = 3; in x+2) */
2123 public static class LetExpr extends JCExpression {
2124 public List<JCVariableDecl> defs;
2125 public JCTree expr;
2126 protected LetExpr(List<JCVariableDecl> defs, JCTree expr) {
2127 this.defs = defs;
2128 this.expr = expr;
2129 }
2130 @Override
2131 public void accept(Visitor v) { v.visitLetExpr(this); }
2133 public Kind getKind() {
2134 throw new AssertionError("LetExpr is not part of a public API");
2135 }
2136 @Override
2137 public <R,D> R accept(TreeVisitor<R,D> v, D d) {
2138 throw new AssertionError("LetExpr is not part of a public API");
2139 }
2140 @Override
2141 public int getTag() {
2142 return LETEXPR;
2143 }
2144 }
2146 /** An interface for tree factories
2147 */
2148 public interface Factory {
2149 JCCompilationUnit TopLevel(List<JCAnnotation> packageAnnotations,
2150 JCExpression pid,
2151 List<JCTree> defs);
2152 JCImport Import(JCTree qualid, boolean staticImport);
2153 JCClassDecl ClassDef(JCModifiers mods,
2154 Name name,
2155 List<JCTypeParameter> typarams,
2156 JCTree extending,
2157 List<JCExpression> implementing,
2158 List<JCTree> defs);
2159 JCMethodDecl MethodDef(JCModifiers mods,
2160 Name name,
2161 JCExpression restype,
2162 List<JCTypeParameter> typarams,
2163 List<JCVariableDecl> params,
2164 List<JCTypeAnnotation> receiver,
2165 List<JCExpression> thrown,
2166 JCBlock body,
2167 JCExpression defaultValue);
2168 JCVariableDecl VarDef(JCModifiers mods,
2169 Name name,
2170 JCExpression vartype,
2171 JCExpression init);
2172 JCSkip Skip();
2173 JCBlock Block(long flags, List<JCStatement> stats);
2174 JCDoWhileLoop DoLoop(JCStatement body, JCExpression cond);
2175 JCWhileLoop WhileLoop(JCExpression cond, JCStatement body);
2176 JCForLoop ForLoop(List<JCStatement> init,
2177 JCExpression cond,
2178 List<JCExpressionStatement> step,
2179 JCStatement body);
2180 JCEnhancedForLoop ForeachLoop(JCVariableDecl var, JCExpression expr, JCStatement body);
2181 JCLabeledStatement Labelled(Name label, JCStatement body);
2182 JCSwitch Switch(JCExpression selector, List<JCCase> cases);
2183 JCCase Case(JCExpression pat, List<JCStatement> stats);
2184 JCSynchronized Synchronized(JCExpression lock, JCBlock body);
2185 JCTry Try(JCBlock body, List<JCCatch> catchers, JCBlock finalizer);
2186 JCTry Try(List<JCTree> resources,
2187 JCBlock body,
2188 List<JCCatch> catchers,
2189 JCBlock finalizer);
2190 JCCatch Catch(JCVariableDecl param, JCBlock body);
2191 JCConditional Conditional(JCExpression cond,
2192 JCExpression thenpart,
2193 JCExpression elsepart);
2194 JCIf If(JCExpression cond, JCStatement thenpart, JCStatement elsepart);
2195 JCExpressionStatement Exec(JCExpression expr);
2196 JCBreak Break(Name label);
2197 JCContinue Continue(Name label);
2198 JCReturn Return(JCExpression expr);
2199 JCThrow Throw(JCTree expr);
2200 JCAssert Assert(JCExpression cond, JCExpression detail);
2201 JCMethodInvocation Apply(List<JCExpression> typeargs,
2202 JCExpression fn,
2203 List<JCExpression> args);
2204 JCNewClass NewClass(JCExpression encl,
2205 List<JCExpression> typeargs,
2206 JCExpression clazz,
2207 List<JCExpression> args,
2208 JCClassDecl def);
2209 JCNewArray NewArray(JCExpression elemtype,
2210 List<JCExpression> dims,
2211 List<JCExpression> elems);
2212 JCParens Parens(JCExpression expr);
2213 JCAssign Assign(JCExpression lhs, JCExpression rhs);
2214 JCAssignOp Assignop(int opcode, JCTree lhs, JCTree rhs);
2215 JCUnary Unary(int opcode, JCExpression arg);
2216 JCBinary Binary(int opcode, JCExpression lhs, JCExpression rhs);
2217 JCTypeCast TypeCast(JCTree expr, JCExpression type);
2218 JCInstanceOf TypeTest(JCExpression expr, JCTree clazz);
2219 JCArrayAccess Indexed(JCExpression indexed, JCExpression index);
2220 JCFieldAccess Select(JCExpression selected, Name selector);
2221 JCIdent Ident(Name idname);
2222 JCLiteral Literal(int tag, Object value);
2223 JCPrimitiveTypeTree TypeIdent(int typetag);
2224 JCArrayTypeTree TypeArray(JCExpression elemtype);
2225 JCTypeApply TypeApply(JCExpression clazz, List<JCExpression> arguments);
2226 JCTypeParameter TypeParameter(Name name, List<JCExpression> bounds);
2227 JCWildcard Wildcard(TypeBoundKind kind, JCTree type);
2228 TypeBoundKind TypeBoundKind(BoundKind kind);
2229 JCAnnotation Annotation(JCTree annotationType, List<JCExpression> args);
2230 JCModifiers Modifiers(long flags, List<JCAnnotation> annotations);
2231 JCErroneous Erroneous(List<? extends JCTree> errs);
2232 LetExpr LetExpr(List<JCVariableDecl> defs, JCTree expr);
2233 }
2235 /** A generic visitor class for trees.
2236 */
2237 public static abstract class Visitor {
2238 public void visitTopLevel(JCCompilationUnit that) { visitTree(that); }
2239 public void visitImport(JCImport that) { visitTree(that); }
2240 public void visitClassDef(JCClassDecl that) { visitTree(that); }
2241 public void visitMethodDef(JCMethodDecl that) { visitTree(that); }
2242 public void visitVarDef(JCVariableDecl that) { visitTree(that); }
2243 public void visitSkip(JCSkip that) { visitTree(that); }
2244 public void visitBlock(JCBlock that) { visitTree(that); }
2245 public void visitDoLoop(JCDoWhileLoop that) { visitTree(that); }
2246 public void visitWhileLoop(JCWhileLoop that) { visitTree(that); }
2247 public void visitForLoop(JCForLoop that) { visitTree(that); }
2248 public void visitForeachLoop(JCEnhancedForLoop that) { visitTree(that); }
2249 public void visitLabelled(JCLabeledStatement that) { visitTree(that); }
2250 public void visitSwitch(JCSwitch that) { visitTree(that); }
2251 public void visitCase(JCCase that) { visitTree(that); }
2252 public void visitSynchronized(JCSynchronized that) { visitTree(that); }
2253 public void visitTry(JCTry that) { visitTree(that); }
2254 public void visitCatch(JCCatch that) { visitTree(that); }
2255 public void visitConditional(JCConditional that) { visitTree(that); }
2256 public void visitIf(JCIf that) { visitTree(that); }
2257 public void visitExec(JCExpressionStatement that) { visitTree(that); }
2258 public void visitBreak(JCBreak that) { visitTree(that); }
2259 public void visitContinue(JCContinue that) { visitTree(that); }
2260 public void visitReturn(JCReturn that) { visitTree(that); }
2261 public void visitThrow(JCThrow that) { visitTree(that); }
2262 public void visitAssert(JCAssert that) { visitTree(that); }
2263 public void visitApply(JCMethodInvocation that) { visitTree(that); }
2264 public void visitNewClass(JCNewClass that) { visitTree(that); }
2265 public void visitNewArray(JCNewArray that) { visitTree(that); }
2266 public void visitParens(JCParens that) { visitTree(that); }
2267 public void visitAssign(JCAssign that) { visitTree(that); }
2268 public void visitAssignop(JCAssignOp that) { visitTree(that); }
2269 public void visitUnary(JCUnary that) { visitTree(that); }
2270 public void visitBinary(JCBinary that) { visitTree(that); }
2271 public void visitTypeCast(JCTypeCast that) { visitTree(that); }
2272 public void visitTypeTest(JCInstanceOf that) { visitTree(that); }
2273 public void visitIndexed(JCArrayAccess that) { visitTree(that); }
2274 public void visitSelect(JCFieldAccess that) { visitTree(that); }
2275 public void visitIdent(JCIdent that) { visitTree(that); }
2276 public void visitLiteral(JCLiteral that) { visitTree(that); }
2277 public void visitTypeIdent(JCPrimitiveTypeTree that) { visitTree(that); }
2278 public void visitTypeArray(JCArrayTypeTree that) { visitTree(that); }
2279 public void visitTypeApply(JCTypeApply that) { visitTree(that); }
2280 public void visitTypeDisjoint(JCTypeDisjoint that) { visitTree(that); }
2281 public void visitTypeParameter(JCTypeParameter that) { visitTree(that); }
2282 public void visitWildcard(JCWildcard that) { visitTree(that); }
2283 public void visitTypeBoundKind(TypeBoundKind that) { visitTree(that); }
2284 public void visitAnnotation(JCAnnotation that) { visitTree(that); }
2285 public void visitModifiers(JCModifiers that) { visitTree(that); }
2286 public void visitAnnotatedType(JCAnnotatedType that) { visitTree(that); }
2287 public void visitErroneous(JCErroneous that) { visitTree(that); }
2288 public void visitLetExpr(LetExpr that) { visitTree(that); }
2290 public void visitTree(JCTree that) { assert false; }
2291 }
2293 }