src/share/classes/com/sun/tools/javac/tree/JCTree.java
Print this page
*** 77,333 ****
* @see Pretty
*/
public abstract class JCTree implements Tree, Cloneable, DiagnosticPosition {
/* Tree tag values, identifying kinds of trees */
/** Toplevel nodes, of type TopLevel, representing entire source files.
*/
! public static final int TOPLEVEL = 1;
/** Import clauses, of type Import.
*/
! public static final int IMPORT = TOPLEVEL + 1;
/** Class definitions, of type ClassDef.
*/
! public static final int CLASSDEF = IMPORT + 1;
/** Method definitions, of type MethodDef.
*/
! public static final int METHODDEF = CLASSDEF + 1;
/** Variable definitions, of type VarDef.
*/
! public static final int VARDEF = METHODDEF + 1;
/** The no-op statement ";", of type Skip
*/
! public static final int SKIP = VARDEF + 1;
/** Blocks, of type Block.
*/
! public static final int BLOCK = SKIP + 1;
/** Do-while loops, of type DoLoop.
*/
! public static final int DOLOOP = BLOCK + 1;
/** While-loops, of type WhileLoop.
*/
! public static final int WHILELOOP = DOLOOP + 1;
/** For-loops, of type ForLoop.
*/
! public static final int FORLOOP = WHILELOOP + 1;
/** Foreach-loops, of type ForeachLoop.
*/
! public static final int FOREACHLOOP = FORLOOP + 1;
/** Labelled statements, of type Labelled.
*/
! public static final int LABELLED = FOREACHLOOP + 1;
/** Switch statements, of type Switch.
*/
! public static final int SWITCH = LABELLED + 1;
/** Case parts in switch statements, of type Case.
*/
! public static final int CASE = SWITCH + 1;
/** Synchronized statements, of type Synchonized.
*/
! public static final int SYNCHRONIZED = CASE + 1;
/** Try statements, of type Try.
*/
! public static final int TRY = SYNCHRONIZED + 1;
/** Catch clauses in try statements, of type Catch.
*/
! public static final int CATCH = TRY + 1;
/** Conditional expressions, of type Conditional.
*/
! public static final int CONDEXPR = CATCH + 1;
/** Conditional statements, of type If.
*/
! public static final int IF = CONDEXPR + 1;
/** Expression statements, of type Exec.
*/
! public static final int EXEC = IF + 1;
/** Break statements, of type Break.
*/
! public static final int BREAK = EXEC + 1;
/** Continue statements, of type Continue.
*/
! public static final int CONTINUE = BREAK + 1;
/** Return statements, of type Return.
*/
! public static final int RETURN = CONTINUE + 1;
/** Throw statements, of type Throw.
*/
! public static final int THROW = RETURN + 1;
/** Assert statements, of type Assert.
*/
! public static final int ASSERT = THROW + 1;
/** Method invocation expressions, of type Apply.
*/
! public static final int APPLY = ASSERT + 1;
/** Class instance creation expressions, of type NewClass.
*/
! public static final int NEWCLASS = APPLY + 1;
/** Array creation expressions, of type NewArray.
*/
! public static final int NEWARRAY = NEWCLASS + 1;
/** Parenthesized subexpressions, of type Parens.
*/
! public static final int PARENS = NEWARRAY + 1;
/** Assignment expressions, of type Assign.
*/
! public static final int ASSIGN = PARENS + 1;
/** Type cast expressions, of type TypeCast.
*/
! public static final int TYPECAST = ASSIGN + 1;
/** Type test expressions, of type TypeTest.
*/
! public static final int TYPETEST = TYPECAST + 1;
/** Indexed array expressions, of type Indexed.
*/
! public static final int INDEXED = TYPETEST + 1;
/** Selections, of type Select.
*/
! public static final int SELECT = INDEXED + 1;
/** Simple identifiers, of type Ident.
*/
! public static final int IDENT = SELECT + 1;
/** Literals, of type Literal.
*/
! public static final int LITERAL = IDENT + 1;
/** Basic type identifiers, of type TypeIdent.
*/
! public static final int TYPEIDENT = LITERAL + 1;
/** Array types, of type TypeArray.
*/
! public static final int TYPEARRAY = TYPEIDENT + 1;
/** Parameterized types, of type TypeApply.
*/
! public static final int TYPEAPPLY = TYPEARRAY + 1;
/** Union types, of type TypeUnion
*/
! public static final int TYPEUNION = TYPEAPPLY + 1;
/** Formal type parameters, of type TypeParameter.
*/
! public static final int TYPEPARAMETER = TYPEUNION + 1;
/** Type argument.
*/
! public static final int WILDCARD = TYPEPARAMETER + 1;
/** Bound kind: extends, super, exact, or unbound
*/
! public static final int TYPEBOUNDKIND = WILDCARD + 1;
/** metadata: Annotation.
*/
! public static final int ANNOTATION = TYPEBOUNDKIND + 1;
/** metadata: Modifiers
*/
! public static final int MODIFIERS = ANNOTATION + 1;
! public static final int ANNOTATED_TYPE = MODIFIERS + 1;
/** Error trees, of type Erroneous.
*/
! public static final int ERRONEOUS = ANNOTATED_TYPE + 1;
/** Unary operators, of type Unary.
*/
! public static final int POS = ERRONEOUS + 1; // +
! public static final int NEG = POS + 1; // -
! public static final int NOT = NEG + 1; // !
! public static final int COMPL = NOT + 1; // ~
! public static final int PREINC = COMPL + 1; // ++ _
! public static final int PREDEC = PREINC + 1; // -- _
! public static final int POSTINC = PREDEC + 1; // _ ++
! public static final int POSTDEC = POSTINC + 1; // _ --
/** unary operator for null reference checks, only used internally.
*/
! public static final int NULLCHK = POSTDEC + 1;
/** Binary operators, of type Binary.
*/
! public static final int OR = NULLCHK + 1; // ||
! public static final int AND = OR + 1; // &&
! public static final int BITOR = AND + 1; // |
! public static final int BITXOR = BITOR + 1; // ^
! public static final int BITAND = BITXOR + 1; // &
! public static final int EQ = BITAND + 1; // ==
! public static final int NE = EQ + 1; // !=
! public static final int LT = NE + 1; // <
! public static final int GT = LT + 1; // >
! public static final int LE = GT + 1; // <=
! public static final int GE = LE + 1; // >=
! public static final int SL = GE + 1; // <<
! public static final int SR = SL + 1; // >>
! public static final int USR = SR + 1; // >>>
! public static final int PLUS = USR + 1; // +
! public static final int MINUS = PLUS + 1; // -
! public static final int MUL = MINUS + 1; // *
! public static final int DIV = MUL + 1; // /
! public static final int MOD = DIV + 1; // %
/** Assignment operators, of type Assignop.
*/
! public static final int BITOR_ASG = MOD + 1; // |=
! public static final int BITXOR_ASG = BITOR_ASG + 1; // ^=
! public static final int BITAND_ASG = BITXOR_ASG + 1; // &=
!
! public static final int SL_ASG = SL + BITOR_ASG - BITOR; // <<=
! public static final int SR_ASG = SL_ASG + 1; // >>=
! public static final int USR_ASG = SR_ASG + 1; // >>>=
! public static final int PLUS_ASG = USR_ASG + 1; // +=
! public static final int MINUS_ASG = PLUS_ASG + 1; // -=
! public static final int MUL_ASG = MINUS_ASG + 1; // *=
! public static final int DIV_ASG = MUL_ASG + 1; // /=
! public static final int MOD_ASG = DIV_ASG + 1; // %=
/** A synthetic let expression, of type LetExpr.
*/
! public static final int LETEXPR = MOD_ASG + 1; // ala scheme
/** The offset between assignment operators and normal operators.
*/
! public static final int ASGOffset = BITOR_ASG - BITOR;
/* The (encoded) position in the source file. @see util.Position.
*/
public int pos;
--- 77,355 ----
* @see Pretty
*/
public abstract class JCTree implements Tree, Cloneable, DiagnosticPosition {
/* Tree tag values, identifying kinds of trees */
+ public enum Tag{
+ /** For methods that return an invalid tag if a given condition is not met
+ */
+ NO_TAG,
/** Toplevel nodes, of type TopLevel, representing entire source files.
*/
! TOPLEVEL,
/** Import clauses, of type Import.
*/
! IMPORT,
/** Class definitions, of type ClassDef.
*/
! CLASSDEF,
/** Method definitions, of type MethodDef.
*/
! METHODDEF,
/** Variable definitions, of type VarDef.
*/
! VARDEF,
/** The no-op statement ";", of type Skip
*/
! SKIP,
/** Blocks, of type Block.
*/
! BLOCK,
/** Do-while loops, of type DoLoop.
*/
! DOLOOP,
/** While-loops, of type WhileLoop.
*/
! WHILELOOP,
/** For-loops, of type ForLoop.
*/
! FORLOOP,
/** Foreach-loops, of type ForeachLoop.
*/
! FOREACHLOOP,
/** Labelled statements, of type Labelled.
*/
! LABELLED,
/** Switch statements, of type Switch.
*/
! SWITCH,
/** Case parts in switch statements, of type Case.
*/
! CASE,
/** Synchronized statements, of type Synchonized.
*/
! SYNCHRONIZED,
/** Try statements, of type Try.
*/
! TRY,
/** Catch clauses in try statements, of type Catch.
*/
! CATCH,
/** Conditional expressions, of type Conditional.
*/
! CONDEXPR,
/** Conditional statements, of type If.
*/
! IF,
/** Expression statements, of type Exec.
*/
! EXEC,
/** Break statements, of type Break.
*/
! BREAK,
/** Continue statements, of type Continue.
*/
! CONTINUE,
/** Return statements, of type Return.
*/
! RETURN,
/** Throw statements, of type Throw.
*/
! THROW,
/** Assert statements, of type Assert.
*/
! ASSERT,
/** Method invocation expressions, of type Apply.
*/
! APPLY,
/** Class instance creation expressions, of type NewClass.
*/
! NEWCLASS,
/** Array creation expressions, of type NewArray.
*/
! NEWARRAY,
/** Parenthesized subexpressions, of type Parens.
*/
! PARENS,
/** Assignment expressions, of type Assign.
*/
! ASSIGN,
/** Type cast expressions, of type TypeCast.
*/
! TYPECAST,
/** Type test expressions, of type TypeTest.
*/
! TYPETEST,
/** Indexed array expressions, of type Indexed.
*/
! INDEXED,
/** Selections, of type Select.
*/
! SELECT,
/** Simple identifiers, of type Ident.
*/
! IDENT,
/** Literals, of type Literal.
*/
! LITERAL,
/** Basic type identifiers, of type TypeIdent.
*/
! TYPEIDENT,
/** Array types, of type TypeArray.
*/
! TYPEARRAY,
/** Parameterized types, of type TypeApply.
*/
! TYPEAPPLY,
/** Union types, of type TypeUnion
*/
! TYPEUNION,
/** Formal type parameters, of type TypeParameter.
*/
! TYPEPARAMETER,
/** Type argument.
*/
! WILDCARD,
/** Bound kind: extends, super, exact, or unbound
*/
! TYPEBOUNDKIND,
/** metadata: Annotation.
*/
! ANNOTATION,
/** metadata: Modifiers
*/
! MODIFIERS,
! ANNOTATED_TYPE,
/** Error trees, of type Erroneous.
*/
! ERRONEOUS,
/** Unary operators, of type Unary.
*/
! POS, // +
! NEG, // -
! NOT, // !
! COMPL, // ~
! PREINC, // ++ _
! PREDEC, // -- _
! POSTINC, // _ ++
! POSTDEC, // _ --
/** unary operator for null reference checks, only used internally.
*/
! NULLCHK,
/** Binary operators, of type Binary.
*/
! OR, // ||
! AND, // &&
! BITOR, // |
! BITXOR, // ^
! BITAND, // &
! EQ, // ==
! NE, // !=
! LT, // <
! GT, // >
! LE, // <=
! GE, // >=
! SL, // <<
! SR, // >>
! USR, // >>>
! PLUS, // +
! MINUS, // -
! MUL, // *
! DIV, // /
! MOD, // %
/** Assignment operators, of type Assignop.
*/
! BITOR_ASG(BITOR), // |=
! BITXOR_ASG(BITXOR), // ^=
! BITAND_ASG(BITAND), // &=
!
! SL_ASG(SL), // <<=
! SR_ASG(SR), // >>=
! USR_ASG(USR), // >>>=
! PLUS_ASG(PLUS), // +=
! MINUS_ASG(MINUS), // -=
! MUL_ASG(MUL), // *=
! DIV_ASG(DIV), // /=
! MOD_ASG(MOD), // %=
/** A synthetic let expression, of type LetExpr.
*/
! LETEXPR; // ala scheme
!
! private Tag noAssignTag;
!
! private Tag(Tag noAssignTag)
! {
! this.noAssignTag = noAssignTag;
! }
+ private Tag()
+ {
+ }
+
+ public Tag noAssignOp()
+ {
+ if (this.noAssignTag != null)
+ return noAssignTag;
+ throw new AssertionError("JCTree.Tag.noAssignOp() method is not available for non assignment tags");
+ }
+ }
/** The offset between assignment operators and normal operators.
*/
! //public static final int ASGOffset = BITOR_ASG - BITOR;
/* The (encoded) position in the source file. @see util.Position.
*/
public int pos;
*** 335,345 ****
*/
public Type type;
/* The tag of this node -- one of the constants declared above.
*/
! public abstract int getTag();
/** Convert a tree to a pretty-printed string. */
@Override
public String toString() {
StringWriter s = new StringWriter();
--- 357,367 ----
*/
public Type type;
/* The tag of this node -- one of the constants declared above.
*/
! public abstract JCTree.Tag getTag();
/** Convert a tree to a pretty-printed string. */
@Override
public String toString() {
StringWriter s = new StringWriter();
*** 462,475 ****
return packageAnnotations;
}
public List<JCImport> getImports() {
ListBuffer<JCImport> imports = new ListBuffer<JCImport>();
for (JCTree tree : defs) {
! int tag = tree.getTag();
! if (tag == IMPORT)
imports.append((JCImport)tree);
! else if (tag != SKIP)
break;
}
return imports.toList();
}
public JCExpression getPackageName() { return pid; }
--- 484,497 ----
return packageAnnotations;
}
public List<JCImport> getImports() {
ListBuffer<JCImport> imports = new ListBuffer<JCImport>();
for (JCTree tree : defs) {
! JCTree.Tag tag = tree.getTag();
! if (tag == JCTree.Tag.IMPORT)
imports.append((JCImport)tree);
! else if (tag != JCTree.Tag.SKIP)
break;
}
return imports.toList();
}
public JCExpression getPackageName() { return pid; }
*** 480,501 ****
return lineMap;
}
public List<JCTree> getTypeDecls() {
List<JCTree> typeDefs;
for (typeDefs = defs; !typeDefs.isEmpty(); typeDefs = typeDefs.tail)
! if (typeDefs.head.getTag() != IMPORT)
break;
return typeDefs;
}
@Override
public <R,D> R accept(TreeVisitor<R,D> v, D d) {
return v.visitCompilationUnit(this, d);
}
@Override
! public int getTag() {
! return TOPLEVEL;
}
}
/**
* An import clause.
--- 502,523 ----
return lineMap;
}
public List<JCTree> getTypeDecls() {
List<JCTree> typeDefs;
for (typeDefs = defs; !typeDefs.isEmpty(); typeDefs = typeDefs.tail)
! if (typeDefs.head.getTag() != JCTree.Tag.IMPORT)
break;
return typeDefs;
}
@Override
public <R,D> R accept(TreeVisitor<R,D> v, D d) {
return v.visitCompilationUnit(this, d);
}
@Override
! public JCTree.Tag getTag() {
! return JCTree.Tag.TOPLEVEL;
}
}
/**
* An import clause.
*** 519,530 ****
public <R,D> R accept(TreeVisitor<R,D> v, D d) {
return v.visitImport(this, d);
}
@Override
! public int getTag() {
! return IMPORT;
}
}
public static abstract class JCStatement extends JCTree implements StatementTree {
@Override
--- 541,552 ----
public <R,D> R accept(TreeVisitor<R,D> v, D d) {
return v.visitImport(this, d);
}
@Override
! public JCTree.Tag getTag() {
! return JCTree.Tag.IMPORT;
}
}
public static abstract class JCStatement extends JCTree implements StatementTree {
@Override
*** 616,627 ****
public <R,D> R accept(TreeVisitor<R,D> v, D d) {
return v.visitClass(this, d);
}
@Override
! public int getTag() {
! return CLASSDEF;
}
}
/**
* A method definition.
--- 638,649 ----
public <R,D> R accept(TreeVisitor<R,D> v, D d) {
return v.visitClass(this, d);
}
@Override
! public JCTree.Tag getTag() {
! return JCTree.Tag.CLASSDEF;
}
}
/**
* A method definition.
*** 688,699 ****
public <R,D> R accept(TreeVisitor<R,D> v, D d) {
return v.visitMethod(this, d);
}
@Override
! public int getTag() {
! return METHODDEF;
}
}
/**
* A variable definition.
--- 710,721 ----
public <R,D> R accept(TreeVisitor<R,D> v, D d) {
return v.visitMethod(this, d);
}
@Override
! public JCTree.Tag getTag() {
! return JCTree.Tag.METHODDEF;
}
}
/**
* A variable definition.
*** 734,745 ****
public <R,D> R accept(TreeVisitor<R,D> v, D d) {
return v.visitVariable(this, d);
}
@Override
! public int getTag() {
! return VARDEF;
}
}
/**
* A no-op statement ";".
--- 756,767 ----
public <R,D> R accept(TreeVisitor<R,D> v, D d) {
return v.visitVariable(this, d);
}
@Override
! public JCTree.Tag getTag() {
! return JCTree.Tag.VARDEF;
}
}
/**
* A no-op statement ";".
*** 755,766 ****
public <R,D> R accept(TreeVisitor<R,D> v, D d) {
return v.visitEmptyStatement(this, d);
}
@Override
! public int getTag() {
! return SKIP;
}
}
/**
* A statement block.
--- 777,788 ----
public <R,D> R accept(TreeVisitor<R,D> v, D d) {
return v.visitEmptyStatement(this, d);
}
@Override
! public JCTree.Tag getTag() {
! return JCTree.Tag.SKIP;
}
}
/**
* A statement block.
*** 788,799 ****
public <R,D> R accept(TreeVisitor<R,D> v, D d) {
return v.visitBlock(this, d);
}
@Override
! public int getTag() {
! return BLOCK;
}
}
/**
* A do loop
--- 810,821 ----
public <R,D> R accept(TreeVisitor<R,D> v, D d) {
return v.visitBlock(this, d);
}
@Override
! public JCTree.Tag getTag() {
! return JCTree.Tag.BLOCK;
}
}
/**
* A do loop
*** 815,826 ****
public <R,D> R accept(TreeVisitor<R,D> v, D d) {
return v.visitDoWhileLoop(this, d);
}
@Override
! public int getTag() {
! return DOLOOP;
}
}
/**
* A while loop
--- 837,848 ----
public <R,D> R accept(TreeVisitor<R,D> v, D d) {
return v.visitDoWhileLoop(this, d);
}
@Override
! public JCTree.Tag getTag() {
! return JCTree.Tag.DOLOOP;
}
}
/**
* A while loop
*** 842,853 ****
public <R,D> R accept(TreeVisitor<R,D> v, D d) {
return v.visitWhileLoop(this, d);
}
@Override
! public int getTag() {
! return WHILELOOP;
}
}
/**
* A for loop.
--- 864,875 ----
public <R,D> R accept(TreeVisitor<R,D> v, D d) {
return v.visitWhileLoop(this, d);
}
@Override
! public JCTree.Tag getTag() {
! return JCTree.Tag.WHILELOOP;
}
}
/**
* A for loop.
*** 883,894 ****
public <R,D> R accept(TreeVisitor<R,D> v, D d) {
return v.visitForLoop(this, d);
}
@Override
! public int getTag() {
! return FORLOOP;
}
}
/**
* The enhanced for loop.
--- 905,916 ----
public <R,D> R accept(TreeVisitor<R,D> v, D d) {
return v.visitForLoop(this, d);
}
@Override
! public JCTree.Tag getTag() {
! return JCTree.Tag.FORLOOP;
}
}
/**
* The enhanced for loop.
*** 912,923 ****
@Override
public <R,D> R accept(TreeVisitor<R,D> v, D d) {
return v.visitEnhancedForLoop(this, d);
}
@Override
! public int getTag() {
! return FOREACHLOOP;
}
}
/**
* A labelled expression or statement.
--- 934,945 ----
@Override
public <R,D> R accept(TreeVisitor<R,D> v, D d) {
return v.visitEnhancedForLoop(this, d);
}
@Override
! public JCTree.Tag getTag() {
! return JCTree.Tag.FOREACHLOOP;
}
}
/**
* A labelled expression or statement.
*** 937,948 ****
@Override
public <R,D> R accept(TreeVisitor<R,D> v, D d) {
return v.visitLabeledStatement(this, d);
}
@Override
! public int getTag() {
! return LABELLED;
}
}
/**
* A "switch ( ) { }" construction.
--- 959,970 ----
@Override
public <R,D> R accept(TreeVisitor<R,D> v, D d) {
return v.visitLabeledStatement(this, d);
}
@Override
! public JCTree.Tag getTag() {
! return JCTree.Tag.LABELLED;
}
}
/**
* A "switch ( ) { }" construction.
*** 963,974 ****
@Override
public <R,D> R accept(TreeVisitor<R,D> v, D d) {
return v.visitSwitch(this, d);
}
@Override
! public int getTag() {
! return SWITCH;
}
}
/**
* A "case :" of a switch.
--- 985,996 ----
@Override
public <R,D> R accept(TreeVisitor<R,D> v, D d) {
return v.visitSwitch(this, d);
}
@Override
! public JCTree.Tag getTag() {
! return JCTree.Tag.SWITCH;
}
}
/**
* A "case :" of a switch.
*** 989,1000 ****
@Override
public <R,D> R accept(TreeVisitor<R,D> v, D d) {
return v.visitCase(this, d);
}
@Override
! public int getTag() {
! return CASE;
}
}
/**
* A synchronized block.
--- 1011,1022 ----
@Override
public <R,D> R accept(TreeVisitor<R,D> v, D d) {
return v.visitCase(this, d);
}
@Override
! public JCTree.Tag getTag() {
! return JCTree.Tag.CASE;
}
}
/**
* A synchronized block.
*** 1015,1026 ****
@Override
public <R,D> R accept(TreeVisitor<R,D> v, D d) {
return v.visitSynchronized(this, d);
}
@Override
! public int getTag() {
! return SYNCHRONIZED;
}
}
/**
* A "try { } catch ( ) { } finally { }" block.
--- 1037,1048 ----
@Override
public <R,D> R accept(TreeVisitor<R,D> v, D d) {
return v.visitSynchronized(this, d);
}
@Override
! public JCTree.Tag getTag() {
! return JCTree.Tag.SYNCHRONIZED;
}
}
/**
* A "try { } catch ( ) { } finally { }" block.
*** 1055,1066 ****
@Override
public List<? extends JCTree> getResources() {
return resources;
}
@Override
! public int getTag() {
! return TRY;
}
}
/**
* A catch block.
--- 1077,1088 ----
@Override
public List<? extends JCTree> getResources() {
return resources;
}
@Override
! public JCTree.Tag getTag() {
! return JCTree.Tag.TRY;
}
}
/**
* A catch block.
*** 1081,1092 ****
@Override
public <R,D> R accept(TreeVisitor<R,D> v, D d) {
return v.visitCatch(this, d);
}
@Override
! public int getTag() {
! return CATCH;
}
}
/**
* A ( ) ? ( ) : ( ) conditional expression
--- 1103,1114 ----
@Override
public <R,D> R accept(TreeVisitor<R,D> v, D d) {
return v.visitCatch(this, d);
}
@Override
! public JCTree.Tag getTag() {
! return JCTree.Tag.CATCH;
}
}
/**
* A ( ) ? ( ) : ( ) conditional expression
*** 1113,1124 ****
@Override
public <R,D> R accept(TreeVisitor<R,D> v, D d) {
return v.visitConditionalExpression(this, d);
}
@Override
! public int getTag() {
! return CONDEXPR;
}
}
/**
* An "if ( ) { } else { }" block
--- 1135,1146 ----
@Override
public <R,D> R accept(TreeVisitor<R,D> v, D d) {
return v.visitConditionalExpression(this, d);
}
@Override
! public JCTree.Tag getTag() {
! return JCTree.Tag.CONDEXPR;
}
}
/**
* An "if ( ) { } else { }" block
*** 1145,1156 ****
@Override
public <R,D> R accept(TreeVisitor<R,D> v, D d) {
return v.visitIf(this, d);
}
@Override
! public int getTag() {
! return IF;
}
}
/**
* an expression statement
--- 1167,1178 ----
@Override
public <R,D> R accept(TreeVisitor<R,D> v, D d) {
return v.visitIf(this, d);
}
@Override
! public JCTree.Tag getTag() {
! return JCTree.Tag.IF;
}
}
/**
* an expression statement
*** 1170,1181 ****
@Override
public <R,D> R accept(TreeVisitor<R,D> v, D d) {
return v.visitExpressionStatement(this, d);
}
@Override
! public int getTag() {
! return EXEC;
}
/** Convert a expression-statement tree to a pretty-printed string. */
@Override
public String toString() {
--- 1192,1203 ----
@Override
public <R,D> R accept(TreeVisitor<R,D> v, D d) {
return v.visitExpressionStatement(this, d);
}
@Override
! public JCTree.Tag getTag() {
! return JCTree.Tag.EXEC;
}
/** Convert a expression-statement tree to a pretty-printed string. */
@Override
public String toString() {
*** 1210,1221 ****
@Override
public <R,D> R accept(TreeVisitor<R,D> v, D d) {
return v.visitBreak(this, d);
}
@Override
! public int getTag() {
! return BREAK;
}
}
/**
* A continue of a loop.
--- 1232,1243 ----
@Override
public <R,D> R accept(TreeVisitor<R,D> v, D d) {
return v.visitBreak(this, d);
}
@Override
! public JCTree.Tag getTag() {
! return JCTree.Tag.BREAK;
}
}
/**
* A continue of a loop.
*** 1235,1246 ****
@Override
public <R,D> R accept(TreeVisitor<R,D> v, D d) {
return v.visitContinue(this, d);
}
@Override
! public int getTag() {
! return CONTINUE;
}
}
/**
* A return statement.
--- 1257,1268 ----
@Override
public <R,D> R accept(TreeVisitor<R,D> v, D d) {
return v.visitContinue(this, d);
}
@Override
! public JCTree.Tag getTag() {
! return JCTree.Tag.CONTINUE;
}
}
/**
* A return statement.
*** 1258,1269 ****
@Override
public <R,D> R accept(TreeVisitor<R,D> v, D d) {
return v.visitReturn(this, d);
}
@Override
! public int getTag() {
! return RETURN;
}
}
/**
* A throw statement.
--- 1280,1291 ----
@Override
public <R,D> R accept(TreeVisitor<R,D> v, D d) {
return v.visitReturn(this, d);
}
@Override
! public JCTree.Tag getTag() {
! return JCTree.Tag.RETURN;
}
}
/**
* A throw statement.
*** 1281,1292 ****
@Override
public <R,D> R accept(TreeVisitor<R,D> v, D d) {
return v.visitThrow(this, d);
}
@Override
! public int getTag() {
! return THROW;
}
}
/**
* An assert statement.
--- 1303,1314 ----
@Override
public <R,D> R accept(TreeVisitor<R,D> v, D d) {
return v.visitThrow(this, d);
}
@Override
! public JCTree.Tag getTag() {
! return JCTree.Tag.THROW;
}
}
/**
* An assert statement.
*** 1307,1318 ****
@Override
public <R,D> R accept(TreeVisitor<R,D> v, D d) {
return v.visitAssert(this, d);
}
@Override
! public int getTag() {
! return ASSERT;
}
}
/**
* A method invocation
--- 1329,1340 ----
@Override
public <R,D> R accept(TreeVisitor<R,D> v, D d) {
return v.visitAssert(this, d);
}
@Override
! public JCTree.Tag getTag() {
! return JCTree.Tag.ASSERT;
}
}
/**
* A method invocation
*** 1350,1361 ****
public JCMethodInvocation setType(Type type) {
super.setType(type);
return this;
}
@Override
! public int getTag() {
! return(APPLY);
}
}
/**
* A new(...) operation.
--- 1372,1383 ----
public JCMethodInvocation setType(Type type) {
super.setType(type);
return this;
}
@Override
! public JCTree.Tag getTag() {
! return(JCTree.Tag.APPLY);
}
}
/**
* A new(...) operation.
*** 1400,1411 ****
@Override
public <R,D> R accept(TreeVisitor<R,D> v, D d) {
return v.visitNewClass(this, d);
}
@Override
! public int getTag() {
! return NEWCLASS;
}
}
/**
* A new[...] operation.
--- 1422,1433 ----
@Override
public <R,D> R accept(TreeVisitor<R,D> v, D d) {
return v.visitNewClass(this, d);
}
@Override
! public JCTree.Tag getTag() {
! return JCTree.Tag.NEWCLASS;
}
}
/**
* A new[...] operation.
*** 1436,1447 ****
@Override
public <R,D> R accept(TreeVisitor<R,D> v, D d) {
return v.visitNewArray(this, d);
}
@Override
! public int getTag() {
! return NEWARRAY;
}
}
/**
* A parenthesized subexpression ( ... )
--- 1458,1469 ----
@Override
public <R,D> R accept(TreeVisitor<R,D> v, D d) {
return v.visitNewArray(this, d);
}
@Override
! public JCTree.Tag getTag() {
! return JCTree.Tag.NEWARRAY;
}
}
/**
* A parenthesized subexpression ( ... )
*** 1459,1470 ****
@Override
public <R,D> R accept(TreeVisitor<R,D> v, D d) {
return v.visitParenthesized(this, d);
}
@Override
! public int getTag() {
! return PARENS;
}
}
/**
* A assignment with "=".
--- 1481,1492 ----
@Override
public <R,D> R accept(TreeVisitor<R,D> v, D d) {
return v.visitParenthesized(this, d);
}
@Override
! public JCTree.Tag getTag() {
! return JCTree.Tag.PARENS;
}
}
/**
* A assignment with "=".
*** 1485,1508 ****
@Override
public <R,D> R accept(TreeVisitor<R,D> v, D d) {
return v.visitAssignment(this, d);
}
@Override
! public int getTag() {
! return ASSIGN;
}
}
/**
* An assignment with "+=", "|=" ...
*/
public static class JCAssignOp extends JCExpression implements CompoundAssignmentTree {
! private int opcode;
public JCExpression lhs;
public JCExpression rhs;
public Symbol operator;
! protected JCAssignOp(int opcode, JCTree lhs, JCTree rhs, Symbol operator) {
this.opcode = opcode;
this.lhs = (JCExpression)lhs;
this.rhs = (JCExpression)rhs;
this.operator = operator;
}
--- 1507,1530 ----
@Override
public <R,D> R accept(TreeVisitor<R,D> v, D d) {
return v.visitAssignment(this, d);
}
@Override
! public JCTree.Tag getTag() {
! return JCTree.Tag.ASSIGN;
}
}
/**
* An assignment with "+=", "|=" ...
*/
public static class JCAssignOp extends JCExpression implements CompoundAssignmentTree {
! private JCTree.Tag opcode;
public JCExpression lhs;
public JCExpression rhs;
public Symbol operator;
! protected JCAssignOp(JCTree.Tag opcode, JCTree lhs, JCTree rhs, Symbol operator) {
this.opcode = opcode;
this.lhs = (JCExpression)lhs;
this.rhs = (JCExpression)rhs;
this.operator = operator;
}
*** 1518,1540 ****
@Override
public <R,D> R accept(TreeVisitor<R,D> v, D d) {
return v.visitCompoundAssignment(this, d);
}
@Override
! public int getTag() {
return opcode;
}
}
/**
* A unary operation.
*/
public static class JCUnary extends JCExpression implements UnaryTree {
! private int opcode;
public JCExpression arg;
public Symbol operator;
! protected JCUnary(int opcode, JCExpression arg) {
this.opcode = opcode;
this.arg = arg;
}
@Override
public void accept(Visitor v) { v.visitUnary(this); }
--- 1540,1562 ----
@Override
public <R,D> R accept(TreeVisitor<R,D> v, D d) {
return v.visitCompoundAssignment(this, d);
}
@Override
! public JCTree.Tag getTag() {
return opcode;
}
}
/**
* A unary operation.
*/
public static class JCUnary extends JCExpression implements UnaryTree {
! private JCTree.Tag opcode;
public JCExpression arg;
public Symbol operator;
! protected JCUnary(JCTree.Tag opcode, JCExpression arg) {
this.opcode = opcode;
this.arg = arg;
}
@Override
public void accept(Visitor v) { v.visitUnary(this); }
*** 1547,1574 ****
@Override
public <R,D> R accept(TreeVisitor<R,D> v, D d) {
return v.visitUnary(this, d);
}
@Override
! public int getTag() {
return opcode;
}
! public void setTag(int tag) {
opcode = tag;
}
}
/**
* A binary operation.
*/
public static class JCBinary extends JCExpression implements BinaryTree {
! private int opcode;
public JCExpression lhs;
public JCExpression rhs;
public Symbol operator;
! protected JCBinary(int opcode,
JCExpression lhs,
JCExpression rhs,
Symbol operator) {
this.opcode = opcode;
this.lhs = lhs;
--- 1569,1596 ----
@Override
public <R,D> R accept(TreeVisitor<R,D> v, D d) {
return v.visitUnary(this, d);
}
@Override
! public JCTree.Tag getTag() {
return opcode;
}
! public void setTag(JCTree.Tag tag) {
opcode = tag;
}
}
/**
* A binary operation.
*/
public static class JCBinary extends JCExpression implements BinaryTree {
! private JCTree.Tag opcode;
public JCExpression lhs;
public JCExpression rhs;
public Symbol operator;
! protected JCBinary(JCTree.Tag opcode,
JCExpression lhs,
JCExpression rhs,
Symbol operator) {
this.opcode = opcode;
this.lhs = lhs;
*** 1587,1597 ****
@Override
public <R,D> R accept(TreeVisitor<R,D> v, D d) {
return v.visitBinary(this, d);
}
@Override
! public int getTag() {
return opcode;
}
}
/**
--- 1609,1619 ----
@Override
public <R,D> R accept(TreeVisitor<R,D> v, D d) {
return v.visitBinary(this, d);
}
@Override
! public JCTree.Tag getTag() {
return opcode;
}
}
/**
*** 1613,1624 ****
@Override
public <R,D> R accept(TreeVisitor<R,D> v, D d) {
return v.visitTypeCast(this, d);
}
@Override
! public int getTag() {
! return TYPECAST;
}
}
/**
* A type test.
--- 1635,1646 ----
@Override
public <R,D> R accept(TreeVisitor<R,D> v, D d) {
return v.visitTypeCast(this, d);
}
@Override
! public JCTree.Tag getTag() {
! return JCTree.Tag.TYPECAST;
}
}
/**
* A type test.
*** 1639,1650 ****
@Override
public <R,D> R accept(TreeVisitor<R,D> v, D d) {
return v.visitInstanceOf(this, d);
}
@Override
! public int getTag() {
! return TYPETEST;
}
}
/**
* An array selection
--- 1661,1672 ----
@Override
public <R,D> R accept(TreeVisitor<R,D> v, D d) {
return v.visitInstanceOf(this, d);
}
@Override
! public JCTree.Tag getTag() {
! return JCTree.Tag.TYPETEST;
}
}
/**
* An array selection
*** 1665,1676 ****
@Override
public <R,D> R accept(TreeVisitor<R,D> v, D d) {
return v.visitArrayAccess(this, d);
}
@Override
! public int getTag() {
! return INDEXED;
}
}
/**
* Selects through packages and classes
--- 1687,1698 ----
@Override
public <R,D> R accept(TreeVisitor<R,D> v, D d) {
return v.visitArrayAccess(this, d);
}
@Override
! public JCTree.Tag getTag() {
! return JCTree.Tag.INDEXED;
}
}
/**
* Selects through packages and classes
*** 1696,1707 ****
public <R,D> R accept(TreeVisitor<R,D> v, D d) {
return v.visitMemberSelect(this, d);
}
public Name getIdentifier() { return name; }
@Override
! public int getTag() {
! return SELECT;
}
}
/**
* An identifier
--- 1718,1729 ----
public <R,D> R accept(TreeVisitor<R,D> v, D d) {
return v.visitMemberSelect(this, d);
}
public Name getIdentifier() { return name; }
@Override
! public JCTree.Tag getTag() {
! return JCTree.Tag.SELECT;
}
}
/**
* An identifier
*** 1722,1733 ****
public Name getName() { return name; }
@Override
public <R,D> R accept(TreeVisitor<R,D> v, D d) {
return v.visitIdentifier(this, d);
}
! public int getTag() {
! return IDENT;
}
}
/**
* A constant value given literally.
--- 1744,1755 ----
public Name getName() { return name; }
@Override
public <R,D> R accept(TreeVisitor<R,D> v, D d) {
return v.visitIdentifier(this, d);
}
! public JCTree.Tag getTag() {
! return JCTree.Tag.IDENT;
}
}
/**
* A constant value given literally.
*** 1788,1799 ****
public JCLiteral setType(Type type) {
super.setType(type);
return this;
}
@Override
! public int getTag() {
! return LITERAL;
}
}
/**
* Identifies a basic type.
--- 1810,1821 ----
public JCLiteral setType(Type type) {
super.setType(type);
return this;
}
@Override
! public JCTree.Tag getTag() {
! return JCTree.Tag.LITERAL;
}
}
/**
* Identifies a basic type.
*** 1836,1847 ****
@Override
public <R,D> R accept(TreeVisitor<R,D> v, D d) {
return v.visitPrimitiveType(this, d);
}
@Override
! public int getTag() {
! return TYPEIDENT;
}
}
/**
* An array type, A[]
--- 1858,1869 ----
@Override
public <R,D> R accept(TreeVisitor<R,D> v, D d) {
return v.visitPrimitiveType(this, d);
}
@Override
! public JCTree.Tag getTag() {
! return JCTree.Tag.TYPEIDENT;
}
}
/**
* An array type, A[]
*** 1859,1870 ****
@Override
public <R,D> R accept(TreeVisitor<R,D> v, D d) {
return v.visitArrayType(this, d);
}
@Override
! public int getTag() {
! return TYPEARRAY;
}
}
/**
* A parameterized type, T<...>
--- 1881,1892 ----
@Override
public <R,D> R accept(TreeVisitor<R,D> v, D d) {
return v.visitArrayType(this, d);
}
@Override
! public JCTree.Tag getTag() {
! return JCTree.Tag.TYPEARRAY;
}
}
/**
* A parameterized type, T<...>
*** 1887,1898 ****
@Override
public <R,D> R accept(TreeVisitor<R,D> v, D d) {
return v.visitParameterizedType(this, d);
}
@Override
! public int getTag() {
! return TYPEAPPLY;
}
}
/**
* A union type, T1 | T2 | ... Tn (used in multicatch statements)
--- 1909,1920 ----
@Override
public <R,D> R accept(TreeVisitor<R,D> v, D d) {
return v.visitParameterizedType(this, d);
}
@Override
! public JCTree.Tag getTag() {
! return JCTree.Tag.TYPEAPPLY;
}
}
/**
* A union type, T1 | T2 | ... Tn (used in multicatch statements)
*** 1915,1926 ****
@Override
public <R,D> R accept(TreeVisitor<R,D> v, D d) {
return v.visitUnionType(this, d);
}
@Override
! public int getTag() {
! return TYPEUNION;
}
}
/**
* A formal class parameter.
--- 1937,1948 ----
@Override
public <R,D> R accept(TreeVisitor<R,D> v, D d) {
return v.visitUnionType(this, d);
}
@Override
! public JCTree.Tag getTag() {
! return JCTree.Tag.TYPEUNION;
}
}
/**
* A formal class parameter.
*** 1945,1956 ****
@Override
public <R,D> R accept(TreeVisitor<R,D> v, D d) {
return v.visitTypeParameter(this, d);
}
@Override
! public int getTag() {
! return TYPEPARAMETER;
}
}
public static class JCWildcard extends JCExpression implements WildcardTree {
public TypeBoundKind kind;
--- 1967,1978 ----
@Override
public <R,D> R accept(TreeVisitor<R,D> v, D d) {
return v.visitTypeParameter(this, d);
}
@Override
! public JCTree.Tag getTag() {
! return JCTree.Tag.TYPEPARAMETER;
}
}
public static class JCWildcard extends JCExpression implements WildcardTree {
public TypeBoundKind kind;
*** 1979,1990 ****
@Override
public <R,D> R accept(TreeVisitor<R,D> v, D d) {
return v.visitWildcard(this, d);
}
@Override
! public int getTag() {
! return WILDCARD;
}
}
public static class TypeBoundKind extends JCTree {
public BoundKind kind;
--- 2001,2012 ----
@Override
public <R,D> R accept(TreeVisitor<R,D> v, D d) {
return v.visitWildcard(this, d);
}
@Override
! public JCTree.Tag getTag() {
! return JCTree.Tag.WILDCARD;
}
}
public static class TypeBoundKind extends JCTree {
public BoundKind kind;
*** 2000,2011 ****
@Override
public <R,D> R accept(TreeVisitor<R,D> v, D d) {
throw new AssertionError("TypeBoundKind is not part of a public API");
}
@Override
! public int getTag() {
! return TYPEBOUNDKIND;
}
}
public static class JCAnnotation extends JCExpression implements AnnotationTree {
public JCTree annotationType;
--- 2022,2033 ----
@Override
public <R,D> R accept(TreeVisitor<R,D> v, D d) {
throw new AssertionError("TypeBoundKind is not part of a public API");
}
@Override
! public JCTree.Tag getTag() {
! return JCTree.Tag.TYPEBOUNDKIND;
}
}
public static class JCAnnotation extends JCExpression implements AnnotationTree {
public JCTree annotationType;
*** 2025,2036 ****
@Override
public <R,D> R accept(TreeVisitor<R,D> v, D d) {
return v.visitAnnotation(this, d);
}
@Override
! public int getTag() {
! return ANNOTATION;
}
}
public static class JCModifiers extends JCTree implements com.sun.source.tree.ModifiersTree {
public long flags;
--- 2047,2058 ----
@Override
public <R,D> R accept(TreeVisitor<R,D> v, D d) {
return v.visitAnnotation(this, d);
}
@Override
! public JCTree.Tag getTag() {
! return JCTree.Tag.ANNOTATION;
}
}
public static class JCModifiers extends JCTree implements com.sun.source.tree.ModifiersTree {
public long flags;
*** 2052,2063 ****
@Override
public <R,D> R accept(TreeVisitor<R,D> v, D d) {
return v.visitModifiers(this, d);
}
@Override
! public int getTag() {
! return MODIFIERS;
}
}
public static class JCErroneous extends JCExpression
implements com.sun.source.tree.ErroneousTree {
--- 2074,2085 ----
@Override
public <R,D> R accept(TreeVisitor<R,D> v, D d) {
return v.visitModifiers(this, d);
}
@Override
! public JCTree.Tag getTag() {
! return JCTree.Tag.MODIFIERS;
}
}
public static class JCErroneous extends JCExpression
implements com.sun.source.tree.ErroneousTree {
*** 2077,2088 ****
@Override
public <R,D> R accept(TreeVisitor<R,D> v, D d) {
return v.visitErroneous(this, d);
}
@Override
! public int getTag() {
! return ERRONEOUS;
}
}
/** (let int x = 3; in x+2) */
public static class LetExpr extends JCExpression {
--- 2099,2110 ----
@Override
public <R,D> R accept(TreeVisitor<R,D> v, D d) {
return v.visitErroneous(this, d);
}
@Override
! public JCTree.Tag getTag() {
! return JCTree.Tag.ERRONEOUS;
}
}
/** (let int x = 3; in x+2) */
public static class LetExpr extends JCExpression {
*** 2101,2112 ****
@Override
public <R,D> R accept(TreeVisitor<R,D> v, D d) {
throw new AssertionError("LetExpr is not part of a public API");
}
@Override
! public int getTag() {
! return LETEXPR;
}
}
/** An interface for tree factories
*/
--- 2123,2134 ----
@Override
public <R,D> R accept(TreeVisitor<R,D> v, D d) {
throw new AssertionError("LetExpr is not part of a public API");
}
@Override
! public JCTree.Tag getTag() {
! return JCTree.Tag.LETEXPR;
}
}
/** An interface for tree factories
*/
*** 2173,2185 ****
JCNewArray NewArray(JCExpression elemtype,
List<JCExpression> dims,
List<JCExpression> elems);
JCParens Parens(JCExpression expr);
JCAssign Assign(JCExpression lhs, JCExpression rhs);
! JCAssignOp Assignop(int opcode, JCTree lhs, JCTree rhs);
! JCUnary Unary(int opcode, JCExpression arg);
! JCBinary Binary(int opcode, JCExpression lhs, JCExpression rhs);
JCTypeCast TypeCast(JCTree expr, JCExpression type);
JCInstanceOf TypeTest(JCExpression expr, JCTree clazz);
JCArrayAccess Indexed(JCExpression indexed, JCExpression index);
JCFieldAccess Select(JCExpression selected, Name selector);
JCIdent Ident(Name idname);
--- 2195,2207 ----
JCNewArray NewArray(JCExpression elemtype,
List<JCExpression> dims,
List<JCExpression> elems);
JCParens Parens(JCExpression expr);
JCAssign Assign(JCExpression lhs, JCExpression rhs);
! JCAssignOp Assignop(JCTree.Tag opcode, JCTree lhs, JCTree rhs);
! JCUnary Unary(JCTree.Tag opcode, JCExpression arg);
! JCBinary Binary(JCTree.Tag opcode, JCExpression lhs, JCExpression rhs);
JCTypeCast TypeCast(JCTree expr, JCExpression type);
JCInstanceOf TypeTest(JCExpression expr, JCTree clazz);
JCArrayAccess Indexed(JCExpression indexed, JCExpression index);
JCFieldAccess Select(JCExpression selected, Name selector);
JCIdent Ident(Name idname);