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