Top Description Inners Methods
com.sun.tools.javac.api

public Interface DiagnosticFormatter<D extends Diagnostic<?>>

Known Direct Implementers
com.sun.tools.javac.util.ForwardingDiagnosticFormatter, com.sun.tools.javac.util.AbstractDiagnosticFormatter
Type Parameters
<D>
type of diagnostic handled by this formatter

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.

Imports
java.util.Locale, .Set, javax.tools.Diagnostic, com.sun.tools.javac.api.DiagnosticFormatter.*

Provides simple functionalities for javac diagnostic formatting.

Nested and Inner Type Summary

Modifier and TypeClass and Description
public static interface
DiagnosticFormatter.Configuration

This interface provides functionalities for tuning the output of a diagnostic formatter in multiple ways.

public static enum
DiagnosticFormatter.PositionKind

This enum defines a set of constants for all the kinds of position that a diagnostic can be asked for.

Method Summary

Modifier and TypeMethod and Description
public boolean

Returns:

true if the source line this diagnostic refers to is to be displayed
displaySource
(D
diagnostic to be formatted
diag
)

Whether the source code output for this diagnostic is to be displayed.

public String

Returns:

a string representing the diagnostic
format
(D
the diagnostic to be formatted
diag
,
Locale
locale object to be used for i18n
l
)

Format the contents of a diagnostics.

public String

Returns:

string representation of the diagnostic prefix
formatKind
(D
diagnostic to be formatted
diag
,
Locale
locale object to be used for i18n
l
)

Controls the way in which a diagnostic kind is displayed.

public String

Returns:

string representation of the diagnostic message
formatMessage
(D
diagnostic to be formatted
diag
,
Locale
locale object to be used for i18n
l
)

Controls the way in which a diagnostic message is displayed.

public String

Returns:

string representation of the diagnostic position
formatPosition
(D
diagnostic to be formatted
diag
,
DiagnosticFormatter.PositionKind
enum constant representing the position kind
pk
,
Locale
locale object to be used for i18n
l
)

Controls the way in which a diagnostic position is displayed.

public String

Returns:

string representation of the diagnostic source
formatSource
(D
diagnostic to be formatted
diag
,
boolean
whether the source fullname should be printed
fullname
,
Locale
locale object to be used for i18n
l
)

Controls the way in which a diagnostic source is displayed.

public DiagnosticFormatter.Configuration

Returns:

verbosity options
getConfiguration
()

Get a list of all the enabled verbosity options.

Method Detail

displaySourceback to summary
public boolean displaySource(D diag)

Whether the source code output for this diagnostic is to be displayed.

Parameters
diag:D

diagnostic to be formatted

Returns:boolean

true if the source line this diagnostic refers to is to be displayed

formatback to summary
public String format(D diag, Locale l)

Format the contents of a diagnostics.

Parameters
diag:D

the diagnostic to be formatted

l:Locale

locale object to be used for i18n

Returns:String

a string representing the diagnostic

formatKindback to summary
public String formatKind(D diag, Locale l)

Controls the way in which a diagnostic kind is displayed.

Parameters
diag:D

diagnostic to be formatted

l:Locale

locale object to be used for i18n

Returns:String

string representation of the diagnostic prefix

formatMessageback to summary
public String formatMessage(D diag, Locale l)

Controls the way in which a diagnostic message is displayed.

Parameters
diag:D

diagnostic to be formatted

l:Locale

locale object to be used for i18n

Returns:String

string representation of the diagnostic message

formatPositionback to summary
public String formatPosition(D diag, DiagnosticFormatter.PositionKind pk, Locale l)

Controls the way in which a diagnostic position is displayed.

Parameters
diag:D

diagnostic to be formatted

pk:DiagnosticFormatter.PositionKind

enum constant representing the position kind

l:Locale

locale object to be used for i18n

Returns:String

string representation of the diagnostic position

formatSourceback to summary
public String formatSource(D diag, boolean fullname, Locale l)

Controls the way in which a diagnostic source is displayed.

Parameters
diag:D

diagnostic to be formatted

fullname:boolean

whether the source fullname should be printed

l:Locale

locale object to be used for i18n

Returns:String

string representation of the diagnostic source

getConfigurationback to summary
public DiagnosticFormatter.Configuration getConfiguration()

Get a list of all the enabled verbosity options.

Returns:DiagnosticFormatter.Configuration

verbosity options

com.sun.tools.javac.api back to summary

public Interface DiagnosticFormatter.Configuration

Known Direct Implementers
com.sun.tools.javac.util.ForwardingDiagnosticFormatter.ForwardingConfiguration, com.sun.tools.javac.util.AbstractDiagnosticFormatter.SimpleConfiguration

This interface provides functionalities for tuning the output of a diagnostic formatter in multiple ways.

Nested and Inner Type Summary

Modifier and TypeClass and Description
public static enum
DiagnosticFormatter.Configuration.DiagnosticPart

A given diagnostic message can be divided into sub-parts each of which might/might not be displayed by the formatter, according to the current configuration settings.

public static enum
DiagnosticFormatter.Configuration.MultilineLimit

A multiline limit control the verbosity of multiline diagnostics either by setting a maximum depth of nested multidiagnostics, or by limiting the amount of subdiagnostics attached to a given diagnostic (or both).

Method Summary

Modifier and TypeMethod and Description
public int

Returns:

limit value or -1 if no limit is set
getMultilineLimit
(DiagnosticFormatter.Configuration.MultilineLimit
the kind of limit to be retrieved
limit
)

Get a multiline diagnostic limit.

public Set<DiagnosticFormatter.Configuration.DiagnosticPart>

Returns:

verbosity options
getVisible
()

Retrieve the set of diagnostic parts that should be displayed by the formatter.

public void
setMultilineLimit(DiagnosticFormatter.Configuration.MultilineLimit
the kind of limit to be set
limit
,
int
the limit value
value
)

Set a limit for multiline diagnostics.

public void
setVisible(Set<DiagnosticFormatter.Configuration.DiagnosticPart>
the parts to be set
visibleParts
)

Configure the set of diagnostic parts that should be displayed by the formatter.

Method Detail

getMultilineLimitback to summary
public int getMultilineLimit(DiagnosticFormatter.Configuration.MultilineLimit limit)

Get a multiline diagnostic limit.

Parameters
limit:DiagnosticFormatter.Configuration.MultilineLimit

the kind of limit to be retrieved

Returns:int

limit value or -1 if no limit is set

getVisibleback to summary
public Set<DiagnosticFormatter.Configuration.DiagnosticPart> getVisible()

Retrieve the set of diagnostic parts that should be displayed by the formatter.

Returns:Set<DiagnosticFormatter.Configuration.DiagnosticPart>

verbosity options

setMultilineLimitback to summary
public void setMultilineLimit(DiagnosticFormatter.Configuration.MultilineLimit limit, int value)

Set a limit for multiline diagnostics.

Note

Setting a limit has no effect if multiline diagnostics are either fully enabled or disabled.

Parameters
limit:DiagnosticFormatter.Configuration.MultilineLimit

the kind of limit to be set

value:int

the limit value

setVisibleback to summary
public void setVisible(Set<DiagnosticFormatter.Configuration.DiagnosticPart> visibleParts)

Configure the set of diagnostic parts that should be displayed by the formatter.

Parameters
visibleParts:Set<DiagnosticFormatter.Configuration.DiagnosticPart>

the parts to be set

com.sun.tools.javac.api back to summary

public final Enum DiagnosticFormatter.Configuration.DiagnosticPart

extends Enum<DiagnosticFormatter.Configuration.DiagnosticPart>
Class Inheritance

A given diagnostic message can be divided into sub-parts each of which might/might not be displayed by the formatter, according to the current configuration settings.

Field Summary

Modifier and TypeField and Description
public static final DiagnosticFormatter.Configuration.DiagnosticPart
DETAILS

Longer description that provides additional details w.r.t. the ones in the diagnostic's description.

public static final DiagnosticFormatter.Configuration.DiagnosticPart
JLS

JLS paragraph this diagnostic might refer to (if applicable).

public static final DiagnosticFormatter.Configuration.DiagnosticPart
SOURCE

Source line the diagnostic refers to (if applicable).

public static final DiagnosticFormatter.Configuration.DiagnosticPart
SUBDIAGNOSTICS

Subdiagnostics attached to a given multiline diagnostic.

public static final DiagnosticFormatter.Configuration.DiagnosticPart
SUMMARY

Short description of the diagnostic - usually one line long.

Constructor Summary

AccessConstructor and Description
private

Field Detail

DETAILSback to summary
public static final DiagnosticFormatter.Configuration.DiagnosticPart DETAILS

Longer description that provides additional details w.r.t. the ones in the diagnostic's description.

JLSback to summary
public static final DiagnosticFormatter.Configuration.DiagnosticPart JLS

JLS paragraph this diagnostic might refer to (if applicable).

SOURCEback to summary
public static final DiagnosticFormatter.Configuration.DiagnosticPart SOURCE

Source line the diagnostic refers to (if applicable).

SUBDIAGNOSTICSback to summary
public static final DiagnosticFormatter.Configuration.DiagnosticPart SUBDIAGNOSTICS

Subdiagnostics attached to a given multiline diagnostic.

SUMMARYback to summary
public static final DiagnosticFormatter.Configuration.DiagnosticPart SUMMARY

Short description of the diagnostic - usually one line long.

Constructor Detail

DiagnosticPartback to summary
private DiagnosticPart()

Method Detail

valueOfback to summary
public static DiagnosticFormatter.Configuration.DiagnosticPart valueOf(String name)
valuesback to summary
public static DiagnosticFormatter.Configuration.DiagnosticPart[] values()
com.sun.tools.javac.api back to summary

public final Enum DiagnosticFormatter.Configuration.MultilineLimit

extends Enum<DiagnosticFormatter.Configuration.MultilineLimit>
Class Inheritance

A multiline limit control the verbosity of multiline diagnostics either by setting a maximum depth of nested multidiagnostics, or by limiting the amount of subdiagnostics attached to a given diagnostic (or both).

Field Summary

Modifier and TypeField and Description
public static final DiagnosticFormatter.Configuration.MultilineLimit
DEPTH

Controls the maximum depth of nested multiline diagnostics.

public static final DiagnosticFormatter.Configuration.MultilineLimit
LENGTH

Controls the maximum amount of subdiagnostics that are part of a given multiline diagnostic.

Constructor Summary

AccessConstructor and Description
private

Field Detail

DEPTHback to summary
public static final DiagnosticFormatter.Configuration.MultilineLimit DEPTH

Controls the maximum depth of nested multiline diagnostics.

LENGTHback to summary
public static final DiagnosticFormatter.Configuration.MultilineLimit LENGTH

Controls the maximum amount of subdiagnostics that are part of a given multiline diagnostic.

Constructor Detail

MultilineLimitback to summary
private MultilineLimit()

Method Detail

valueOfback to summary
public static DiagnosticFormatter.Configuration.MultilineLimit valueOf(String name)
valuesback to summary
public static DiagnosticFormatter.Configuration.MultilineLimit[] values()
com.sun.tools.javac.api back to summary

public final Enum DiagnosticFormatter.PositionKind

extends Enum<DiagnosticFormatter.PositionKind>
Class Inheritance

This enum defines a set of constants for all the kinds of position that a diagnostic can be asked for. All positions are intended to be relative to a given diagnostic source.

Field Summary

Modifier and TypeField and Description
public static final DiagnosticFormatter.PositionKind
COLUMN

Column number

public static final DiagnosticFormatter.PositionKind
END

End position

public static final DiagnosticFormatter.PositionKind
LINE

Line number

public static final DiagnosticFormatter.PositionKind
OFFSET

Offset position

public static final DiagnosticFormatter.PositionKind
START

Start position

Constructor Summary

AccessConstructor and Description
private

Method Summary

Modifier and TypeMethod and Description
public static DiagnosticFormatter.PositionKind
public static DiagnosticFormatter.PositionKind[]
Inherited from java.lang.Enum:
clonecompareTodescribeConstableequalsfinalizegetDeclaringClasshashCodenameordinaltoStringvalueOf

Field Detail

COLUMNback to summary
public static final DiagnosticFormatter.PositionKind COLUMN

Column number

ENDback to summary
public static final DiagnosticFormatter.PositionKind END

End position

LINEback to summary
public static final DiagnosticFormatter.PositionKind LINE

Line number

OFFSETback to summary
public static final DiagnosticFormatter.PositionKind OFFSET

Offset position

STARTback to summary
public static final DiagnosticFormatter.PositionKind START

Start position

Constructor Detail

PositionKindback to summary
private PositionKind()

Method Detail

valueOfback to summary
public static DiagnosticFormatter.PositionKind valueOf(String name)
valuesback to summary
public static DiagnosticFormatter.PositionKind[] values()