com.sun.tools.apt.util
Class Bark

java.lang.Object
  extended by com.sun.tools.javac.util.AbstractLog
      extended by com.sun.tools.javac.util.Log
          extended by com.sun.tools.apt.util.Bark

public class Bark
extends Log

A subtype of Log for use in APT.

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.


Field Summary
private  JCDiagnostic.Factory aptDiags
          Factory for APT-specific diagnostics.
protected static Context.Key<Bark> barkKey
          The context key for the bark.
private  boolean ignoreDiagnostics
          Specifies whether or not to ignore any diagnostics that are reported.
 
Fields inherited from class com.sun.tools.javac.util.Log
diagListener, dumpOnError, emitWarnings, errWriter, expectDiagKeys, logKey, MaxErrors, MaxWarnings, multipleErrors, nerrors, noticeWriter, nwarnings, outKey, promptOnError, warnWriter
 
Fields inherited from class com.sun.tools.javac.util.AbstractLog
diags, source, sourceMap
 
Constructor Summary
protected Bark(Context context)
          Creates a Bark.
 
Method Summary
 void aptError(int pos, java.lang.String key, java.lang.Object... args)
          Report an error, unless another error was already reported at same source position.
 void aptError(java.lang.String key, java.lang.Object... args)
          Report an error.
 void aptNote(int pos, java.lang.String key, java.lang.Object... args)
          Report a note, unless suppressed by the -nowarn option.
 void aptNote(java.lang.String key, java.lang.Object... args)
          Report a note, unless suppressed by the -nowarn option.
 void aptWarning(int pos, java.lang.String key, java.lang.Object... args)
          Report a warning, unless suppressed by the -nowarn option or the maximum number of warnings has been reached.
 void aptWarning(java.lang.String key, java.lang.Object... args)
          Report a warning, unless suppressed by the -nowarn option or the maximum number of warnings has been reached.
static Bark instance(Context context)
          Get the Bark instance for this context.
static void preRegister(Context context)
          Preregisters factories to create and use a Bark object for use as both a Log and a Bark.
 void report(JCDiagnostic diagnostic)
          Report a diagnostic if they are not currently being ignored.
 boolean setDiagnosticsIgnored(boolean b)
          Sets a flag indicating whether or not to ignore all diagnostics.
 
Methods inherited from class com.sun.tools.javac.util.Log
currentSourceFile, directError, flush, format, getLocalizedString, getWriterForDiagnosticType, hasDiagnosticListener, printLines, prompt, rawError, rawWarning, setEndPosTable, shouldReport, strictWarning, writeDiagnostic
 
Methods inherited from class com.sun.tools.javac.util.AbstractLog
currentSource, error, error, error, getSource, mandatoryNote, mandatoryWarning, note, note, note, note, useSource, warning, warning, warning
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

barkKey

protected static final Context.Key<Bark> barkKey
The context key for the bark.


ignoreDiagnostics

private boolean ignoreDiagnostics
Specifies whether or not to ignore any diagnostics that are reported.


aptDiags

private JCDiagnostic.Factory aptDiags
Factory for APT-specific diagnostics.

Constructor Detail

Bark

protected Bark(Context context)
Creates a Bark.

Method Detail

preRegister

public static void preRegister(Context context)
Preregisters factories to create and use a Bark object for use as both a Log and a Bark.


instance

public static Bark instance(Context context)
Get the Bark instance for this context.


setDiagnosticsIgnored

public boolean setDiagnosticsIgnored(boolean b)
Sets a flag indicating whether or not to ignore all diagnostics. When ignored, they are not reported to the output writers, not are they counted in the various counters.

Parameters:
b - If true, subsequent diagnostics will be ignored.
Returns:
the previous state of the flag

report

public void report(JCDiagnostic diagnostic)
Report a diagnostic if they are not currently being ignored.

Overrides:
report in class Log

aptError

public void aptError(java.lang.String key,
                     java.lang.Object... args)
Report an error.

Parameters:
key - The key for the localized error message.
args - Fields of the error message.

aptError

public void aptError(int pos,
                     java.lang.String key,
                     java.lang.Object... args)
Report an error, unless another error was already reported at same source position.

Parameters:
pos - The source position at which to report the error.
key - The key for the localized error message.
args - Fields of the error message.

aptWarning

public void aptWarning(java.lang.String key,
                       java.lang.Object... args)
Report a warning, unless suppressed by the -nowarn option or the maximum number of warnings has been reached.

Parameters:
key - The key for the localized warning message.
args - Fields of the warning message.

aptWarning

public void aptWarning(int pos,
                       java.lang.String key,
                       java.lang.Object... args)
Report a warning, unless suppressed by the -nowarn option or the maximum number of warnings has been reached.

Parameters:
pos - The source position at which to report the warning.
key - The key for the localized warning message.
args - Fields of the warning message.

aptNote

public void aptNote(java.lang.String key,
                    java.lang.Object... args)
Report a note, unless suppressed by the -nowarn option.

Parameters:
key - The key for the localized note message.
args - Fields of the note message.

aptNote

public void aptNote(int pos,
                    java.lang.String key,
                    java.lang.Object... args)
Report a note, unless suppressed by the -nowarn option.

Parameters:
pos - The source position at which to report the note.
key - The key for the localized note message.
args - Fields of the note message.