/** Report selected deferred diagnostics. */ public void reportDeferredDiagnostics(Set<JCDiagnostic.Kind> kinds) { JCDiagnostic d; while ((d = deferred.poll()) != null) { if (kinds.contains(d.getKind())) prev.report(d); } deferred = null; // prevent accidental ongoing use }
public void report(JCDiagnostic diag) { if (!diag.isFlagSet(JCDiagnostic.DiagnosticFlag.NON_DEFERRABLE) && (filter == null || filter.accepts(diag))) { deferred.add(diag); } else { prev.report(diag); } }
public void report(JCDiagnostic diagnostic) { if (expectDiagKeys != null) expectDiagKeys.remove(diagnostic.getCode()); switch (diagnostic.getType()) { case FRAGMENT: throw new IllegalArgumentException(); case NOTE: // Print out notes only when we are permitted to report warnings // Notes are only generated at the end of a compilation, so should be small // in number. if ((emitWarnings || diagnostic.isMandatory()) && !suppressNotes) { writeDiagnostic(diagnostic); } break; case WARNING: if (emitWarnings || diagnostic.isMandatory()) { if (nwarnings < MaxWarnings) { writeDiagnostic(diagnostic); nwarnings++; } } break; case ERROR: if (nerrors < MaxErrors && shouldReport(diagnostic.getSource(), diagnostic.getIntPosition())) { writeDiagnostic(diagnostic); nerrors++; } break; } }
/** Write out a diagnostic. */ protected void writeDiagnostic(JCDiagnostic diag) { if (diagListener != null) { diagListener.report(diag); return; } PrintWriter writer = getWriterForDiagnosticType(diag.getType()); printRawLines(writer, diagFormatter.format(diag, messages.getCurrentLocale())); if (promptOnError) { switch (diag.getType()) { case ERROR: case WARNING: prompt(); } } if (dumpOnError) new RuntimeException().printStackTrace(writer); writer.flush(); }