1.1 --- a/src/share/classes/com/sun/tools/javac/comp/Check.java Sat Nov 05 00:02:33 2011 -0700 1.2 +++ b/src/share/classes/com/sun/tools/javac/comp/Check.java Tue Nov 08 11:51:05 2011 -0800 1.3 @@ -42,10 +42,14 @@ 1.4 import com.sun.tools.javac.code.Symbol.*; 1.5 1.6 import static com.sun.tools.javac.code.Flags.*; 1.7 +import static com.sun.tools.javac.code.Flags.ANNOTATION; 1.8 +import static com.sun.tools.javac.code.Flags.SYNCHRONIZED; 1.9 import static com.sun.tools.javac.code.Kinds.*; 1.10 import static com.sun.tools.javac.code.TypeTags.*; 1.11 +import static com.sun.tools.javac.code.TypeTags.WILDCARD; 1.12 1.13 import static com.sun.tools.javac.main.OptionName.*; 1.14 +import static com.sun.tools.javac.tree.JCTree.Tag.*; 1.15 1.16 /** Type checking helper class for the attribution phase. 1.17 * 1.18 @@ -987,7 +991,7 @@ 1.19 * <i>not</i> final. 1.20 */ 1.21 private long implicitEnumFinalFlag(JCTree tree) { 1.22 - if (tree.getTag() != JCTree.CLASSDEF) return 0; 1.23 + if (!tree.hasTag(CLASSDEF)) return 0; 1.24 class SpecialTreeVisitor extends JCTree.Visitor { 1.25 boolean specialized; 1.26 SpecialTreeVisitor() { 1.27 @@ -1099,7 +1103,7 @@ 1.28 // not parameterized at all. 1.29 if (tree.type.getEnclosingType().isRaw()) 1.30 log.error(tree.pos(), "improperly.formed.type.inner.raw.param"); 1.31 - if (tree.clazz.getTag() == JCTree.SELECT) 1.32 + if (tree.clazz.hasTag(SELECT)) 1.33 visitSelectInternal((JCFieldAccess)tree.clazz); 1.34 } 1.35 } 1.36 @@ -2413,7 +2417,7 @@ 1.37 1.38 // count them off as they're annotated 1.39 for (JCTree arg : a.args) { 1.40 - if (arg.getTag() != JCTree.ASSIGN) continue; // recovery 1.41 + if (!arg.hasTag(ASSIGN)) continue; // recovery 1.42 JCAssign assign = (JCAssign) arg; 1.43 Symbol m = TreeInfo.symbol(assign.lhs); 1.44 if (m == null || m.type.isErroneous()) continue; 1.45 @@ -2442,12 +2446,12 @@ 1.46 a.args.tail == null) 1.47 return; 1.48 1.49 - if (a.args.head.getTag() != JCTree.ASSIGN) return; // error recovery 1.50 + if (!a.args.head.hasTag(ASSIGN)) return; // error recovery 1.51 JCAssign assign = (JCAssign) a.args.head; 1.52 Symbol m = TreeInfo.symbol(assign.lhs); 1.53 if (m.name != names.value) return; 1.54 JCTree rhs = assign.rhs; 1.55 - if (rhs.getTag() != JCTree.NEWARRAY) return; 1.56 + if (!rhs.hasTag(NEWARRAY)) return; 1.57 JCNewArray na = (JCNewArray) rhs; 1.58 Set<Symbol> targets = new HashSet<Symbol>(); 1.59 for (JCTree elem : na.elems) { 1.60 @@ -2506,7 +2510,7 @@ 1.61 try { 1.62 tree.sym.flags_field |= LOCKED; 1.63 for (JCTree def : tree.defs) { 1.64 - if (def.getTag() != JCTree.METHODDEF) continue; 1.65 + if (!def.hasTag(METHODDEF)) continue; 1.66 JCMethodDecl meth = (JCMethodDecl)def; 1.67 checkAnnotationResType(meth.pos(), meth.restype.type); 1.68 } 1.69 @@ -2614,7 +2618,7 @@ 1.70 */ 1.71 int checkOperator(DiagnosticPosition pos, 1.72 OperatorSymbol operator, 1.73 - int tag, 1.74 + JCTree.Tag tag, 1.75 Type left, 1.76 Type right) { 1.77 if (operator.opcode == ByteCodes.error) { 1.78 @@ -2650,7 +2654,8 @@ 1.79 * Check for empty statements after if 1.80 */ 1.81 void checkEmptyIf(JCIf tree) { 1.82 - if (tree.thenpart.getTag() == JCTree.SKIP && tree.elsepart == null && lint.isEnabled(LintCategory.EMPTY)) 1.83 + if (tree.thenpart.hasTag(SKIP) && tree.elsepart == null && 1.84 + lint.isEnabled(LintCategory.EMPTY)) 1.85 log.warning(LintCategory.EMPTY, tree.thenpart.pos(), "empty.if"); 1.86 } 1.87 1.88 @@ -2754,7 +2759,7 @@ 1.89 } 1.90 // where 1.91 private boolean isCanonical(JCTree tree) { 1.92 - while (tree.getTag() == JCTree.SELECT) { 1.93 + while (tree.hasTag(SELECT)) { 1.94 JCFieldAccess s = (JCFieldAccess) tree; 1.95 if (s.sym.owner != TreeInfo.symbol(s.selected)) 1.96 return false;