diff -r 601160d857ef -r 2974d3800eb1 src/share/classes/com/sun/tools/javac/util/AbstractLog.java --- a/src/share/classes/com/sun/tools/javac/util/AbstractLog.java Thu Oct 28 10:17:47 2010 -0700 +++ b/src/share/classes/com/sun/tools/javac/util/AbstractLog.java Thu Oct 28 18:58:43 2010 -0700 @@ -30,6 +30,7 @@ import javax.tools.JavaFileObject; import com.sun.tools.javac.code.Lint.LintCategory; +import com.sun.tools.javac.util.JCDiagnostic.DiagnosticFlag; import com.sun.tools.javac.util.JCDiagnostic.DiagnosticPosition; import com.sun.tools.javac.util.JCDiagnostic.SimpleDiagnosticPosition; @@ -103,6 +104,19 @@ report(diags.error(source, wrap(pos), key, args)); } + /** Report an error, unless another error was already reported at same + * source position. + * @param flag A flag to set on the diagnostic + * @param pos The source position at which to report the error. + * @param key The key for the localized error message. + * @param args Fields of the error message. + */ + public void error(DiagnosticFlag flag, int pos, String key, Object ... args) { + JCDiagnostic d = diags.error(source, wrap(pos), key, args); + d.setFlag(flag); + report(d); + } + /** Report a warning, unless suppressed by the -nowarn option or the * maximum number of warnings has been reached. * @param pos The source position at which to report the warning.