diff -r 2f2ead61db06 -r 7b99f98b3035 src/share/classes/com/sun/tools/javac/util/Warner.java --- a/src/share/classes/com/sun/tools/javac/util/Warner.java Mon Dec 13 14:08:01 2010 -0800 +++ b/src/share/classes/com/sun/tools/javac/util/Warner.java Mon Dec 13 15:11:00 2010 -0800 @@ -25,7 +25,9 @@ package com.sun.tools.javac.util; +import com.sun.tools.javac.code.Lint.LintCategory; import com.sun.tools.javac.util.JCDiagnostic.DiagnosticPosition; +import java.util.EnumSet; /** * An interface to support optional warnings, needed for support of @@ -40,25 +42,45 @@ public static final Warner noWarnings = new Warner(); private DiagnosticPosition pos = null; - public boolean warned = false; - public boolean unchecked = false; + protected boolean warned = false; + private EnumSet nonSilentLintSet = EnumSet.noneOf(LintCategory.class); + private EnumSet silentLintSet = EnumSet.noneOf(LintCategory.class); public DiagnosticPosition pos() { return pos; } - public void warnUnchecked() { - warned = true; - unchecked = true; + public void warn(LintCategory lint) { + nonSilentLintSet.add(lint); } - public void silentUnchecked() { - unchecked = true; + + public void silentWarn(LintCategory lint) { + silentLintSet.add(lint); } public Warner(DiagnosticPosition pos) { this.pos = pos; } + public boolean hasSilentLint(LintCategory lint) { + return silentLintSet.contains(lint); + } + + public boolean hasNonSilentLint(LintCategory lint) { + return nonSilentLintSet.contains(lint); + } + + public boolean hasLint(LintCategory lint) { + return hasSilentLint(lint) || + hasNonSilentLint(lint); + } + + public void clear() { + nonSilentLintSet.clear(); + silentLintSet.clear(); + this.warned = false; + } + public Warner() { this(null); }