1.1 --- a/src/share/classes/com/sun/tools/javac/comp/Attr.java Mon Dec 13 14:08:01 2010 -0800 1.2 +++ b/src/share/classes/com/sun/tools/javac/comp/Attr.java Mon Dec 13 15:11:00 2010 -0800 1.3 @@ -38,6 +38,7 @@ 1.4 import com.sun.tools.javac.util.List; 1.5 1.6 import com.sun.tools.javac.jvm.Target; 1.7 +import com.sun.tools.javac.code.Lint.LintCategory; 1.8 import com.sun.tools.javac.code.Symbol.*; 1.9 import com.sun.tools.javac.tree.JCTree.*; 1.10 import com.sun.tools.javac.code.Type.*; 1.11 @@ -669,6 +670,7 @@ 1.12 1.13 Lint lint = env.info.lint.augment(m.attributes_field, m.flags()); 1.14 Lint prevLint = chk.setLint(lint); 1.15 + MethodSymbol prevMethod = chk.setMethod(m); 1.16 try { 1.17 chk.checkDeprecatedAnnotation(tree.pos(), m); 1.18 1.19 @@ -700,7 +702,7 @@ 1.20 attribStat(l.head, localEnv); 1.21 } 1.22 1.23 - chk.checkVarargMethodDecl(tree); 1.24 + chk.checkVarargsMethodDecl(localEnv, tree); 1.25 1.26 // Check that type parameters are well-formed. 1.27 chk.validate(tree.typarams, localEnv); 1.28 @@ -789,6 +791,7 @@ 1.29 } 1.30 finally { 1.31 chk.setLint(prevLint); 1.32 + chk.setMethod(prevMethod); 1.33 } 1.34 } 1.35 1.36 @@ -2272,8 +2275,8 @@ 1.37 ((VarSymbol)sitesym).isResourceVariable() && 1.38 sym.kind == MTH && 1.39 sym.overrides(syms.autoCloseableClose, sitesym.type.tsym, types, true) && 1.40 - env.info.lint.isEnabled(Lint.LintCategory.TRY)) { 1.41 - log.warning(Lint.LintCategory.TRY, tree, "try.explicit.close.call"); 1.42 + env.info.lint.isEnabled(LintCategory.TRY)) { 1.43 + log.warning(LintCategory.TRY, tree, "try.explicit.close.call"); 1.44 } 1.45 1.46 // Disallow selecting a type from an expression 1.47 @@ -2700,7 +2703,7 @@ 1.48 // For methods, we need to compute the instance type by 1.49 // Resolve.instantiate from the symbol's type as well as 1.50 // any type arguments and value arguments. 1.51 - noteWarner.warned = false; 1.52 + noteWarner.clear(); 1.53 Type owntype = rs.instantiate(env, 1.54 site, 1.55 sym, 1.56 @@ -2709,7 +2712,7 @@ 1.57 true, 1.58 useVarargs, 1.59 noteWarner); 1.60 - boolean warned = noteWarner.warned; 1.61 + boolean warned = noteWarner.hasNonSilentLint(LintCategory.UNCHECKED); 1.62 1.63 // If this fails, something went wrong; we should not have 1.64 // found the identifier in the first place. 1.65 @@ -2734,7 +2737,7 @@ 1.66 JCTree arg = args.head; 1.67 Warner warn = chk.convertWarner(arg.pos(), arg.type, formals.head); 1.68 assertConvertible(arg, arg.type, formals.head, warn); 1.69 - warned |= warn.warned; 1.70 + warned |= warn.hasNonSilentLint(LintCategory.UNCHECKED); 1.71 args = args.tail; 1.72 formals = formals.tail; 1.73 } 1.74 @@ -2744,7 +2747,7 @@ 1.75 JCTree arg = args.head; 1.76 Warner warn = chk.convertWarner(arg.pos(), arg.type, varArg); 1.77 assertConvertible(arg, arg.type, varArg, warn); 1.78 - warned |= warn.warned; 1.79 + warned |= warn.hasNonSilentLint(LintCategory.UNCHECKED); 1.80 args = args.tail; 1.81 } 1.82 } else if ((sym.flags() & VARARGS) != 0 && allowVarargs) { 1.83 @@ -2776,7 +2779,7 @@ 1.84 JCTree tree = env.tree; 1.85 Type argtype = owntype.getParameterTypes().last(); 1.86 if (owntype.getReturnType().tag != FORALL || warned) { 1.87 - chk.checkVararg(env.tree.pos(), owntype.getParameterTypes(), sym, env); 1.88 + chk.checkVararg(env.tree.pos(), owntype.getParameterTypes(), sym); 1.89 } 1.90 Type elemtype = types.elemtype(argtype); 1.91 switch (tree.getTag()) { 1.92 @@ -3175,7 +3178,7 @@ 1.93 chk.checkNonCyclicElements(tree); 1.94 1.95 // Check for proper use of serialVersionUID 1.96 - if (env.info.lint.isEnabled(Lint.LintCategory.SERIAL) && 1.97 + if (env.info.lint.isEnabled(LintCategory.SERIAL) && 1.98 isSerializable(c) && 1.99 (c.flags() & Flags.ENUM) == 0 && 1.100 (c.flags() & ABSTRACT) == 0) { 1.101 @@ -3204,7 +3207,7 @@ 1.102 Scope.Entry e = c.members().lookup(names.serialVersionUID); 1.103 while (e.scope != null && e.sym.kind != VAR) e = e.next(); 1.104 if (e.scope == null) { 1.105 - log.warning(Lint.LintCategory.SERIAL, 1.106 + log.warning(LintCategory.SERIAL, 1.107 tree.pos(), "missing.SVUID", c); 1.108 return; 1.109 } 1.110 @@ -3213,17 +3216,17 @@ 1.111 VarSymbol svuid = (VarSymbol)e.sym; 1.112 if ((svuid.flags() & (STATIC | FINAL)) != 1.113 (STATIC | FINAL)) 1.114 - log.warning(Lint.LintCategory.SERIAL, 1.115 + log.warning(LintCategory.SERIAL, 1.116 TreeInfo.diagnosticPositionFor(svuid, tree), "improper.SVUID", c); 1.117 1.118 // check that it is long 1.119 else if (svuid.type.tag != TypeTags.LONG) 1.120 - log.warning(Lint.LintCategory.SERIAL, 1.121 + log.warning(LintCategory.SERIAL, 1.122 TreeInfo.diagnosticPositionFor(svuid, tree), "long.SVUID", c); 1.123 1.124 // check constant 1.125 else if (svuid.getConstValue() == null) 1.126 - log.warning(Lint.LintCategory.SERIAL, 1.127 + log.warning(LintCategory.SERIAL, 1.128 TreeInfo.diagnosticPositionFor(svuid, tree), "constant.SVUID", c); 1.129 } 1.130