Top Description Fields Constructors Methods
com.sun.tools.javac.util

public abstract Class AbstractLog

extends Object
Class Inheritance
Known Direct Subclasses
com.sun.tools.javac.util.Log
Imports
java.util.HashMap, .Map, javax.tools.JavaFileObject, com.sun.tools.javac.code.Lint.LintCategory, com.sun.tools.javac.util.JCDiagnostic.DiagnosticFlag, .JCDiagnostic.Error, .JCDiagnostic.Note, .JCDiagnostic.Warning, .JCDiagnostic.DiagnosticPosition, .JCDiagnostic.SimpleDiagnosticPosition

A base class for error logs. Reports errors and warnings, and keeps track of error numbers and positions.

This is NOT part of any supported API. 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

Modifier and TypeField and Description
public final JCDiagnostic.Factory
diags

Factory for diagnostics

protected DiagnosticSource
source

The file that's currently being translated.

protected Map<JavaFileObject, DiagnosticSource>
sourceMap

A cache of lightweight DiagnosticSource objects.

Constructor Summary

AccessConstructor and Description
pack-priv

Method Summary

Modifier and TypeMethod and Description
public DiagnosticSource
currentSource()

Return the underlying diagnostic source

protected abstract void
directError(String key, Object... args)

public void
error(String
The key for the localized error message.
key
,
Object...
Fields of the error message.
args
)

Report an error, unless another error was already reported at same source position.

public void
error(JCDiagnostic.Error
The key for the localized error message.
errorKey
)

Report an error, unless another error was already reported at same source position.

public void
error(JCDiagnostic.DiagnosticPosition
The source position at which to report the error.
pos
,
JCDiagnostic.Error
The key for the localized error message.
errorKey
)

Report an error, unless another error was already reported at same source position.

public void
error(JCDiagnostic.DiagnosticFlag
A flag to set on the diagnostic
flag
,
JCDiagnostic.DiagnosticPosition
The source position at which to report the error.
pos
,
JCDiagnostic.Error
The key for the localized error message.
errorKey
)

Report an error, unless another error was already reported at same source position.

public void
error(int
The source position at which to report the error.
pos
,
String
The key for the localized error message.
key
,
Object...
Fields of the error message.
args
)

Report an error, unless another error was already reported at same source position.

public void
error(int
The source position at which to report the error.
pos
,
JCDiagnostic.Error
The key for the localized error message.
errorKey
)

Report an error, unless another error was already reported at same source position.

public void
error(JCDiagnostic.DiagnosticFlag
A flag to set on the diagnostic
flag
,
int
The source position at which to report the error.
pos
,
JCDiagnostic.Error
The key for the localized error message.
errorKey
)

Report an error, unless another error was already reported at same source position.

protected DiagnosticSource
public void
mandatoryNote(final JavaFileObject file, JCDiagnostic.Note
The key for the localized notification message.
noteKey
)

Provide a non-fatal notification, unless suppressed by the -nowarn option.

public void
mandatoryWarning(JCDiagnostic.DiagnosticPosition
The source position at which to report the warning.
pos
,
JCDiagnostic.Warning
The key for the localized warning message.
warningKey
)

Report a warning.

public void
mandatoryWarning(Lint.LintCategory
The lint category for the diagnostic
lc
,
JCDiagnostic.DiagnosticPosition
The source position at which to report the warning.
pos
,
JCDiagnostic.Warning
The key for the localized warning message.
warningKey
)

Report a warning.

public void
note(JCDiagnostic.Note
The key for the localized notification message.
noteKey
)

Provide a non-fatal notification, unless suppressed by the -nowarn option.

public void
note(JCDiagnostic.DiagnosticPosition pos, JCDiagnostic.Note
The key for the localized notification message.
noteKey
)

Provide a non-fatal notification, unless suppressed by the -nowarn option.

public void
note(int pos, JCDiagnostic.Note
The key for the localized notification message.
noteKey
)

Provide a non-fatal notification, unless suppressed by the -nowarn option.

public void
note(JavaFileObject file, JCDiagnostic.Note
The key for the localized notification message.
noteKey
)

Provide a non-fatal notification, unless suppressed by the -nowarn option.

protected abstract void
report(JCDiagnostic diagnostic)

public JavaFileObject
useSource(JavaFileObject file)

Re-assign source, returning previous setting.

public void
warning(JCDiagnostic.Warning
The key for the localized warning message.
warningKey
)

Report a warning, unless suppressed by the -nowarn option or the maximum number of warnings has been reached.

public void
warning(Lint.LintCategory
The lint category for the diagnostic
lc
,
JCDiagnostic.Warning
The key for the localized warning message.
warningKey
)

Report a lint warning, unless suppressed by the -nowarn option or the maximum number of warnings has been reached.

public void
warning(JCDiagnostic.DiagnosticPosition
The source position at which to report the warning.
pos
,
JCDiagnostic.Warning
The key for the localized warning message.
warningKey
)

Report a warning, unless suppressed by the -nowarn option or the maximum number of warnings has been reached.

public void
warning(Lint.LintCategory
The lint category for the diagnostic
lc
,
JCDiagnostic.DiagnosticPosition
The source position at which to report the warning.
pos
,
JCDiagnostic.Warning
The key for the localized warning message.
warningKey
)

Report a lint warning, unless suppressed by the -nowarn option or the maximum number of warnings has been reached.

public void
warning(int
The source position at which to report the warning.
pos
,
JCDiagnostic.Warning
The key for the localized warning message.
warningKey
)

Report a warning, unless suppressed by the -nowarn option or the maximum number of warnings has been reached.

private JCDiagnostic.DiagnosticPosition
wrap(int pos)

Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Field Detail

diagsback to summary
public final JCDiagnostic.Factory diags

Factory for diagnostics

sourceback to summary
protected DiagnosticSource source

The file that's currently being translated.

sourceMapback to summary
protected Map<JavaFileObject, DiagnosticSource> sourceMap

A cache of lightweight DiagnosticSource objects.

Constructor Detail

AbstractLogback to summary
pack-priv AbstractLog(JCDiagnostic.Factory diags)

Method Detail

currentSourceback to summary
public DiagnosticSource currentSource()

Return the underlying diagnostic source

directErrorback to summary
protected abstract void directError(String key, Object... args)
errorback to summary
public void error(String key, Object... args)

Report an error, unless another error was already reported at same source position.

Parameters
key:String

The key for the localized error message.

args:Object[]

Fields of the error message.

errorback to summary
public void error(JCDiagnostic.Error errorKey)

Report an error, unless another error was already reported at same source position.

Parameters
errorKey:JCDiagnostic.Error

The key for the localized error message.

errorback to summary
public void error(JCDiagnostic.DiagnosticPosition pos, JCDiagnostic.Error errorKey)

Report an error, unless another error was already reported at same source position.

Parameters
pos:JCDiagnostic.DiagnosticPosition

The source position at which to report the error.

errorKey:JCDiagnostic.Error

The key for the localized error message.

errorback to summary
public void error(JCDiagnostic.DiagnosticFlag flag, JCDiagnostic.DiagnosticPosition pos, JCDiagnostic.Error errorKey)

Report an error, unless another error was already reported at same source position.

Parameters
flag:JCDiagnostic.DiagnosticFlag

A flag to set on the diagnostic

pos:JCDiagnostic.DiagnosticPosition

The source position at which to report the error.

errorKey:JCDiagnostic.Error

The key for the localized error message.

errorback to summary
public void error(int pos, String key, Object... args)

Report an error, unless another error was already reported at same source position.

Parameters
pos:int

The source position at which to report the error.

key:String

The key for the localized error message.

args:Object[]

Fields of the error message.

errorback to summary
public void error(int pos, JCDiagnostic.Error errorKey)

Report an error, unless another error was already reported at same source position.

Parameters
pos:int

The source position at which to report the error.

errorKey:JCDiagnostic.Error

The key for the localized error message.

errorback to summary
public void error(JCDiagnostic.DiagnosticFlag flag, int pos, JCDiagnostic.Error errorKey)

Report an error, unless another error was already reported at same source position.

Parameters
flag:JCDiagnostic.DiagnosticFlag

A flag to set on the diagnostic

pos:int

The source position at which to report the error.

errorKey:JCDiagnostic.Error

The key for the localized error message.

getSourceback to summary
protected DiagnosticSource getSource(JavaFileObject file)
mandatoryNoteback to summary
public void mandatoryNote(final JavaFileObject file, JCDiagnostic.Note noteKey)

Provide a non-fatal notification, unless suppressed by the -nowarn option.

Parameters
noteKey:JCDiagnostic.Note

The key for the localized notification message.

mandatoryWarningback to summary
public void mandatoryWarning(JCDiagnostic.DiagnosticPosition pos, JCDiagnostic.Warning warningKey)

Report a warning.

Parameters
pos:JCDiagnostic.DiagnosticPosition

The source position at which to report the warning.

warningKey:JCDiagnostic.Warning

The key for the localized warning message.

mandatoryWarningback to summary
public void mandatoryWarning(Lint.LintCategory lc, JCDiagnostic.DiagnosticPosition pos, JCDiagnostic.Warning warningKey)

Report a warning.

Parameters
lc:Lint.LintCategory

The lint category for the diagnostic

pos:JCDiagnostic.DiagnosticPosition

The source position at which to report the warning.

warningKey:JCDiagnostic.Warning

The key for the localized warning message.

noteback to summary
public void note(JCDiagnostic.Note noteKey)

Provide a non-fatal notification, unless suppressed by the -nowarn option.

Parameters
noteKey:JCDiagnostic.Note

The key for the localized notification message.

noteback to summary
public void note(JCDiagnostic.DiagnosticPosition pos, JCDiagnostic.Note noteKey)

Provide a non-fatal notification, unless suppressed by the -nowarn option.

Parameters
noteKey:JCDiagnostic.Note

The key for the localized notification message.

noteback to summary
public void note(int pos, JCDiagnostic.Note noteKey)

Provide a non-fatal notification, unless suppressed by the -nowarn option.

Parameters
noteKey:JCDiagnostic.Note

The key for the localized notification message.

noteback to summary
public void note(JavaFileObject file, JCDiagnostic.Note noteKey)

Provide a non-fatal notification, unless suppressed by the -nowarn option.

Parameters
noteKey:JCDiagnostic.Note

The key for the localized notification message.

reportback to summary
protected abstract void report(JCDiagnostic diagnostic)
useSourceback to summary
public JavaFileObject useSource(JavaFileObject file)

Re-assign source, returning previous setting.

warningback to summary
public void warning(JCDiagnostic.Warning warningKey)

Report a warning, unless suppressed by the -nowarn option or the maximum number of warnings has been reached.

Parameters
warningKey:JCDiagnostic.Warning

The key for the localized warning message.

warningback to summary
public void warning(Lint.LintCategory lc, JCDiagnostic.Warning warningKey)

Report a lint warning, unless suppressed by the -nowarn option or the maximum number of warnings has been reached.

Parameters
lc:Lint.LintCategory

The lint category for the diagnostic

warningKey:JCDiagnostic.Warning

The key for the localized warning message.

warningback to summary
public void warning(JCDiagnostic.DiagnosticPosition pos, JCDiagnostic.Warning warningKey)

Report a warning, unless suppressed by the -nowarn option or the maximum number of warnings has been reached.

Parameters
pos:JCDiagnostic.DiagnosticPosition

The source position at which to report the warning.

warningKey:JCDiagnostic.Warning

The key for the localized warning message.

warningback to summary
public void warning(Lint.LintCategory lc, JCDiagnostic.DiagnosticPosition pos, JCDiagnostic.Warning warningKey)

Report a lint warning, unless suppressed by the -nowarn option or the maximum number of warnings has been reached.

Parameters
lc:Lint.LintCategory

The lint category for the diagnostic

pos:JCDiagnostic.DiagnosticPosition

The source position at which to report the warning.

warningKey:JCDiagnostic.Warning

The key for the localized warning message.

warningback to summary
public void warning(int pos, JCDiagnostic.Warning warningKey)

Report a warning, unless suppressed by the -nowarn option or the maximum number of warnings has been reached.

Parameters
pos:int

The source position at which to report the warning.

warningKey:JCDiagnostic.Warning

The key for the localized warning message.

wrapback to summary
private JCDiagnostic.DiagnosticPosition wrap(int pos)