com.sun.tools.javac.util
Class BasicDiagnosticFormatter
java.lang.Object
com.sun.tools.javac.util.AbstractDiagnosticFormatter
com.sun.tools.javac.util.BasicDiagnosticFormatter
- All Implemented Interfaces:
- DiagnosticFormatter<JCDiagnostic>
public class BasicDiagnosticFormatter
- extends AbstractDiagnosticFormatter
A basic formatter for diagnostic messages.
The basic formatter will format a diagnostic according to one of three format patterns, depending on whether
or not the source name and position are set. The formatter supports a printf-like string for patterns
with the following special characters:
- %b: the base of the source name
- %f: the source name (full absolute path)
- %l: the line number of the diagnostic, derived from the character offset
- %c: the column number of the diagnostic, derived from the character offset
- %o: the character offset of the diagnostic if set
- %p: the prefix for the diagnostic, derived from the diagnostic type
- %t: the prefix as it normally appears in standard diagnostics. In this case, no prefix is
shown if the type is ERROR and if a source name is set
- %m: the text or the diagnostic, including any appropriate arguments
- %_: space delimiter, useful for formatting purposes
| Methods inherited from class com.sun.tools.javac.util.AbstractDiagnosticFormatter |
displaySource, formatArgument, formatArguments, formatIterable, formatKind, formatMessage, formatPosition, formatSource, formatSourceLine, formatSubdiagnostics, getPosition, indent, indentString, localize |
| Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
availableFormats
protected java.util.Map<BasicDiagnosticFormatter.BasicFormatKind,java.lang.String> availableFormats
BasicDiagnosticFormatter
BasicDiagnosticFormatter(Options opts,
JavacMessages msgs)
- Create a basic formatter based on the supplied options.
- Parameters:
opts - list of command-line optionsmsgs - JavacMessages object used for i18n
BasicDiagnosticFormatter
public BasicDiagnosticFormatter(JavacMessages msgs)
- Create a standard basic formatter
- Parameters:
msgs - JavacMessages object used for i18n
initAvailableFormats
public void initAvailableFormats()
format
public java.lang.String format(JCDiagnostic d,
java.util.Locale l)
- Description copied from interface:
DiagnosticFormatter
- Format the contents of a diagnostics
- Parameters:
d - the diagnostic to be formattedl - locale object to be used for i18n
- Returns:
- a string representing the diagnostic
formatMeta
protected java.lang.String formatMeta(char c,
JCDiagnostic d,
java.util.Locale l)
selectFormat
private java.lang.String selectFormat(JCDiagnostic d)