Interface Diagnostic<S>
- Type Parameters:
-
S
- the type of source object used by this diagnostic
public 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.
- Since:
- 1.6
Nested Class Summary
Modifier and Type | Interface | Description |
---|---|---|
static enum |
Diagnostic.Kind |
Kinds of diagnostics, for example, error or warning. |
Field Summary
Modifier and Type | Field | Description |
---|---|---|
static final long |
NOPOS |
Used to signal that no position is available. |
Method Summary
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. |
Field Details
NOPOS
static final long NOPOS
- See Also:
Method Details
getKind
Diagnostic.Kind getKind()
- Returns:
- the kind of this diagnostic
getSource
S getSource()
- Returns:
- the source object associated with this diagnostic.
null
if no source object is associated with the diagnostic.
getPosition
long getPosition()
getStartPosition() <= getPosition()
getPosition() <= getEndPosition()
- Returns:
- character offset from beginning of source;
NOPOS
ifgetSource()
would returnnull
or if no location is suitable
getStartPosition
long getStartPosition()
- Returns:
- offset from beginning of file;
NOPOS
if and only ifgetPosition()
returnsNOPOS
getEndPosition
long getEndPosition()
- Returns:
- offset from beginning of file;
NOPOS
if and only ifgetPosition()
returnsNOPOS
getLineNumber
long getLineNumber()
- Returns:
- a line number or
NOPOS
if and only ifgetPosition()
returnsNOPOS
getColumnNumber
long getColumnNumber()
- Returns:
- a column number or
NOPOS
if and only ifgetPosition()
returnsNOPOS
getCode
String getCode()
null
.- Returns:
- a diagnostic code
getMessage
String getMessage(Locale locale)
null
use the default locale.- Parameters:
-
locale
- a locale; might benull
- Returns:
- a localized message
© 1993, 2021, 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/17/docs/api/java.compiler/javax/tools/Diagnostic.html