S
- the type of source object used by this diagnosticpublic interface Diagnostic<S>
Interface for diagnostics from tools. A diagnostic usually reports a problem at a specific position in a source file. However, not all diagnostics are associated with a position or a file.
A position is a zero-based character offset from the beginning of a file. Negative values (except NOPOS
) are not valid positions.
Line and column numbers begin at 1. Negative values (except NOPOS
) and 0 are not valid line or column numbers.
Modifier and Type | Interface and Description |
---|---|
static class |
Diagnostic.Kind Kinds of diagnostics, for example, error or warning. |
static final long NOPOS
Used to signal that no position is available.
Diagnostic.Kind getKind()
Gets the kind of this diagnostic, for example, error or warning.
S getSource()
Gets the source object associated with this diagnostic.
null
if no source object is associated with the diagnostic.long getPosition()
Gets a character offset from the beginning of the source object associated with this diagnostic that indicates the location of the problem. In addition, the following must be true:
getStartPostion() <= getPosition()
getPosition() <= getEndPosition()
NOPOS
if getSource()
would return null
or if no location is suitablelong getStartPosition()
Gets the character offset from the beginning of the file associated with this diagnostic that indicates the start of the problem.
NOPOS
if and only if getPosition()
returns NOPOS
long getEndPosition()
Gets the character offset from the beginning of the file associated with this diagnostic that indicates the end of the problem.
NOPOS
if and only if getPosition()
returns NOPOS
long getLineNumber()
Gets the line number of the character offset returned by getPosition().
NOPOS
if and only if getPosition()
returns NOPOS
long getColumnNumber()
Gets the column number of the character offset returned by getPosition().
NOPOS
if and only if getPosition()
returns NOPOS
String getCode()
Gets a diagnostic code indicating the type of diagnostic. The code is implementation-dependent and might be null
.
String getMessage(Locale locale)
Gets a localized message for the given locale. The actual message is implementation-dependent. If the locale is null
use the default locale.
locale
- a locale; might be null
© 1993–2017, Oracle and/or its affiliates. All rights reserved.
Documentation extracted from Debian's OpenJDK Development Kit package.
Licensed under the GNU General Public License, version 2, with the Classpath Exception.
Various third party code in OpenJDK is licensed under different licenses (see Debian package).
Java and OpenJDK are trademarks or registered trademarks of Oracle and/or its affiliates.