| java.lang.Object com.sun.tools.javac.util.Log
Log | public class Log (Code) | | A class for error logs. Reports errors and warnings, and
keeps track of error numbers and positions.
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.
|
Method Summary | |
public JavaFileObject | currentSource() Return current source name. | final static PrintWriter | defaultWriter(Context context) | public void | error(String key, Object... args) Report an error, unless another error was already reported at same
source position. | public void | error(DiagnosticPosition pos, String key, Object... args) Report an error, unless another error was already reported at same
source position. | public void | error(int pos, String key, Object... args) Report an error, unless another error was already reported at same
source position. | public void | flush() | public static String | format(String fmt, Object... args) | protected char[] | getBuf() | protected static char[] | getCharContent(JavaFileObject fileObject) | protected int | getColumnNumber(int pos) Return the one-based column number associated with a given pos
for the current source file. | protected int | getLineNumber(int pos) Return the one-based line number associated with a given pos
for the current source file. | public static String | getLocalizedString(String key, Object... args) Find a localized string in the resource bundle. | protected PrintWriter | getWriterForDiagnosticType(DiagnosticType dt) | public boolean | hasDiagnosticListener() | public static Log | instance(Context context) Get the Log instance for this context. | public void | mandatoryNote(JavaFileObject file, String key, Object... args) Provide a non-fatal notification, unless suppressed by the -nowarn option. | public void | mandatoryWarning(DiagnosticPosition pos, String key, Object... args) Report a warning. | public void | note(String key, Object... args) Provide a non-fatal notification, unless suppressed by the -nowarn option. | public void | note(DiagnosticPosition pos, String key, Object... args) Provide a non-fatal notification, unless suppressed by the -nowarn option. | public void | note(int pos, String key, Object... args) Provide a non-fatal notification, unless suppressed by the -nowarn option. | public static void | printLines(PrintWriter writer, String msg) Print the text of a message, translating newlines appropriately
for the platform. | public void | prompt() Prompt user after an error. | public void | rawError(int pos, String msg) | public void | rawWarning(int pos, String msg) | public void | report(JCDiagnostic diagnostic) Common diagnostic handling. | protected void | setBuf(char[] newBuf) Re-assign source buffer for existing source name. | public void | setEndPosTable(JavaFileObject name, Map<JCTree, Integer> table) | protected boolean | shouldReport(JavaFileObject file, int pos) Returns true if an error needs to be reported for a given
source name and pos. | public void | strictWarning(DiagnosticPosition pos, String key, Object... args) Report a warning that cannot be suppressed. | public JavaFileObject | useSource(JavaFileObject name) Re-assign source, returning previous setting. | public void | warning(String key, Object... args) Report a warning, unless suppressed by the -nowarn option or the
maximum number of warnings has been reached. | public void | warning(DiagnosticPosition pos, String key, Object... args) Report a warning, unless suppressed by the -nowarn option or the
maximum number of warnings has been reached. | public void | warning(int pos, String key, Object... args) Report a warning, unless suppressed by the -nowarn option or the
maximum number of warnings has been reached. | protected void | writeDiagnostic(JCDiagnostic diag) Write out a diagnostic. |
MaxErrors | final public int MaxErrors(Code) | | The maximum number of errors/warnings that are reported.
|
MaxWarnings | final public int MaxWarnings(Code) | | |
dumpOnError | public boolean dumpOnError(Code) | | Print stack trace on errors?
|
emitWarnings | public boolean emitWarnings(Code) | | Switch: emit warning messages.
|
multipleErrors | public boolean multipleErrors(Code) | | Print multiple errors for same source locations.
|
nerrors | public int nerrors(Code) | | The number of errors encountered so far.
|
nwarnings | public int nwarnings(Code) | | The number of warnings encountered so far.
|
promptOnError | public boolean promptOnError(Code) | | Switch: prompt user on each error.
|
Log | protected Log(Context context)(Code) | | Construct a log with default settings.
|
error | public void error(String key, Object... args)(Code) | | Report an error, unless another error was already reported at same
source position.
Parameters: key - The key for the localized error message. Parameters: args - Fields of the error message. |
error | public void error(DiagnosticPosition pos, String key, Object... args)(Code) | | Report an error, unless another error was already reported at same
source position.
Parameters: pos - The source position at which to report the error. Parameters: key - The key for the localized error message. Parameters: args - Fields of the error message. |
error | public void error(int pos, String key, Object... args)(Code) | | Report an error, unless another error was already reported at same
source position.
Parameters: pos - The source position at which to report the error. Parameters: key - The key for the localized error message. Parameters: args - Fields of the error message. |
flush | public void flush()(Code) | | Flush the logs
|
getBuf | protected char[] getBuf()(Code) | | |
getColumnNumber | protected int getColumnNumber(int pos)(Code) | | Return the one-based column number associated with a given pos
for the current source file. Zero is returned if no column exists
for the given position.
|
getLineNumber | protected int getLineNumber(int pos)(Code) | | Return the one-based line number associated with a given pos
for the current source file. Zero is returned if no line exists
for the given position.
|
getLocalizedString | public static String getLocalizedString(String key, Object... args)(Code) | | Find a localized string in the resource bundle.
Parameters: key - The key for the localized string. Parameters: args - Fields to substitute into the string. |
getWriterForDiagnosticType | protected PrintWriter getWriterForDiagnosticType(DiagnosticType dt)(Code) | | |
hasDiagnosticListener | public boolean hasDiagnosticListener()(Code) | | |
instance | public static Log instance(Context context)(Code) | | Get the Log instance for this context.
|
mandatoryNote | public void mandatoryNote(JavaFileObject file, String key, Object... args)(Code) | | Provide a non-fatal notification, unless suppressed by the -nowarn option.
Parameters: key - The key for the localized notification message. Parameters: args - Fields of the notification message. |
mandatoryWarning | public void mandatoryWarning(DiagnosticPosition pos, String key, Object... args)(Code) | | Report a warning.
Parameters: pos - The source position at which to report the warning. Parameters: key - The key for the localized warning message. Parameters: args - Fields of the warning message. |
note | public void note(String key, Object... args)(Code) | | Provide a non-fatal notification, unless suppressed by the -nowarn option.
Parameters: key - The key for the localized notification message. Parameters: args - Fields of the notification message. |
note | public void note(DiagnosticPosition pos, String key, Object... args)(Code) | | Provide a non-fatal notification, unless suppressed by the -nowarn option.
Parameters: key - The key for the localized notification message. Parameters: args - Fields of the notification message. |
note | public void note(int pos, String key, Object... args)(Code) | | Provide a non-fatal notification, unless suppressed by the -nowarn option.
Parameters: key - The key for the localized notification message. Parameters: args - Fields of the notification message. |
printLines | public static void printLines(PrintWriter writer, String msg)(Code) | | Print the text of a message, translating newlines appropriately
for the platform.
|
prompt | public void prompt()(Code) | | Prompt user after an error.
|
rawError | public void rawError(int pos, String msg)(Code) | | report an error:
|
rawWarning | public void rawWarning(int pos, String msg)(Code) | | report a warning:
|
report | public void report(JCDiagnostic diagnostic)(Code) | | 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.
|
setBuf | protected void setBuf(char[] newBuf)(Code) | | Re-assign source buffer for existing source name.
|
shouldReport | protected boolean shouldReport(JavaFileObject file, int pos)(Code) | | Returns true if an error needs to be reported for a given
source name and pos.
|
strictWarning | public void strictWarning(DiagnosticPosition pos, String key, Object... args)(Code) | | Report a warning that cannot be suppressed.
Parameters: pos - The source position at which to report the warning. Parameters: key - The key for the localized warning message. Parameters: args - Fields of the warning message. |
warning | public void warning(String key, Object... args)(Code) | | 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. Parameters: key - The key for the localized warning message. Parameters: args - Fields of the warning message. |
warning | public void warning(DiagnosticPosition pos, String key, Object... args)(Code) | | 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. Parameters: key - The key for the localized warning message. Parameters: args - Fields of the warning message. |
warning | public void warning(int pos, String key, Object... args)(Code) | | 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. Parameters: key - The key for the localized warning message. Parameters: args - Fields of the warning message. |
writeDiagnostic | protected void writeDiagnostic(JCDiagnostic diag)(Code) | | Write out a diagnostic.
|
|
|