Tue, 20 Sep 2011 12:08:48 -0700
7030473: Remove dead field JCCompilationUnit.flags
Reviewed-by: dlsmith
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 Position.LineMap lineMap = null;
440 public Map<JCTree, String> docComments = null;
441 public Map<JCTree, Integer> endPositions = null;
442 protected JCCompilationUnit(List<JCAnnotation> packageAnnotations,
443 JCExpression pid,
444 List<JCTree> defs,
445 JavaFileObject sourcefile,
446 PackageSymbol packge,
447 ImportScope namedImportScope,
448 StarImportScope starImportScope) {
449 this.packageAnnotations = packageAnnotations;
450 this.pid = pid;
451 this.defs = defs;
452 this.sourcefile = sourcefile;
453 this.packge = packge;
454 this.namedImportScope = namedImportScope;
455 this.starImportScope = starImportScope;
456 }
457 @Override
458 public void accept(Visitor v) { v.visitTopLevel(this); }
460 public Kind getKind() { return Kind.COMPILATION_UNIT; }
461 public List<JCAnnotation> getPackageAnnotations() {
462 return packageAnnotations;
463 }
464 public List<JCImport> getImports() {
465 ListBuffer<JCImport> imports = new ListBuffer<JCImport>();
466 for (JCTree tree : defs) {
467 int tag = tree.getTag();
468 if (tag == IMPORT)
469 imports.append((JCImport)tree);
470 else if (tag != SKIP)
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 JCExpression 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 JCExpression 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<JCExpression> thrown;
644 public JCBlock body;
645 public JCExpression defaultValue; // for annotation types
646 public MethodSymbol sym;
647 protected JCMethodDecl(JCModifiers mods,
648 Name name,
649 JCExpression restype,
650 List<JCTypeParameter> typarams,
651 List<JCVariableDecl> params,
652 List<JCExpression> thrown,
653 JCBlock body,
654 JCExpression defaultValue,
655 MethodSymbol sym)
656 {
657 this.mods = mods;
658 this.name = name;
659 this.restype = restype;
660 this.typarams = typarams;
661 this.params = params;
662 this.thrown = thrown;
663 this.body = body;
664 this.defaultValue = defaultValue;
665 this.sym = sym;
666 }
667 @Override
668 public void accept(Visitor v) { v.visitMethodDef(this); }
670 public Kind getKind() { return Kind.METHOD; }
671 public JCModifiers getModifiers() { return mods; }
672 public Name getName() { return name; }
673 public JCTree getReturnType() { return restype; }
674 public List<JCTypeParameter> getTypeParameters() {
675 return typarams;
676 }
677 public List<JCVariableDecl> getParameters() {
678 return params;
679 }
680 public List<JCExpression> getThrows() {
681 return thrown;
682 }
683 public JCBlock getBody() { return body; }
684 public JCTree getDefaultValue() { // for annotation types
685 return defaultValue;
686 }
687 @Override
688 public <R,D> R accept(TreeVisitor<R,D> v, D d) {
689 return v.visitMethod(this, d);
690 }
692 @Override
693 public int getTag() {
694 return METHODDEF;
695 }
696 }
698 /**
699 * A variable definition.
700 * @param modifiers variable modifiers
701 * @param name variable name
702 * @param vartype type of the variable
703 * @param init variables initial value
704 * @param sym symbol
705 */
706 public static class JCVariableDecl extends JCStatement implements VariableTree {
707 public JCModifiers mods;
708 public Name name;
709 public JCExpression vartype;
710 public JCExpression init;
711 public VarSymbol sym;
712 protected JCVariableDecl(JCModifiers mods,
713 Name name,
714 JCExpression vartype,
715 JCExpression init,
716 VarSymbol sym) {
717 this.mods = mods;
718 this.name = name;
719 this.vartype = vartype;
720 this.init = init;
721 this.sym = sym;
722 }
723 @Override
724 public void accept(Visitor v) { v.visitVarDef(this); }
726 public Kind getKind() { return Kind.VARIABLE; }
727 public JCModifiers getModifiers() { return mods; }
728 public Name getName() { return name; }
729 public JCTree getType() { return vartype; }
730 public JCExpression getInitializer() {
731 return init;
732 }
733 @Override
734 public <R,D> R accept(TreeVisitor<R,D> v, D d) {
735 return v.visitVariable(this, d);
736 }
738 @Override
739 public int getTag() {
740 return VARDEF;
741 }
742 }
744 /**
745 * A no-op statement ";".
746 */
747 public static class JCSkip extends JCStatement implements EmptyStatementTree {
748 protected JCSkip() {
749 }
750 @Override
751 public void accept(Visitor v) { v.visitSkip(this); }
753 public Kind getKind() { return Kind.EMPTY_STATEMENT; }
754 @Override
755 public <R,D> R accept(TreeVisitor<R,D> v, D d) {
756 return v.visitEmptyStatement(this, d);
757 }
759 @Override
760 public int getTag() {
761 return SKIP;
762 }
763 }
765 /**
766 * A statement block.
767 * @param stats statements
768 * @param flags flags
769 */
770 public static class JCBlock extends JCStatement implements BlockTree {
771 public long flags;
772 public List<JCStatement> stats;
773 /** Position of closing brace, optional. */
774 public int endpos = Position.NOPOS;
775 protected JCBlock(long flags, List<JCStatement> stats) {
776 this.stats = stats;
777 this.flags = flags;
778 }
779 @Override
780 public void accept(Visitor v) { v.visitBlock(this); }
782 public Kind getKind() { return Kind.BLOCK; }
783 public List<JCStatement> getStatements() {
784 return stats;
785 }
786 public boolean isStatic() { return (flags & Flags.STATIC) != 0; }
787 @Override
788 public <R,D> R accept(TreeVisitor<R,D> v, D d) {
789 return v.visitBlock(this, d);
790 }
792 @Override
793 public int getTag() {
794 return BLOCK;
795 }
796 }
798 /**
799 * A do loop
800 */
801 public static class JCDoWhileLoop extends JCStatement implements DoWhileLoopTree {
802 public JCStatement body;
803 public JCExpression cond;
804 protected JCDoWhileLoop(JCStatement body, JCExpression cond) {
805 this.body = body;
806 this.cond = cond;
807 }
808 @Override
809 public void accept(Visitor v) { v.visitDoLoop(this); }
811 public Kind getKind() { return Kind.DO_WHILE_LOOP; }
812 public JCExpression getCondition() { return cond; }
813 public JCStatement getStatement() { return body; }
814 @Override
815 public <R,D> R accept(TreeVisitor<R,D> v, D d) {
816 return v.visitDoWhileLoop(this, d);
817 }
819 @Override
820 public int getTag() {
821 return DOLOOP;
822 }
823 }
825 /**
826 * A while loop
827 */
828 public static class JCWhileLoop extends JCStatement implements WhileLoopTree {
829 public JCExpression cond;
830 public JCStatement body;
831 protected JCWhileLoop(JCExpression cond, JCStatement body) {
832 this.cond = cond;
833 this.body = body;
834 }
835 @Override
836 public void accept(Visitor v) { v.visitWhileLoop(this); }
838 public Kind getKind() { return Kind.WHILE_LOOP; }
839 public JCExpression getCondition() { return cond; }
840 public JCStatement getStatement() { return body; }
841 @Override
842 public <R,D> R accept(TreeVisitor<R,D> v, D d) {
843 return v.visitWhileLoop(this, d);
844 }
846 @Override
847 public int getTag() {
848 return WHILELOOP;
849 }
850 }
852 /**
853 * A for loop.
854 */
855 public static class JCForLoop extends JCStatement implements ForLoopTree {
856 public List<JCStatement> init;
857 public JCExpression cond;
858 public List<JCExpressionStatement> step;
859 public JCStatement body;
860 protected JCForLoop(List<JCStatement> init,
861 JCExpression cond,
862 List<JCExpressionStatement> update,
863 JCStatement body)
864 {
865 this.init = init;
866 this.cond = cond;
867 this.step = update;
868 this.body = body;
869 }
870 @Override
871 public void accept(Visitor v) { v.visitForLoop(this); }
873 public Kind getKind() { return Kind.FOR_LOOP; }
874 public JCExpression getCondition() { return cond; }
875 public JCStatement getStatement() { return body; }
876 public List<JCStatement> getInitializer() {
877 return init;
878 }
879 public List<JCExpressionStatement> getUpdate() {
880 return step;
881 }
882 @Override
883 public <R,D> R accept(TreeVisitor<R,D> v, D d) {
884 return v.visitForLoop(this, d);
885 }
887 @Override
888 public int getTag() {
889 return FORLOOP;
890 }
891 }
893 /**
894 * The enhanced for loop.
895 */
896 public static class JCEnhancedForLoop extends JCStatement implements EnhancedForLoopTree {
897 public JCVariableDecl var;
898 public JCExpression expr;
899 public JCStatement body;
900 protected JCEnhancedForLoop(JCVariableDecl var, JCExpression expr, JCStatement body) {
901 this.var = var;
902 this.expr = expr;
903 this.body = body;
904 }
905 @Override
906 public void accept(Visitor v) { v.visitForeachLoop(this); }
908 public Kind getKind() { return Kind.ENHANCED_FOR_LOOP; }
909 public JCVariableDecl getVariable() { return var; }
910 public JCExpression getExpression() { return expr; }
911 public JCStatement getStatement() { return body; }
912 @Override
913 public <R,D> R accept(TreeVisitor<R,D> v, D d) {
914 return v.visitEnhancedForLoop(this, d);
915 }
916 @Override
917 public int getTag() {
918 return FOREACHLOOP;
919 }
920 }
922 /**
923 * A labelled expression or statement.
924 */
925 public static class JCLabeledStatement extends JCStatement implements LabeledStatementTree {
926 public Name label;
927 public JCStatement body;
928 protected JCLabeledStatement(Name label, JCStatement body) {
929 this.label = label;
930 this.body = body;
931 }
932 @Override
933 public void accept(Visitor v) { v.visitLabelled(this); }
934 public Kind getKind() { return Kind.LABELED_STATEMENT; }
935 public Name getLabel() { return label; }
936 public JCStatement getStatement() { return body; }
937 @Override
938 public <R,D> R accept(TreeVisitor<R,D> v, D d) {
939 return v.visitLabeledStatement(this, d);
940 }
941 @Override
942 public int getTag() {
943 return LABELLED;
944 }
945 }
947 /**
948 * A "switch ( ) { }" construction.
949 */
950 public static class JCSwitch extends JCStatement implements SwitchTree {
951 public JCExpression selector;
952 public List<JCCase> cases;
953 protected JCSwitch(JCExpression selector, List<JCCase> cases) {
954 this.selector = selector;
955 this.cases = cases;
956 }
957 @Override
958 public void accept(Visitor v) { v.visitSwitch(this); }
960 public Kind getKind() { return Kind.SWITCH; }
961 public JCExpression getExpression() { return selector; }
962 public List<JCCase> getCases() { return cases; }
963 @Override
964 public <R,D> R accept(TreeVisitor<R,D> v, D d) {
965 return v.visitSwitch(this, d);
966 }
967 @Override
968 public int getTag() {
969 return SWITCH;
970 }
971 }
973 /**
974 * A "case :" of a switch.
975 */
976 public static class JCCase extends JCStatement implements CaseTree {
977 public JCExpression pat;
978 public List<JCStatement> stats;
979 protected JCCase(JCExpression pat, List<JCStatement> stats) {
980 this.pat = pat;
981 this.stats = stats;
982 }
983 @Override
984 public void accept(Visitor v) { v.visitCase(this); }
986 public Kind getKind() { return Kind.CASE; }
987 public JCExpression getExpression() { return pat; }
988 public List<JCStatement> getStatements() { return stats; }
989 @Override
990 public <R,D> R accept(TreeVisitor<R,D> v, D d) {
991 return v.visitCase(this, d);
992 }
993 @Override
994 public int getTag() {
995 return CASE;
996 }
997 }
999 /**
1000 * A synchronized block.
1001 */
1002 public static class JCSynchronized extends JCStatement implements SynchronizedTree {
1003 public JCExpression lock;
1004 public JCBlock body;
1005 protected JCSynchronized(JCExpression lock, JCBlock body) {
1006 this.lock = lock;
1007 this.body = body;
1008 }
1009 @Override
1010 public void accept(Visitor v) { v.visitSynchronized(this); }
1012 public Kind getKind() { return Kind.SYNCHRONIZED; }
1013 public JCExpression getExpression() { return lock; }
1014 public JCBlock getBlock() { return body; }
1015 @Override
1016 public <R,D> R accept(TreeVisitor<R,D> v, D d) {
1017 return v.visitSynchronized(this, d);
1018 }
1019 @Override
1020 public int getTag() {
1021 return SYNCHRONIZED;
1022 }
1023 }
1025 /**
1026 * A "try { } catch ( ) { } finally { }" block.
1027 */
1028 public static class JCTry extends JCStatement implements TryTree {
1029 public JCBlock body;
1030 public List<JCCatch> catchers;
1031 public JCBlock finalizer;
1032 public List<JCTree> resources;
1033 protected JCTry(List<JCTree> resources,
1034 JCBlock body,
1035 List<JCCatch> catchers,
1036 JCBlock finalizer) {
1037 this.body = body;
1038 this.catchers = catchers;
1039 this.finalizer = finalizer;
1040 this.resources = resources;
1041 }
1042 @Override
1043 public void accept(Visitor v) { v.visitTry(this); }
1045 public Kind getKind() { return Kind.TRY; }
1046 public JCBlock getBlock() { return body; }
1047 public List<JCCatch> getCatches() {
1048 return catchers;
1049 }
1050 public JCBlock getFinallyBlock() { return finalizer; }
1051 @Override
1052 public <R,D> R accept(TreeVisitor<R,D> v, D d) {
1053 return v.visitTry(this, d);
1054 }
1055 @Override
1056 public List<? extends JCTree> getResources() {
1057 return resources;
1058 }
1059 @Override
1060 public int getTag() {
1061 return TRY;
1062 }
1063 }
1065 /**
1066 * A catch block.
1067 */
1068 public static class JCCatch extends JCTree implements CatchTree {
1069 public JCVariableDecl param;
1070 public JCBlock body;
1071 protected JCCatch(JCVariableDecl param, JCBlock body) {
1072 this.param = param;
1073 this.body = body;
1074 }
1075 @Override
1076 public void accept(Visitor v) { v.visitCatch(this); }
1078 public Kind getKind() { return Kind.CATCH; }
1079 public JCVariableDecl getParameter() { return param; }
1080 public JCBlock getBlock() { return body; }
1081 @Override
1082 public <R,D> R accept(TreeVisitor<R,D> v, D d) {
1083 return v.visitCatch(this, d);
1084 }
1085 @Override
1086 public int getTag() {
1087 return CATCH;
1088 }
1089 }
1091 /**
1092 * A ( ) ? ( ) : ( ) conditional expression
1093 */
1094 public static class JCConditional extends JCExpression implements ConditionalExpressionTree {
1095 public JCExpression cond;
1096 public JCExpression truepart;
1097 public JCExpression falsepart;
1098 protected JCConditional(JCExpression cond,
1099 JCExpression truepart,
1100 JCExpression falsepart)
1101 {
1102 this.cond = cond;
1103 this.truepart = truepart;
1104 this.falsepart = falsepart;
1105 }
1106 @Override
1107 public void accept(Visitor v) { v.visitConditional(this); }
1109 public Kind getKind() { return Kind.CONDITIONAL_EXPRESSION; }
1110 public JCExpression getCondition() { return cond; }
1111 public JCExpression getTrueExpression() { return truepart; }
1112 public JCExpression getFalseExpression() { return falsepart; }
1113 @Override
1114 public <R,D> R accept(TreeVisitor<R,D> v, D d) {
1115 return v.visitConditionalExpression(this, d);
1116 }
1117 @Override
1118 public int getTag() {
1119 return CONDEXPR;
1120 }
1121 }
1123 /**
1124 * An "if ( ) { } else { }" block
1125 */
1126 public static class JCIf extends JCStatement implements IfTree {
1127 public JCExpression cond;
1128 public JCStatement thenpart;
1129 public JCStatement elsepart;
1130 protected JCIf(JCExpression cond,
1131 JCStatement thenpart,
1132 JCStatement elsepart)
1133 {
1134 this.cond = cond;
1135 this.thenpart = thenpart;
1136 this.elsepart = elsepart;
1137 }
1138 @Override
1139 public void accept(Visitor v) { v.visitIf(this); }
1141 public Kind getKind() { return Kind.IF; }
1142 public JCExpression getCondition() { return cond; }
1143 public JCStatement getThenStatement() { return thenpart; }
1144 public JCStatement getElseStatement() { return elsepart; }
1145 @Override
1146 public <R,D> R accept(TreeVisitor<R,D> v, D d) {
1147 return v.visitIf(this, d);
1148 }
1149 @Override
1150 public int getTag() {
1151 return IF;
1152 }
1153 }
1155 /**
1156 * an expression statement
1157 * @param expr expression structure
1158 */
1159 public static class JCExpressionStatement extends JCStatement implements ExpressionStatementTree {
1160 public JCExpression expr;
1161 protected JCExpressionStatement(JCExpression expr)
1162 {
1163 this.expr = expr;
1164 }
1165 @Override
1166 public void accept(Visitor v) { v.visitExec(this); }
1168 public Kind getKind() { return Kind.EXPRESSION_STATEMENT; }
1169 public JCExpression getExpression() { return expr; }
1170 @Override
1171 public <R,D> R accept(TreeVisitor<R,D> v, D d) {
1172 return v.visitExpressionStatement(this, d);
1173 }
1174 @Override
1175 public int getTag() {
1176 return EXEC;
1177 }
1179 /** Convert a expression-statement tree to a pretty-printed string. */
1180 @Override
1181 public String toString() {
1182 StringWriter s = new StringWriter();
1183 try {
1184 new Pretty(s, false).printStat(this);
1185 }
1186 catch (IOException e) {
1187 // should never happen, because StringWriter is defined
1188 // never to throw any IOExceptions
1189 throw new AssertionError(e);
1190 }
1191 return s.toString();
1192 }
1193 }
1195 /**
1196 * A break from a loop or switch.
1197 */
1198 public static class JCBreak extends JCStatement implements BreakTree {
1199 public Name label;
1200 public JCTree target;
1201 protected JCBreak(Name label, JCTree target) {
1202 this.label = label;
1203 this.target = target;
1204 }
1205 @Override
1206 public void accept(Visitor v) { v.visitBreak(this); }
1208 public Kind getKind() { return Kind.BREAK; }
1209 public Name getLabel() { return label; }
1210 @Override
1211 public <R,D> R accept(TreeVisitor<R,D> v, D d) {
1212 return v.visitBreak(this, d);
1213 }
1214 @Override
1215 public int getTag() {
1216 return BREAK;
1217 }
1218 }
1220 /**
1221 * A continue of a loop.
1222 */
1223 public static class JCContinue extends JCStatement implements ContinueTree {
1224 public Name label;
1225 public JCTree target;
1226 protected JCContinue(Name label, JCTree target) {
1227 this.label = label;
1228 this.target = target;
1229 }
1230 @Override
1231 public void accept(Visitor v) { v.visitContinue(this); }
1233 public Kind getKind() { return Kind.CONTINUE; }
1234 public Name getLabel() { return label; }
1235 @Override
1236 public <R,D> R accept(TreeVisitor<R,D> v, D d) {
1237 return v.visitContinue(this, d);
1238 }
1239 @Override
1240 public int getTag() {
1241 return CONTINUE;
1242 }
1243 }
1245 /**
1246 * A return statement.
1247 */
1248 public static class JCReturn extends JCStatement implements ReturnTree {
1249 public JCExpression expr;
1250 protected JCReturn(JCExpression expr) {
1251 this.expr = expr;
1252 }
1253 @Override
1254 public void accept(Visitor v) { v.visitReturn(this); }
1256 public Kind getKind() { return Kind.RETURN; }
1257 public JCExpression getExpression() { return expr; }
1258 @Override
1259 public <R,D> R accept(TreeVisitor<R,D> v, D d) {
1260 return v.visitReturn(this, d);
1261 }
1262 @Override
1263 public int getTag() {
1264 return RETURN;
1265 }
1266 }
1268 /**
1269 * A throw statement.
1270 */
1271 public static class JCThrow extends JCStatement implements ThrowTree {
1272 public JCExpression expr;
1273 protected JCThrow(JCTree expr) {
1274 this.expr = (JCExpression)expr;
1275 }
1276 @Override
1277 public void accept(Visitor v) { v.visitThrow(this); }
1279 public Kind getKind() { return Kind.THROW; }
1280 public JCExpression getExpression() { return expr; }
1281 @Override
1282 public <R,D> R accept(TreeVisitor<R,D> v, D d) {
1283 return v.visitThrow(this, d);
1284 }
1285 @Override
1286 public int getTag() {
1287 return THROW;
1288 }
1289 }
1291 /**
1292 * An assert statement.
1293 */
1294 public static class JCAssert extends JCStatement implements AssertTree {
1295 public JCExpression cond;
1296 public JCExpression detail;
1297 protected JCAssert(JCExpression cond, JCExpression detail) {
1298 this.cond = cond;
1299 this.detail = detail;
1300 }
1301 @Override
1302 public void accept(Visitor v) { v.visitAssert(this); }
1304 public Kind getKind() { return Kind.ASSERT; }
1305 public JCExpression getCondition() { return cond; }
1306 public JCExpression getDetail() { return detail; }
1307 @Override
1308 public <R,D> R accept(TreeVisitor<R,D> v, D d) {
1309 return v.visitAssert(this, d);
1310 }
1311 @Override
1312 public int getTag() {
1313 return ASSERT;
1314 }
1315 }
1317 /**
1318 * A method invocation
1319 */
1320 public static class JCMethodInvocation extends JCExpression implements MethodInvocationTree {
1321 public List<JCExpression> typeargs;
1322 public JCExpression meth;
1323 public List<JCExpression> args;
1324 public Type varargsElement;
1325 protected JCMethodInvocation(List<JCExpression> typeargs,
1326 JCExpression meth,
1327 List<JCExpression> args)
1328 {
1329 this.typeargs = (typeargs == null) ? List.<JCExpression>nil()
1330 : typeargs;
1331 this.meth = meth;
1332 this.args = args;
1333 }
1334 @Override
1335 public void accept(Visitor v) { v.visitApply(this); }
1337 public Kind getKind() { return Kind.METHOD_INVOCATION; }
1338 public List<JCExpression> getTypeArguments() {
1339 return typeargs;
1340 }
1341 public JCExpression getMethodSelect() { return meth; }
1342 public List<JCExpression> getArguments() {
1343 return args;
1344 }
1345 @Override
1346 public <R,D> R accept(TreeVisitor<R,D> v, D d) {
1347 return v.visitMethodInvocation(this, d);
1348 }
1349 @Override
1350 public JCMethodInvocation setType(Type type) {
1351 super.setType(type);
1352 return this;
1353 }
1354 @Override
1355 public int getTag() {
1356 return(APPLY);
1357 }
1358 }
1360 /**
1361 * A new(...) operation.
1362 */
1363 public static class JCNewClass extends JCExpression implements NewClassTree {
1364 public JCExpression encl;
1365 public List<JCExpression> typeargs;
1366 public JCExpression clazz;
1367 public List<JCExpression> args;
1368 public JCClassDecl def;
1369 public Symbol constructor;
1370 public Type varargsElement;
1371 public Type constructorType;
1372 protected JCNewClass(JCExpression encl,
1373 List<JCExpression> typeargs,
1374 JCExpression clazz,
1375 List<JCExpression> args,
1376 JCClassDecl def)
1377 {
1378 this.encl = encl;
1379 this.typeargs = (typeargs == null) ? List.<JCExpression>nil()
1380 : typeargs;
1381 this.clazz = clazz;
1382 this.args = args;
1383 this.def = def;
1384 }
1385 @Override
1386 public void accept(Visitor v) { v.visitNewClass(this); }
1388 public Kind getKind() { return Kind.NEW_CLASS; }
1389 public JCExpression getEnclosingExpression() { // expr.new C< ... > ( ... )
1390 return encl;
1391 }
1392 public List<JCExpression> getTypeArguments() {
1393 return typeargs;
1394 }
1395 public JCExpression getIdentifier() { return clazz; }
1396 public List<JCExpression> getArguments() {
1397 return args;
1398 }
1399 public JCClassDecl getClassBody() { return def; }
1400 @Override
1401 public <R,D> R accept(TreeVisitor<R,D> v, D d) {
1402 return v.visitNewClass(this, d);
1403 }
1404 @Override
1405 public int getTag() {
1406 return NEWCLASS;
1407 }
1408 }
1410 /**
1411 * A new[...] operation.
1412 */
1413 public static class JCNewArray extends JCExpression implements NewArrayTree {
1414 public JCExpression elemtype;
1415 public List<JCExpression> dims;
1416 public List<JCExpression> elems;
1417 protected JCNewArray(JCExpression elemtype,
1418 List<JCExpression> dims,
1419 List<JCExpression> elems)
1420 {
1421 this.elemtype = elemtype;
1422 this.dims = dims;
1423 this.elems = elems;
1424 }
1425 @Override
1426 public void accept(Visitor v) { v.visitNewArray(this); }
1428 public Kind getKind() { return Kind.NEW_ARRAY; }
1429 public JCExpression getType() { return elemtype; }
1430 public List<JCExpression> getDimensions() {
1431 return dims;
1432 }
1433 public List<JCExpression> getInitializers() {
1434 return elems;
1435 }
1436 @Override
1437 public <R,D> R accept(TreeVisitor<R,D> v, D d) {
1438 return v.visitNewArray(this, d);
1439 }
1440 @Override
1441 public int getTag() {
1442 return NEWARRAY;
1443 }
1444 }
1446 /**
1447 * A parenthesized subexpression ( ... )
1448 */
1449 public static class JCParens extends JCExpression implements ParenthesizedTree {
1450 public JCExpression expr;
1451 protected JCParens(JCExpression expr) {
1452 this.expr = expr;
1453 }
1454 @Override
1455 public void accept(Visitor v) { v.visitParens(this); }
1457 public Kind getKind() { return Kind.PARENTHESIZED; }
1458 public JCExpression getExpression() { return expr; }
1459 @Override
1460 public <R,D> R accept(TreeVisitor<R,D> v, D d) {
1461 return v.visitParenthesized(this, d);
1462 }
1463 @Override
1464 public int getTag() {
1465 return PARENS;
1466 }
1467 }
1469 /**
1470 * A assignment with "=".
1471 */
1472 public static class JCAssign extends JCExpression implements AssignmentTree {
1473 public JCExpression lhs;
1474 public JCExpression rhs;
1475 protected JCAssign(JCExpression lhs, JCExpression rhs) {
1476 this.lhs = lhs;
1477 this.rhs = rhs;
1478 }
1479 @Override
1480 public void accept(Visitor v) { v.visitAssign(this); }
1482 public Kind getKind() { return Kind.ASSIGNMENT; }
1483 public JCExpression getVariable() { return lhs; }
1484 public JCExpression getExpression() { return rhs; }
1485 @Override
1486 public <R,D> R accept(TreeVisitor<R,D> v, D d) {
1487 return v.visitAssignment(this, d);
1488 }
1489 @Override
1490 public int getTag() {
1491 return ASSIGN;
1492 }
1493 }
1495 /**
1496 * An assignment with "+=", "|=" ...
1497 */
1498 public static class JCAssignOp extends JCExpression implements CompoundAssignmentTree {
1499 private int opcode;
1500 public JCExpression lhs;
1501 public JCExpression rhs;
1502 public Symbol operator;
1503 protected JCAssignOp(int opcode, JCTree lhs, JCTree rhs, Symbol operator) {
1504 this.opcode = opcode;
1505 this.lhs = (JCExpression)lhs;
1506 this.rhs = (JCExpression)rhs;
1507 this.operator = operator;
1508 }
1509 @Override
1510 public void accept(Visitor v) { v.visitAssignop(this); }
1512 public Kind getKind() { return TreeInfo.tagToKind(getTag()); }
1513 public JCExpression getVariable() { return lhs; }
1514 public JCExpression getExpression() { return rhs; }
1515 public Symbol getOperator() {
1516 return operator;
1517 }
1518 @Override
1519 public <R,D> R accept(TreeVisitor<R,D> v, D d) {
1520 return v.visitCompoundAssignment(this, d);
1521 }
1522 @Override
1523 public int getTag() {
1524 return opcode;
1525 }
1526 }
1528 /**
1529 * A unary operation.
1530 */
1531 public static class JCUnary extends JCExpression implements UnaryTree {
1532 private int opcode;
1533 public JCExpression arg;
1534 public Symbol operator;
1535 protected JCUnary(int opcode, JCExpression arg) {
1536 this.opcode = opcode;
1537 this.arg = arg;
1538 }
1539 @Override
1540 public void accept(Visitor v) { v.visitUnary(this); }
1542 public Kind getKind() { return TreeInfo.tagToKind(getTag()); }
1543 public JCExpression getExpression() { return arg; }
1544 public Symbol getOperator() {
1545 return operator;
1546 }
1547 @Override
1548 public <R,D> R accept(TreeVisitor<R,D> v, D d) {
1549 return v.visitUnary(this, d);
1550 }
1551 @Override
1552 public int getTag() {
1553 return opcode;
1554 }
1556 public void setTag(int tag) {
1557 opcode = tag;
1558 }
1559 }
1561 /**
1562 * A binary operation.
1563 */
1564 public static class JCBinary extends JCExpression implements BinaryTree {
1565 private int opcode;
1566 public JCExpression lhs;
1567 public JCExpression rhs;
1568 public Symbol operator;
1569 protected JCBinary(int opcode,
1570 JCExpression lhs,
1571 JCExpression rhs,
1572 Symbol operator) {
1573 this.opcode = opcode;
1574 this.lhs = lhs;
1575 this.rhs = rhs;
1576 this.operator = operator;
1577 }
1578 @Override
1579 public void accept(Visitor v) { v.visitBinary(this); }
1581 public Kind getKind() { return TreeInfo.tagToKind(getTag()); }
1582 public JCExpression getLeftOperand() { return lhs; }
1583 public JCExpression getRightOperand() { return rhs; }
1584 public Symbol getOperator() {
1585 return operator;
1586 }
1587 @Override
1588 public <R,D> R accept(TreeVisitor<R,D> v, D d) {
1589 return v.visitBinary(this, d);
1590 }
1591 @Override
1592 public int getTag() {
1593 return opcode;
1594 }
1595 }
1597 /**
1598 * A type cast.
1599 */
1600 public static class JCTypeCast extends JCExpression implements TypeCastTree {
1601 public JCTree clazz;
1602 public JCExpression expr;
1603 protected JCTypeCast(JCTree clazz, JCExpression expr) {
1604 this.clazz = clazz;
1605 this.expr = expr;
1606 }
1607 @Override
1608 public void accept(Visitor v) { v.visitTypeCast(this); }
1610 public Kind getKind() { return Kind.TYPE_CAST; }
1611 public JCTree getType() { return clazz; }
1612 public JCExpression getExpression() { return expr; }
1613 @Override
1614 public <R,D> R accept(TreeVisitor<R,D> v, D d) {
1615 return v.visitTypeCast(this, d);
1616 }
1617 @Override
1618 public int getTag() {
1619 return TYPECAST;
1620 }
1621 }
1623 /**
1624 * A type test.
1625 */
1626 public static class JCInstanceOf extends JCExpression implements InstanceOfTree {
1627 public JCExpression expr;
1628 public JCTree clazz;
1629 protected JCInstanceOf(JCExpression expr, JCTree clazz) {
1630 this.expr = expr;
1631 this.clazz = clazz;
1632 }
1633 @Override
1634 public void accept(Visitor v) { v.visitTypeTest(this); }
1636 public Kind getKind() { return Kind.INSTANCE_OF; }
1637 public JCTree getType() { return clazz; }
1638 public JCExpression getExpression() { return expr; }
1639 @Override
1640 public <R,D> R accept(TreeVisitor<R,D> v, D d) {
1641 return v.visitInstanceOf(this, d);
1642 }
1643 @Override
1644 public int getTag() {
1645 return TYPETEST;
1646 }
1647 }
1649 /**
1650 * An array selection
1651 */
1652 public static class JCArrayAccess extends JCExpression implements ArrayAccessTree {
1653 public JCExpression indexed;
1654 public JCExpression index;
1655 protected JCArrayAccess(JCExpression indexed, JCExpression index) {
1656 this.indexed = indexed;
1657 this.index = index;
1658 }
1659 @Override
1660 public void accept(Visitor v) { v.visitIndexed(this); }
1662 public Kind getKind() { return Kind.ARRAY_ACCESS; }
1663 public JCExpression getExpression() { return indexed; }
1664 public JCExpression getIndex() { return index; }
1665 @Override
1666 public <R,D> R accept(TreeVisitor<R,D> v, D d) {
1667 return v.visitArrayAccess(this, d);
1668 }
1669 @Override
1670 public int getTag() {
1671 return INDEXED;
1672 }
1673 }
1675 /**
1676 * Selects through packages and classes
1677 * @param selected selected Tree hierarchie
1678 * @param selector name of field to select thru
1679 * @param sym symbol of the selected class
1680 */
1681 public static class JCFieldAccess extends JCExpression implements MemberSelectTree {
1682 public JCExpression selected;
1683 public Name name;
1684 public Symbol sym;
1685 protected JCFieldAccess(JCExpression selected, Name name, Symbol sym) {
1686 this.selected = selected;
1687 this.name = name;
1688 this.sym = sym;
1689 }
1690 @Override
1691 public void accept(Visitor v) { v.visitSelect(this); }
1693 public Kind getKind() { return Kind.MEMBER_SELECT; }
1694 public JCExpression getExpression() { return selected; }
1695 @Override
1696 public <R,D> R accept(TreeVisitor<R,D> v, D d) {
1697 return v.visitMemberSelect(this, d);
1698 }
1699 public Name getIdentifier() { return name; }
1700 @Override
1701 public int getTag() {
1702 return SELECT;
1703 }
1704 }
1706 /**
1707 * An identifier
1708 * @param idname the name
1709 * @param sym the symbol
1710 */
1711 public static class JCIdent extends JCExpression implements IdentifierTree {
1712 public Name name;
1713 public Symbol sym;
1714 protected JCIdent(Name name, Symbol sym) {
1715 this.name = name;
1716 this.sym = sym;
1717 }
1718 @Override
1719 public void accept(Visitor v) { v.visitIdent(this); }
1721 public Kind getKind() { return Kind.IDENTIFIER; }
1722 public Name getName() { return name; }
1723 @Override
1724 public <R,D> R accept(TreeVisitor<R,D> v, D d) {
1725 return v.visitIdentifier(this, d);
1726 }
1727 public int getTag() {
1728 return IDENT;
1729 }
1730 }
1732 /**
1733 * A constant value given literally.
1734 * @param value value representation
1735 */
1736 public static class JCLiteral extends JCExpression implements LiteralTree {
1737 public int typetag;
1738 public Object value;
1739 protected JCLiteral(int typetag, Object value) {
1740 this.typetag = typetag;
1741 this.value = value;
1742 }
1743 @Override
1744 public void accept(Visitor v) { v.visitLiteral(this); }
1746 public Kind getKind() {
1747 switch (typetag) {
1748 case TypeTags.INT:
1749 return Kind.INT_LITERAL;
1750 case TypeTags.LONG:
1751 return Kind.LONG_LITERAL;
1752 case TypeTags.FLOAT:
1753 return Kind.FLOAT_LITERAL;
1754 case TypeTags.DOUBLE:
1755 return Kind.DOUBLE_LITERAL;
1756 case TypeTags.BOOLEAN:
1757 return Kind.BOOLEAN_LITERAL;
1758 case TypeTags.CHAR:
1759 return Kind.CHAR_LITERAL;
1760 case TypeTags.CLASS:
1761 return Kind.STRING_LITERAL;
1762 case TypeTags.BOT:
1763 return Kind.NULL_LITERAL;
1764 default:
1765 throw new AssertionError("unknown literal kind " + this);
1766 }
1767 }
1768 public Object getValue() {
1769 switch (typetag) {
1770 case TypeTags.BOOLEAN:
1771 int bi = (Integer) value;
1772 return (bi != 0);
1773 case TypeTags.CHAR:
1774 int ci = (Integer) value;
1775 char c = (char) ci;
1776 if (c != ci)
1777 throw new AssertionError("bad value for char literal");
1778 return c;
1779 default:
1780 return value;
1781 }
1782 }
1783 @Override
1784 public <R,D> R accept(TreeVisitor<R,D> v, D d) {
1785 return v.visitLiteral(this, d);
1786 }
1787 @Override
1788 public JCLiteral setType(Type type) {
1789 super.setType(type);
1790 return this;
1791 }
1792 @Override
1793 public int getTag() {
1794 return LITERAL;
1795 }
1796 }
1798 /**
1799 * Identifies a basic type.
1800 * @param tag the basic type id
1801 * @see TypeTags
1802 */
1803 public static class JCPrimitiveTypeTree extends JCExpression implements PrimitiveTypeTree {
1804 public int typetag;
1805 protected JCPrimitiveTypeTree(int typetag) {
1806 this.typetag = typetag;
1807 }
1808 @Override
1809 public void accept(Visitor v) { v.visitTypeIdent(this); }
1811 public Kind getKind() { return Kind.PRIMITIVE_TYPE; }
1812 public TypeKind getPrimitiveTypeKind() {
1813 switch (typetag) {
1814 case TypeTags.BOOLEAN:
1815 return TypeKind.BOOLEAN;
1816 case TypeTags.BYTE:
1817 return TypeKind.BYTE;
1818 case TypeTags.SHORT:
1819 return TypeKind.SHORT;
1820 case TypeTags.INT:
1821 return TypeKind.INT;
1822 case TypeTags.LONG:
1823 return TypeKind.LONG;
1824 case TypeTags.CHAR:
1825 return TypeKind.CHAR;
1826 case TypeTags.FLOAT:
1827 return TypeKind.FLOAT;
1828 case TypeTags.DOUBLE:
1829 return TypeKind.DOUBLE;
1830 case TypeTags.VOID:
1831 return TypeKind.VOID;
1832 default:
1833 throw new AssertionError("unknown primitive type " + this);
1834 }
1835 }
1836 @Override
1837 public <R,D> R accept(TreeVisitor<R,D> v, D d) {
1838 return v.visitPrimitiveType(this, d);
1839 }
1840 @Override
1841 public int getTag() {
1842 return TYPEIDENT;
1843 }
1844 }
1846 /**
1847 * An array type, A[]
1848 */
1849 public static class JCArrayTypeTree extends JCExpression implements ArrayTypeTree {
1850 public JCExpression elemtype;
1851 protected JCArrayTypeTree(JCExpression elemtype) {
1852 this.elemtype = elemtype;
1853 }
1854 @Override
1855 public void accept(Visitor v) { v.visitTypeArray(this); }
1857 public Kind getKind() { return Kind.ARRAY_TYPE; }
1858 public JCTree getType() { return elemtype; }
1859 @Override
1860 public <R,D> R accept(TreeVisitor<R,D> v, D d) {
1861 return v.visitArrayType(this, d);
1862 }
1863 @Override
1864 public int getTag() {
1865 return TYPEARRAY;
1866 }
1867 }
1869 /**
1870 * A parameterized type, T<...>
1871 */
1872 public static class JCTypeApply extends JCExpression implements ParameterizedTypeTree {
1873 public JCExpression clazz;
1874 public List<JCExpression> arguments;
1875 protected JCTypeApply(JCExpression clazz, List<JCExpression> arguments) {
1876 this.clazz = clazz;
1877 this.arguments = arguments;
1878 }
1879 @Override
1880 public void accept(Visitor v) { v.visitTypeApply(this); }
1882 public Kind getKind() { return Kind.PARAMETERIZED_TYPE; }
1883 public JCTree getType() { return clazz; }
1884 public List<JCExpression> getTypeArguments() {
1885 return arguments;
1886 }
1887 @Override
1888 public <R,D> R accept(TreeVisitor<R,D> v, D d) {
1889 return v.visitParameterizedType(this, d);
1890 }
1891 @Override
1892 public int getTag() {
1893 return TYPEAPPLY;
1894 }
1895 }
1897 /**
1898 * A union type, T1 | T2 | ... Tn (used in multicatch statements)
1899 */
1900 public static class JCTypeUnion extends JCExpression implements UnionTypeTree {
1902 public List<JCExpression> alternatives;
1904 protected JCTypeUnion(List<JCExpression> components) {
1905 this.alternatives = components;
1906 }
1907 @Override
1908 public void accept(Visitor v) { v.visitTypeUnion(this); }
1910 public Kind getKind() { return Kind.UNION_TYPE; }
1912 public List<JCExpression> getTypeAlternatives() {
1913 return alternatives;
1914 }
1915 @Override
1916 public <R,D> R accept(TreeVisitor<R,D> v, D d) {
1917 return v.visitUnionType(this, d);
1918 }
1919 @Override
1920 public int getTag() {
1921 return TYPEUNION;
1922 }
1923 }
1925 /**
1926 * A formal class parameter.
1927 * @param name name
1928 * @param bounds bounds
1929 */
1930 public static class JCTypeParameter extends JCTree implements TypeParameterTree {
1931 public Name name;
1932 public List<JCExpression> bounds;
1933 protected JCTypeParameter(Name name, List<JCExpression> bounds) {
1934 this.name = name;
1935 this.bounds = bounds;
1936 }
1937 @Override
1938 public void accept(Visitor v) { v.visitTypeParameter(this); }
1940 public Kind getKind() { return Kind.TYPE_PARAMETER; }
1941 public Name getName() { return name; }
1942 public List<JCExpression> getBounds() {
1943 return bounds;
1944 }
1945 @Override
1946 public <R,D> R accept(TreeVisitor<R,D> v, D d) {
1947 return v.visitTypeParameter(this, d);
1948 }
1949 @Override
1950 public int getTag() {
1951 return TYPEPARAMETER;
1952 }
1953 }
1955 public static class JCWildcard extends JCExpression implements WildcardTree {
1956 public TypeBoundKind kind;
1957 public JCTree inner;
1958 protected JCWildcard(TypeBoundKind kind, JCTree inner) {
1959 kind.getClass(); // null-check
1960 this.kind = kind;
1961 this.inner = inner;
1962 }
1963 @Override
1964 public void accept(Visitor v) { v.visitWildcard(this); }
1966 public Kind getKind() {
1967 switch (kind.kind) {
1968 case UNBOUND:
1969 return Kind.UNBOUNDED_WILDCARD;
1970 case EXTENDS:
1971 return Kind.EXTENDS_WILDCARD;
1972 case SUPER:
1973 return Kind.SUPER_WILDCARD;
1974 default:
1975 throw new AssertionError("Unknown wildcard bound " + kind);
1976 }
1977 }
1978 public JCTree getBound() { return inner; }
1979 @Override
1980 public <R,D> R accept(TreeVisitor<R,D> v, D d) {
1981 return v.visitWildcard(this, d);
1982 }
1983 @Override
1984 public int getTag() {
1985 return WILDCARD;
1986 }
1987 }
1989 public static class TypeBoundKind extends JCTree {
1990 public BoundKind kind;
1991 protected TypeBoundKind(BoundKind kind) {
1992 this.kind = kind;
1993 }
1994 @Override
1995 public void accept(Visitor v) { v.visitTypeBoundKind(this); }
1997 public Kind getKind() {
1998 throw new AssertionError("TypeBoundKind is not part of a public API");
1999 }
2000 @Override
2001 public <R,D> R accept(TreeVisitor<R,D> v, D d) {
2002 throw new AssertionError("TypeBoundKind is not part of a public API");
2003 }
2004 @Override
2005 public int getTag() {
2006 return TYPEBOUNDKIND;
2007 }
2008 }
2010 public static class JCAnnotation extends JCExpression implements AnnotationTree {
2011 public JCTree annotationType;
2012 public List<JCExpression> args;
2013 protected JCAnnotation(JCTree annotationType, List<JCExpression> args) {
2014 this.annotationType = annotationType;
2015 this.args = args;
2016 }
2017 @Override
2018 public void accept(Visitor v) { v.visitAnnotation(this); }
2020 public Kind getKind() { return Kind.ANNOTATION; }
2021 public JCTree getAnnotationType() { return annotationType; }
2022 public List<JCExpression> getArguments() {
2023 return args;
2024 }
2025 @Override
2026 public <R,D> R accept(TreeVisitor<R,D> v, D d) {
2027 return v.visitAnnotation(this, d);
2028 }
2029 @Override
2030 public int getTag() {
2031 return ANNOTATION;
2032 }
2033 }
2035 public static class JCModifiers extends JCTree implements com.sun.source.tree.ModifiersTree {
2036 public long flags;
2037 public List<JCAnnotation> annotations;
2038 protected JCModifiers(long flags, List<JCAnnotation> annotations) {
2039 this.flags = flags;
2040 this.annotations = annotations;
2041 }
2042 @Override
2043 public void accept(Visitor v) { v.visitModifiers(this); }
2045 public Kind getKind() { return Kind.MODIFIERS; }
2046 public Set<Modifier> getFlags() {
2047 return Flags.asModifierSet(flags);
2048 }
2049 public List<JCAnnotation> getAnnotations() {
2050 return annotations;
2051 }
2052 @Override
2053 public <R,D> R accept(TreeVisitor<R,D> v, D d) {
2054 return v.visitModifiers(this, d);
2055 }
2056 @Override
2057 public int getTag() {
2058 return MODIFIERS;
2059 }
2060 }
2062 public static class JCErroneous extends JCExpression
2063 implements com.sun.source.tree.ErroneousTree {
2064 public List<? extends JCTree> errs;
2065 protected JCErroneous(List<? extends JCTree> errs) {
2066 this.errs = errs;
2067 }
2068 @Override
2069 public void accept(Visitor v) { v.visitErroneous(this); }
2071 public Kind getKind() { return Kind.ERRONEOUS; }
2073 public List<? extends JCTree> getErrorTrees() {
2074 return errs;
2075 }
2077 @Override
2078 public <R,D> R accept(TreeVisitor<R,D> v, D d) {
2079 return v.visitErroneous(this, d);
2080 }
2081 @Override
2082 public int getTag() {
2083 return ERRONEOUS;
2084 }
2085 }
2087 /** (let int x = 3; in x+2) */
2088 public static class LetExpr extends JCExpression {
2089 public List<JCVariableDecl> defs;
2090 public JCTree expr;
2091 protected LetExpr(List<JCVariableDecl> defs, JCTree expr) {
2092 this.defs = defs;
2093 this.expr = expr;
2094 }
2095 @Override
2096 public void accept(Visitor v) { v.visitLetExpr(this); }
2098 public Kind getKind() {
2099 throw new AssertionError("LetExpr is not part of a public API");
2100 }
2101 @Override
2102 public <R,D> R accept(TreeVisitor<R,D> v, D d) {
2103 throw new AssertionError("LetExpr is not part of a public API");
2104 }
2105 @Override
2106 public int getTag() {
2107 return LETEXPR;
2108 }
2109 }
2111 /** An interface for tree factories
2112 */
2113 public interface Factory {
2114 JCCompilationUnit TopLevel(List<JCAnnotation> packageAnnotations,
2115 JCExpression pid,
2116 List<JCTree> defs);
2117 JCImport Import(JCTree qualid, boolean staticImport);
2118 JCClassDecl ClassDef(JCModifiers mods,
2119 Name name,
2120 List<JCTypeParameter> typarams,
2121 JCExpression extending,
2122 List<JCExpression> implementing,
2123 List<JCTree> defs);
2124 JCMethodDecl MethodDef(JCModifiers mods,
2125 Name name,
2126 JCExpression restype,
2127 List<JCTypeParameter> typarams,
2128 List<JCVariableDecl> params,
2129 List<JCExpression> thrown,
2130 JCBlock body,
2131 JCExpression defaultValue);
2132 JCVariableDecl VarDef(JCModifiers mods,
2133 Name name,
2134 JCExpression vartype,
2135 JCExpression init);
2136 JCSkip Skip();
2137 JCBlock Block(long flags, List<JCStatement> stats);
2138 JCDoWhileLoop DoLoop(JCStatement body, JCExpression cond);
2139 JCWhileLoop WhileLoop(JCExpression cond, JCStatement body);
2140 JCForLoop ForLoop(List<JCStatement> init,
2141 JCExpression cond,
2142 List<JCExpressionStatement> step,
2143 JCStatement body);
2144 JCEnhancedForLoop ForeachLoop(JCVariableDecl var, JCExpression expr, JCStatement body);
2145 JCLabeledStatement Labelled(Name label, JCStatement body);
2146 JCSwitch Switch(JCExpression selector, List<JCCase> cases);
2147 JCCase Case(JCExpression pat, List<JCStatement> stats);
2148 JCSynchronized Synchronized(JCExpression lock, JCBlock body);
2149 JCTry Try(JCBlock body, List<JCCatch> catchers, JCBlock finalizer);
2150 JCTry Try(List<JCTree> resources,
2151 JCBlock body,
2152 List<JCCatch> catchers,
2153 JCBlock finalizer);
2154 JCCatch Catch(JCVariableDecl param, JCBlock body);
2155 JCConditional Conditional(JCExpression cond,
2156 JCExpression thenpart,
2157 JCExpression elsepart);
2158 JCIf If(JCExpression cond, JCStatement thenpart, JCStatement elsepart);
2159 JCExpressionStatement Exec(JCExpression expr);
2160 JCBreak Break(Name label);
2161 JCContinue Continue(Name label);
2162 JCReturn Return(JCExpression expr);
2163 JCThrow Throw(JCTree expr);
2164 JCAssert Assert(JCExpression cond, JCExpression detail);
2165 JCMethodInvocation Apply(List<JCExpression> typeargs,
2166 JCExpression fn,
2167 List<JCExpression> args);
2168 JCNewClass NewClass(JCExpression encl,
2169 List<JCExpression> typeargs,
2170 JCExpression clazz,
2171 List<JCExpression> args,
2172 JCClassDecl def);
2173 JCNewArray NewArray(JCExpression elemtype,
2174 List<JCExpression> dims,
2175 List<JCExpression> elems);
2176 JCParens Parens(JCExpression expr);
2177 JCAssign Assign(JCExpression lhs, JCExpression rhs);
2178 JCAssignOp Assignop(int opcode, JCTree lhs, JCTree rhs);
2179 JCUnary Unary(int opcode, JCExpression arg);
2180 JCBinary Binary(int opcode, JCExpression lhs, JCExpression rhs);
2181 JCTypeCast TypeCast(JCTree expr, JCExpression type);
2182 JCInstanceOf TypeTest(JCExpression expr, JCTree clazz);
2183 JCArrayAccess Indexed(JCExpression indexed, JCExpression index);
2184 JCFieldAccess Select(JCExpression selected, Name selector);
2185 JCIdent Ident(Name idname);
2186 JCLiteral Literal(int tag, Object value);
2187 JCPrimitiveTypeTree TypeIdent(int typetag);
2188 JCArrayTypeTree TypeArray(JCExpression elemtype);
2189 JCTypeApply TypeApply(JCExpression clazz, List<JCExpression> arguments);
2190 JCTypeParameter TypeParameter(Name name, List<JCExpression> bounds);
2191 JCWildcard Wildcard(TypeBoundKind kind, JCTree type);
2192 TypeBoundKind TypeBoundKind(BoundKind kind);
2193 JCAnnotation Annotation(JCTree annotationType, List<JCExpression> args);
2194 JCModifiers Modifiers(long flags, List<JCAnnotation> annotations);
2195 JCErroneous Erroneous(List<? extends JCTree> errs);
2196 LetExpr LetExpr(List<JCVariableDecl> defs, JCTree expr);
2197 }
2199 /** A generic visitor class for trees.
2200 */
2201 public static abstract class Visitor {
2202 public void visitTopLevel(JCCompilationUnit that) { visitTree(that); }
2203 public void visitImport(JCImport that) { visitTree(that); }
2204 public void visitClassDef(JCClassDecl that) { visitTree(that); }
2205 public void visitMethodDef(JCMethodDecl that) { visitTree(that); }
2206 public void visitVarDef(JCVariableDecl that) { visitTree(that); }
2207 public void visitSkip(JCSkip that) { visitTree(that); }
2208 public void visitBlock(JCBlock that) { visitTree(that); }
2209 public void visitDoLoop(JCDoWhileLoop that) { visitTree(that); }
2210 public void visitWhileLoop(JCWhileLoop that) { visitTree(that); }
2211 public void visitForLoop(JCForLoop that) { visitTree(that); }
2212 public void visitForeachLoop(JCEnhancedForLoop that) { visitTree(that); }
2213 public void visitLabelled(JCLabeledStatement that) { visitTree(that); }
2214 public void visitSwitch(JCSwitch that) { visitTree(that); }
2215 public void visitCase(JCCase that) { visitTree(that); }
2216 public void visitSynchronized(JCSynchronized that) { visitTree(that); }
2217 public void visitTry(JCTry that) { visitTree(that); }
2218 public void visitCatch(JCCatch that) { visitTree(that); }
2219 public void visitConditional(JCConditional that) { visitTree(that); }
2220 public void visitIf(JCIf that) { visitTree(that); }
2221 public void visitExec(JCExpressionStatement that) { visitTree(that); }
2222 public void visitBreak(JCBreak that) { visitTree(that); }
2223 public void visitContinue(JCContinue that) { visitTree(that); }
2224 public void visitReturn(JCReturn that) { visitTree(that); }
2225 public void visitThrow(JCThrow that) { visitTree(that); }
2226 public void visitAssert(JCAssert that) { visitTree(that); }
2227 public void visitApply(JCMethodInvocation that) { visitTree(that); }
2228 public void visitNewClass(JCNewClass that) { visitTree(that); }
2229 public void visitNewArray(JCNewArray that) { visitTree(that); }
2230 public void visitParens(JCParens that) { visitTree(that); }
2231 public void visitAssign(JCAssign that) { visitTree(that); }
2232 public void visitAssignop(JCAssignOp that) { visitTree(that); }
2233 public void visitUnary(JCUnary that) { visitTree(that); }
2234 public void visitBinary(JCBinary that) { visitTree(that); }
2235 public void visitTypeCast(JCTypeCast that) { visitTree(that); }
2236 public void visitTypeTest(JCInstanceOf that) { visitTree(that); }
2237 public void visitIndexed(JCArrayAccess that) { visitTree(that); }
2238 public void visitSelect(JCFieldAccess that) { visitTree(that); }
2239 public void visitIdent(JCIdent that) { visitTree(that); }
2240 public void visitLiteral(JCLiteral that) { visitTree(that); }
2241 public void visitTypeIdent(JCPrimitiveTypeTree that) { visitTree(that); }
2242 public void visitTypeArray(JCArrayTypeTree that) { visitTree(that); }
2243 public void visitTypeApply(JCTypeApply that) { visitTree(that); }
2244 public void visitTypeUnion(JCTypeUnion that) { visitTree(that); }
2245 public void visitTypeParameter(JCTypeParameter that) { visitTree(that); }
2246 public void visitWildcard(JCWildcard that) { visitTree(that); }
2247 public void visitTypeBoundKind(TypeBoundKind that) { visitTree(that); }
2248 public void visitAnnotation(JCAnnotation that) { visitTree(that); }
2249 public void visitModifiers(JCModifiers that) { visitTree(that); }
2250 public void visitErroneous(JCErroneous that) { visitTree(that); }
2251 public void visitLetExpr(LetExpr that) { visitTree(that); }
2253 public void visitTree(JCTree that) { Assert.error(); }
2254 }
2256 }