Diagnostics consist of a diagnostic kind
and a message,
and may additionally be associated with an element
,
a tree node
in a documentation comment,
or an arbitrary position in a given file
.
Other messages may be written directly to one of two streams that are informally
for use by "standard output" and "diagnostic output", where "standard output"
means the output that is the expected result of executing some operation,
such as the command-line help that is generated when using a --help
option,
and "diagnostic output" refers to any errors, warnings and other output that is
a side effect of executing the operation.
The exact manner in which diagnostics are output is unspecified and depends on the enclosing context. For example:
javax.tools.DocumentationTool
API allows a client to specify a
javax.tools.DiagnosticListener
to which diagnostics will be
reported
. If no listener is specified,
diagnostics will be written to a given stream, or to System.err
if no such
stream is provided.
java.util.spi.ToolProvider
API allows a client to specify
the streams to be used for reporting standard and diagnostic output.
Modifier and Type | Method and Description |
---|---|
public default PrintWriter | Returns: the writerReturns a writer that can be used to write diagnostic output,
or |
public default PrintWriter | Returns: the writerReturns a writer that can be used to write non-diagnostic output,
or |
public void | print(Diagnostic.
the kind of diagnostic kind,the message to be printed message)Prints a diagnostic message. |
public void | print(Diagnostic.
the kind of diagnostic kind,the path for the tree node path, String the message to be printed message)Prints a diagnostic message related to a tree node in a documentation comment. |
public default void | print(Diagnostic.
the kind of diagnostic kind,the path for the tree node path, int the beginning of the enclosing range start, int the position pos, int the end of the enclosing range end, String the message to be printed message)Prints a diagnostic message related to a position within a range of characters in a tree node. |
public void | print(Diagnostic.
the kind of diagnostic kind,the element element, String the message to be printed message)Prints a diagnostic message related to an element. |
public default void | print(Diagnostic.
the kind of diagnostic kind,the file file, int the beginning of the enclosing range start, int the position pos, int the end of the enclosing range end, String the message to be printed message)Prints a diagnostic message related to a position within a range of characters in a file. |
getDiagnosticWriter | back to summary |
---|---|
public default PrintWriter getDiagnosticWriter() Returns a writer that can be used to write diagnostic output,
or API Note The value may or may not be the same as that returned by Implementation Specification This implementation returns
|
getStandardWriter | back to summary |
---|---|
public default PrintWriter getStandardWriter() Returns a writer that can be used to write non-diagnostic output,
or API Note The value may or may not be the same as that returned by Implementation Specification This implementation returns
|
back to summary | |
---|---|
public void print(Diagnostic. Prints a diagnostic message.
|
back to summary | |
---|---|
public void print(Diagnostic. Prints a diagnostic message related to a tree node in a documentation comment.
|
back to summary | |
---|---|
public default void print(Diagnostic. Prints a diagnostic message related to a position within a range of characters in a tree node.
Only kinds of Implementation Specification This implementation ignores the
|
back to summary | |
---|---|
public void print(Diagnostic. Prints a diagnostic message related to an element.
|
back to summary | |
---|---|
public default void print(Diagnostic. Prints a diagnostic message related to a position within a range of characters in a file.
The positions are all 0-based character offsets from the beginning of content of the file.
The positions should satisfy the relation Implementation Specification This implementation always throws
|