com.sun.tools.javac.util
Class AbstractLog

java.lang.Object
  extended by com.sun.tools.javac.util.AbstractLog
Direct Known Subclasses:
Log

public abstract class AbstractLog
extends java.lang.Object

A base 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.


Field Summary
protected  JCDiagnostic.Factory diags
          Factory for diagnostics
protected  DiagnosticSource source
          The file that's currently being translated.
protected  java.util.Map<JavaFileObject,DiagnosticSource> sourceMap
          A cache of lightweight DiagnosticSource objects.
 
Constructor Summary
AbstractLog(JCDiagnostic.Factory diags)
           
 
Method Summary
 DiagnosticSource currentSource()
          Return the underlying diagnostic source
protected abstract  void directError(java.lang.String key, java.lang.Object... args)
           
 void error(int pos, java.lang.String key, java.lang.Object... args)
          Report an error, unless another error was already reported at same source position.
 void error(JCDiagnostic.DiagnosticPosition pos, java.lang.String key, java.lang.Object... args)
          Report an error, unless another error was already reported at same source position.
 void error(java.lang.String key, java.lang.Object... args)
          Report an error, unless another error was already reported at same source position.
protected  DiagnosticSource getSource(JavaFileObject file)
           
 void mandatoryNote(JavaFileObject file, java.lang.String key, java.lang.Object... args)
          Provide a non-fatal notification, unless suppressed by the -nowarn option.
 void mandatoryWarning(JCDiagnostic.DiagnosticPosition pos, java.lang.String key, java.lang.Object... args)
          Report a warning.
 void note(int pos, java.lang.String key, java.lang.Object... args)
          Provide a non-fatal notification, unless suppressed by the -nowarn option.
 void note(JavaFileObject file, java.lang.String key, java.lang.Object... args)
          Provide a non-fatal notification, unless suppressed by the -nowarn option.
 void note(JCDiagnostic.DiagnosticPosition pos, java.lang.String key, java.lang.Object... args)
          Provide a non-fatal notification, unless suppressed by the -nowarn option.
 void note(java.lang.String key, java.lang.Object... args)
          Provide a non-fatal notification, unless suppressed by the -nowarn option.
protected abstract  void report(JCDiagnostic diagnostic)
           
 JavaFileObject useSource(JavaFileObject file)
          Re-assign source, returning previous setting.
 void warning(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 warning(JCDiagnostic.DiagnosticPosition 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 warning(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.
private  JCDiagnostic.DiagnosticPosition wrap(int pos)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

diags

protected JCDiagnostic.Factory diags
Factory for diagnostics


source

protected DiagnosticSource source
The file that's currently being translated.


sourceMap

protected java.util.Map<JavaFileObject,DiagnosticSource> sourceMap
A cache of lightweight DiagnosticSource objects.

Constructor Detail

AbstractLog

AbstractLog(JCDiagnostic.Factory diags)
Method Detail

useSource

public JavaFileObject useSource(JavaFileObject file)
Re-assign source, returning previous setting.


getSource

protected DiagnosticSource getSource(JavaFileObject file)

currentSource

public DiagnosticSource currentSource()
Return the underlying diagnostic source


error

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

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

error

public void error(JCDiagnostic.DiagnosticPosition 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.

error

public void error(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.

warning

public void warning(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.

warning

public void warning(JCDiagnostic.DiagnosticPosition 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.

warning

public void warning(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.

mandatoryWarning

public void mandatoryWarning(JCDiagnostic.DiagnosticPosition pos,
                             java.lang.String key,
                             java.lang.Object... args)
Report a warning.

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.

note

public void note(java.lang.String key,
                 java.lang.Object... args)
Provide a non-fatal notification, unless suppressed by the -nowarn option.

Parameters:
key - The key for the localized notification message.
args - Fields of the notint an error or warning message:

note

public void note(JCDiagnostic.DiagnosticPosition pos,
                 java.lang.String key,
                 java.lang.Object... args)
Provide a non-fatal notification, unless suppressed by the -nowarn option.

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

note

public void note(int pos,
                 java.lang.String key,
                 java.lang.Object... args)
Provide a non-fatal notification, unless suppressed by the -nowarn option.

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

note

public void note(JavaFileObject file,
                 java.lang.String key,
                 java.lang.Object... args)
Provide a non-fatal notification, unless suppressed by the -nowarn option.

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

mandatoryNote

public void mandatoryNote(JavaFileObject file,
                          java.lang.String key,
                          java.lang.Object... args)
Provide a non-fatal notification, unless suppressed by the -nowarn option.

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

report

protected abstract void report(JCDiagnostic diagnostic)

directError

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

wrap

private JCDiagnostic.DiagnosticPosition wrap(int pos)