--- a/langtools/src/share/classes/com/sun/tools/javac/util/Log.java Fri Aug 27 17:59:08 2010 -0700
+++ b/langtools/src/share/classes/com/sun/tools/javac/util/Log.java Mon Aug 30 18:03:35 2010 -0700
@@ -27,8 +27,10 @@
import java.io.*;
import java.util.Arrays;
+import java.util.EnumSet;
import java.util.HashSet;
import java.util.Map;
+import java.util.Queue;
import java.util.Set;
import javax.tools.DiagnosticListener;
import javax.tools.JavaFileObject;
@@ -110,6 +112,12 @@
*/
private JavacMessages messages;
+ /**
+ * Deferred diagnostics
+ */
+ public boolean deferDiagnostics;
+ public Queue<JCDiagnostic> deferredDiagnostics = new ListBuffer<JCDiagnostic>();
+
/** Construct a log with given I/O redirections.
*/
@Deprecated
@@ -204,12 +212,6 @@
*/
public int nwarnings = 0;
- /**
- * Whether or not an unrecoverable error has been seen.
- * Unrecoverable errors prevent subsequent annotation processing.
- */
- public boolean unrecoverableError;
-
/** A set of all errors generated so far. This is used to avoid printing an
* error message more than once. For each error, a pair consisting of the
* source file name and source code position of the error is added to the set.
@@ -347,12 +349,32 @@
nwarnings++;
}
+ /** Report all deferred diagnostics, and clear the deferDiagnostics flag. */
+ public void reportDeferredDiagnostics() {
+ reportDeferredDiagnostics(EnumSet.allOf(JCDiagnostic.Kind.class));
+ }
+
+ /** Report selected deferred diagnostics, and clear the deferDiagnostics flag. */
+ public void reportDeferredDiagnostics(Set<JCDiagnostic.Kind> kinds) {
+ deferDiagnostics = false;
+ JCDiagnostic d;
+ while ((d = deferredDiagnostics.poll()) != null) {
+ if (kinds.contains(d.getKind()))
+ report(d);
+ }
+ }
+
/**
* Common diagnostic handling.
* The diagnostic is counted, and depending on the options and how many diagnostics have been
* reported so far, the diagnostic may be handed off to writeDiagnostic.
*/
public void report(JCDiagnostic diagnostic) {
+ if (deferDiagnostics) {
+ deferredDiagnostics.add(diagnostic);
+ return;
+ }
+
if (expectDiagKeys != null)
expectDiagKeys.remove(diagnostic.getCode());