--- a/langtools/src/share/classes/com/sun/tools/javac/comp/Annotate.java Sat Nov 05 00:02:33 2011 -0700
+++ b/langtools/src/share/classes/com/sun/tools/javac/comp/Annotate.java Tue Nov 08 11:51:05 2011 -0800
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2003, 2010, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2003, 2011, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@@ -31,6 +31,8 @@
import com.sun.tools.javac.tree.*;
import com.sun.tools.javac.tree.JCTree.*;
+import static com.sun.tools.javac.tree.JCTree.Tag.*;
+
/** Enter annotations on symbols. Annotations accumulate in a queue,
* which is processed at the top level of any set of recursive calls
* requesting it be processed.
@@ -148,7 +150,7 @@
return new Attribute.Compound(a.type, List.<Pair<MethodSymbol,Attribute>>nil());
}
List<JCExpression> args = a.args;
- if (args.length() == 1 && args.head.getTag() != JCTree.ASSIGN) {
+ if (args.length() == 1 && !args.head.hasTag(ASSIGN)) {
// special case: elided "value=" assumed
args.head = make.at(args.head.pos).
Assign(make.Ident(names.value), args.head);
@@ -157,12 +159,12 @@
new ListBuffer<Pair<MethodSymbol,Attribute>>();
for (List<JCExpression> tl = args; tl.nonEmpty(); tl = tl.tail) {
JCExpression t = tl.head;
- if (t.getTag() != JCTree.ASSIGN) {
+ if (!t.hasTag(ASSIGN)) {
log.error(t.pos(), "annotation.value.must.be.name.value");
continue;
}
JCAssign assign = (JCAssign)t;
- if (assign.lhs.getTag() != JCTree.IDENT) {
+ if (!assign.lhs.hasTag(IDENT)) {
log.error(t.pos(), "annotation.value.must.be.name.value");
continue;
}
@@ -222,14 +224,14 @@
(((JCFieldAccess) tree).selected).type);
}
if ((expected.tsym.flags() & Flags.ANNOTATION) != 0) {
- if (tree.getTag() != JCTree.ANNOTATION) {
+ if (!tree.hasTag(ANNOTATION)) {
log.error(tree.pos(), "annotation.value.must.be.annotation");
expected = syms.errorType;
}
return enterAnnotation((JCAnnotation)tree, expected, env);
}
if (expected.tag == TypeTags.ARRAY) { // should really be isArray()
- if (tree.getTag() != JCTree.NEWARRAY) {
+ if (!tree.hasTag(NEWARRAY)) {
tree = make.at(tree.pos).
NewArray(null, List.<JCExpression>nil(), List.of(tree));
}