|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.lang.Objectcom.sun.tools.javac.util.MandatoryWarningHandler
public class MandatoryWarningHandler
A handler to process mandatory warnings, setting up a deferred diagnostic to be printed at the end of the compilation if some warnings get suppressed because too many warnings have already been generated. Note that the SuppressWarnings annotation can be used to suppress warnings about conditions that would otherwise merit a warning. Such processing is done when the condition is detected, and in those cases, no call is made on any API to generate a warning at all. In consequence, this handler only gets to handle those warnings that JLS says must be generated.
This is NOT part of any API supported by Sun Microsystems. If you write code that depends on this, you do so at your own risk. This code and its internal interfaces are subject to change or deletion without notice.
| Nested Class Summary | |
|---|---|
private static class |
MandatoryWarningHandler.DeferredDiagnosticKind
The kinds of different deferred diagnostics that might be generated if a mandatory warning is suppressed because too many warnings have already been output. |
| Field Summary | |
|---|---|
private java.lang.Object |
deferredDiagnosticArg
An optional argument to be used when constructing the deferred diagnostic message, based on deferredDiagnosticKind. |
private MandatoryWarningHandler.DeferredDiagnosticKind |
deferredDiagnosticKind
A variable indicating the latest best guess at what the final deferred diagnostic will be. |
private JavaFileObject |
deferredDiagnosticSource
If deferredDiagnosticKind is IN_FILE or ADDITIONAL_IN_FILE, this variable gives the value of log.currentSource() for the file in question. |
private boolean |
enforceMandatory
True if mandatory warnings and notes are being enforced. |
private Log |
log
The log to which to report warnings. |
private java.lang.String |
prefix
The common prefix for all I18N message keys generated by this handler. |
private java.util.Set<JavaFileObject> |
sourcesWithReportedWarnings
A set containing the names of the source files for which specific warnings have been generated -- i.e. |
private boolean |
verbose
Whether or not to report individual warnings, or simply to report a single aggregate warning at the end of the compilation. |
| Constructor Summary | |
|---|---|
MandatoryWarningHandler(Log log,
boolean verbose,
boolean enforceMandatory,
java.lang.String prefix)
Create a handler for mandatory warnings. |
|
| Method Summary | |
|---|---|
private static boolean |
equal(java.lang.Object o1,
java.lang.Object o2)
Check two objects, each possibly null, are either both null or are equal. |
private void |
logMandatoryNote(JavaFileObject file,
java.lang.String msg,
java.lang.Object... args)
Reports a mandatory note to the log. |
private void |
logMandatoryWarning(JCDiagnostic.DiagnosticPosition pos,
java.lang.String msg,
java.lang.Object... args)
Reports a mandatory warning to the log. |
void |
report(JCDiagnostic.DiagnosticPosition pos,
java.lang.String msg,
java.lang.Object... args)
Report a mandatory warning. |
void |
reportDeferredDiagnostic()
Report any diagnostic that might have been deferred by previous calls of report(). |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
|---|
private Log log
private boolean verbose
private java.lang.String prefix
private java.util.Set<JavaFileObject> sourcesWithReportedWarnings
private MandatoryWarningHandler.DeferredDiagnosticKind deferredDiagnosticKind
private JavaFileObject deferredDiagnosticSource
private java.lang.Object deferredDiagnosticArg
private final boolean enforceMandatory
| Constructor Detail |
|---|
public MandatoryWarningHandler(Log log,
boolean verbose,
boolean enforceMandatory,
java.lang.String prefix)
log - The log on which to generate any diagnosticsverbose - Specify whether or not detailed messages about
individual instances should be given, or whether an aggregate
message should be generated at the end of the compilation.
Typically set via -Xlint:option.enforceMandatory - True if mandatory warnings and notes are being enforced.prefix - A common prefix for the set of message keys for
the messages that may be generated.| Method Detail |
|---|
public void report(JCDiagnostic.DiagnosticPosition pos,
java.lang.String msg,
java.lang.Object... args)
public void reportDeferredDiagnostic()
private static boolean equal(java.lang.Object o1,
java.lang.Object o2)
private void logMandatoryWarning(JCDiagnostic.DiagnosticPosition pos,
java.lang.String msg,
java.lang.Object... args)
private void logMandatoryNote(JavaFileObject file,
java.lang.String msg,
java.lang.Object... args)
|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||