This documentation differs from the official API. Jadeite adds extra features to the API including: variable font sizes, constructions examples, placeholders for classes and methods, and auto-generated “See Also” links. Additionally it is missing some items found in standard Javadoc documentation, including: generics type information, “Deprecated” tags and comments, “See Also” links, along with other minor differences. Please send any questions or feedback to bam@cs.cmu.edu.


javax.tools
interface Diagnostic


public interface Diagnostic

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 {@link #NOPOS}) are not valid positions.

Line and column numbers begin at 1. Negative values (except {@link #NOPOS}) and 0 are not valid line or column numbers.


Nested Class Summary
static enum

           Kinds of diagnostics, for example, error or warning.
 
Field Summary
static long NOPOS
          Used to signal that no position is available.
 
Method Summary
 String

          Gets a diagnostic code indicating the type of diagnostic.
 long

          Gets the column number of the character offset returned by javax.tools.Diagnostic.getPosition.
 long

          Gets the character offset from the beginning of the file associated with this diagnostic that indicates the end of the problem.
 Diagnostic.Kind

          Gets the kind of this diagnostic, for example, error or warning.
 long

          Gets the line number of the character offset returned by javax.tools.Diagnostic.getPosition.
 String

          Gets a localized message for the given locale.
 long

          Gets a character offset from the beginning of the source object associated with this diagnostic that indicates the location of the problem.
 Object

          Gets the source object associated with this diagnostic.
 long

          Gets the character offset from the beginning of the file associated with this diagnostic that indicates the start of the problem.
 

Field Detail

NOPOS

public static final long NOPOS
Used to signal that no position is available.
Method Detail

getCode

public String getCode()
Gets a diagnostic code indicating the type of diagnostic. The code is implementation-dependent and might be {@code null}.

Returns:
a diagnostic code

getColumnNumber

public long getColumnNumber()
Gets the column number of the character offset returned by {@linkplain #getPosition()}.

Returns:
a column number or {@link #NOPOS} if and only if {@link #getPosition()} returns {@link #NOPOS}

getEndPosition

public long getEndPosition()
Gets the character offset from the beginning of the file associated with this diagnostic that indicates the end of the problem.

Returns:
offset from beginning of file; {@link #NOPOS} if and only if {@link #getPosition()} returns {@link #NOPOS}

getKind

public Diagnostic.Kind getKind()
Gets the kind of this diagnostic, for example, error or warning.

Returns:
the kind of this diagnostic

getLineNumber

public long getLineNumber()
Gets the line number of the character offset returned by {@linkplain #getPosition()}.

Returns:
a line number or {@link #NOPOS} if and only if {@link #getPosition()} returns {@link #NOPOS}

getMessage

public String getMessage(Locale locale)
Gets a localized message for the given locale. The actual message is implementation-dependent. If the locale is {@code null} use the default locale.

Parameters:
locale - a locale; might be {@code null}
Returns:
a localized message

getPosition

public 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:

{@code getStartPostion() <= getPosition()}

{@code getPosition() <= getEndPosition()}

Returns:
character offset from beginning of source; {@link #NOPOS} if {@link #getSource()} would return {@code null} or if no location is suitable

getSource

public Object getSource()
Gets the source object associated with this diagnostic.

Returns:
the source object associated with this diagnostic. {@code null} if no source object is associated with the diagnostic.

getStartPosition

public long getStartPosition()
Gets the character offset from the beginning of the file associated with this diagnostic that indicates the start of the problem.

Returns:
offset from beginning of file; {@link #NOPOS} if and only if {@link #getPosition()} returns {@link #NOPOS}


This documentation differs from the official API. Jadeite adds extra features to the API including: variable font sizes, constructions examples, placeholders for classes and methods, and auto-generated “See Also” links. Additionally it is missing some items found in standard Javadoc documentation, including: generics type information, “Deprecated” tags and comments, “See Also” links, along with other minor differences. Please send any questions or feedback to bam@cs.cmu.edu.
This page displays the Jadeite version of the documention, which is derived from the offical documentation that contains this copyright notice:
Copyright 2008 Sun Microsystems, Inc. All rights reserved. Use is subject to license terms. Also see the documentation redistribution policy.
The official Sun™ documentation can be found here at http://java.sun.com/javase/6/docs/api/.