--- a/langtools/src/share/classes/com/sun/tools/javac/comp/Attr.java Mon Dec 13 14:08:01 2010 -0800
+++ b/langtools/src/share/classes/com/sun/tools/javac/comp/Attr.java Mon Dec 13 15:11:00 2010 -0800
@@ -38,6 +38,7 @@
import com.sun.tools.javac.util.List;
import com.sun.tools.javac.jvm.Target;
+import com.sun.tools.javac.code.Lint.LintCategory;
import com.sun.tools.javac.code.Symbol.*;
import com.sun.tools.javac.tree.JCTree.*;
import com.sun.tools.javac.code.Type.*;
@@ -669,6 +670,7 @@
Lint lint = env.info.lint.augment(m.attributes_field, m.flags());
Lint prevLint = chk.setLint(lint);
+ MethodSymbol prevMethod = chk.setMethod(m);
try {
chk.checkDeprecatedAnnotation(tree.pos(), m);
@@ -700,7 +702,7 @@
attribStat(l.head, localEnv);
}
- chk.checkVarargMethodDecl(tree);
+ chk.checkVarargsMethodDecl(localEnv, tree);
// Check that type parameters are well-formed.
chk.validate(tree.typarams, localEnv);
@@ -789,6 +791,7 @@
}
finally {
chk.setLint(prevLint);
+ chk.setMethod(prevMethod);
}
}
@@ -2272,8 +2275,8 @@
((VarSymbol)sitesym).isResourceVariable() &&
sym.kind == MTH &&
sym.overrides(syms.autoCloseableClose, sitesym.type.tsym, types, true) &&
- env.info.lint.isEnabled(Lint.LintCategory.TRY)) {
- log.warning(Lint.LintCategory.TRY, tree, "try.explicit.close.call");
+ env.info.lint.isEnabled(LintCategory.TRY)) {
+ log.warning(LintCategory.TRY, tree, "try.explicit.close.call");
}
// Disallow selecting a type from an expression
@@ -2700,7 +2703,7 @@
// For methods, we need to compute the instance type by
// Resolve.instantiate from the symbol's type as well as
// any type arguments and value arguments.
- noteWarner.warned = false;
+ noteWarner.clear();
Type owntype = rs.instantiate(env,
site,
sym,
@@ -2709,7 +2712,7 @@
true,
useVarargs,
noteWarner);
- boolean warned = noteWarner.warned;
+ boolean warned = noteWarner.hasNonSilentLint(LintCategory.UNCHECKED);
// If this fails, something went wrong; we should not have
// found the identifier in the first place.
@@ -2734,7 +2737,7 @@
JCTree arg = args.head;
Warner warn = chk.convertWarner(arg.pos(), arg.type, formals.head);
assertConvertible(arg, arg.type, formals.head, warn);
- warned |= warn.warned;
+ warned |= warn.hasNonSilentLint(LintCategory.UNCHECKED);
args = args.tail;
formals = formals.tail;
}
@@ -2744,7 +2747,7 @@
JCTree arg = args.head;
Warner warn = chk.convertWarner(arg.pos(), arg.type, varArg);
assertConvertible(arg, arg.type, varArg, warn);
- warned |= warn.warned;
+ warned |= warn.hasNonSilentLint(LintCategory.UNCHECKED);
args = args.tail;
}
} else if ((sym.flags() & VARARGS) != 0 && allowVarargs) {
@@ -2776,7 +2779,7 @@
JCTree tree = env.tree;
Type argtype = owntype.getParameterTypes().last();
if (owntype.getReturnType().tag != FORALL || warned) {
- chk.checkVararg(env.tree.pos(), owntype.getParameterTypes(), sym, env);
+ chk.checkVararg(env.tree.pos(), owntype.getParameterTypes(), sym);
}
Type elemtype = types.elemtype(argtype);
switch (tree.getTag()) {
@@ -3175,7 +3178,7 @@
chk.checkNonCyclicElements(tree);
// Check for proper use of serialVersionUID
- if (env.info.lint.isEnabled(Lint.LintCategory.SERIAL) &&
+ if (env.info.lint.isEnabled(LintCategory.SERIAL) &&
isSerializable(c) &&
(c.flags() & Flags.ENUM) == 0 &&
(c.flags() & ABSTRACT) == 0) {
@@ -3204,7 +3207,7 @@
Scope.Entry e = c.members().lookup(names.serialVersionUID);
while (e.scope != null && e.sym.kind != VAR) e = e.next();
if (e.scope == null) {
- log.warning(Lint.LintCategory.SERIAL,
+ log.warning(LintCategory.SERIAL,
tree.pos(), "missing.SVUID", c);
return;
}
@@ -3213,17 +3216,17 @@
VarSymbol svuid = (VarSymbol)e.sym;
if ((svuid.flags() & (STATIC | FINAL)) !=
(STATIC | FINAL))
- log.warning(Lint.LintCategory.SERIAL,
+ log.warning(LintCategory.SERIAL,
TreeInfo.diagnosticPositionFor(svuid, tree), "improper.SVUID", c);
// check that it is long
else if (svuid.type.tag != TypeTags.LONG)
- log.warning(Lint.LintCategory.SERIAL,
+ log.warning(LintCategory.SERIAL,
TreeInfo.diagnosticPositionFor(svuid, tree), "long.SVUID", c);
// check constant
else if (svuid.getConstValue() == null)
- log.warning(Lint.LintCategory.SERIAL,
+ log.warning(LintCategory.SERIAL,
TreeInfo.diagnosticPositionFor(svuid, tree), "constant.SVUID", c);
}