S
- the type of source object used by this diagnosticpublic interface Diagnostic<S>
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 | Description |
---|---|---|
static enum |
Diagnostic.Kind |
Kinds of diagnostics, for example, error or warning. |
Modifier and Type | Field | Description |
---|---|---|
static final long |
NOPOS |
Used to signal that no position is available. |
Modifier and Type | Method | Description |
---|---|---|
String |
getCode() |
Returns a diagnostic code indicating the type of diagnostic. |
long |
getColumnNumber() |
Returns the column number of the character offset returned by getPosition(). |
long |
getEndPosition() |
Returns the character offset from the beginning of the file associated with this diagnostic that indicates the end of the problem. |
Diagnostic.Kind |
getKind() |
Returns the kind of this diagnostic, for example, error or warning. |
long |
getLineNumber() |
Returns the line number of the character offset returned by getPosition(). |
String |
getMessage |
Returns a localized message for the given locale. |
long |
getPosition() |
Returns a character offset from the beginning of the source object associated with this diagnostic that indicates the location of the problem. |
S |
getSource() |
Returns the source object associated with this diagnostic. |
long |
getStartPosition() |
Returns the character offset from the beginning of the file associated with this diagnostic that indicates the start of the problem. |
static final long NOPOS
Diagnostic.Kind getKind()
S getSource()
null
if no source object is associated with the diagnostic.long getPosition()
getStartPosition() <= getPosition()
getPosition() <= getEndPosition()
NOPOS
if getSource()
would return null
or if no location is suitablelong getStartPosition()
NOPOS
if and only if getPosition()
returns NOPOS
long getEndPosition()
NOPOS
if and only if getPosition()
returns NOPOS
long getLineNumber()
NOPOS
if and only if getPosition()
returns NOPOS
long getColumnNumber()
NOPOS
if and only if getPosition()
returns NOPOS
String getCode()
null
.String getMessage(Locale locale)
null
use the default locale.locale
- a locale; might be null
© 1993, 2023, 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.
https://docs.oracle.com/en/java/javase/21/docs/api/java.compiler/javax/tools/Diagnostic.html