public class JCDiagnostic extends Object implements Diagnostic<JavaFileObject>
This is NOT part of any supported API. If you write code that depends on this, you do so at your own risk. This code and its internal interfaces are subject to change or deletion without notice.
Modifier and Type | Class and Description |
---|---|
static class |
JCDiagnostic.DiagnosticFlag |
static interface |
JCDiagnostic.DiagnosticPosition
A DiagnosticPosition provides information about the positions in a file
that gave rise to a diagnostic.
|
static class |
JCDiagnostic.DiagnosticType
A DiagnosticType defines the type of the diagnostic.
|
static class |
JCDiagnostic.Factory
A factory for creating diagnostic objects.
|
static class |
JCDiagnostic.MultilineDiagnostic |
static class |
JCDiagnostic.SimpleDiagnosticPosition
A DiagnosticPosition that simply identifies a position, but no related
tree node, as the location for a diagnostic.
|
Diagnostic.Kind
Modifier and Type | Field and Description |
---|---|
protected Object[] |
args |
NOPOS
Modifier | Constructor and Description |
---|---|
protected |
JCDiagnostic(DiagnosticFormatter<JCDiagnostic> formatter,
JCDiagnostic.DiagnosticType dt,
Lint.LintCategory lc,
Set<JCDiagnostic.DiagnosticFlag> flags,
DiagnosticSource source,
JCDiagnostic.DiagnosticPosition pos,
String key,
Object... args)
Create a diagnostic object.
|
Modifier and Type | Method and Description |
---|---|
static JCDiagnostic |
fragment(String key,
Object... args)
Deprecated.
|
Object[] |
getArgs()
Get the arguments to be included in the text of the diagnostic.
|
String |
getCode()
Gets a diagnostic code indicating the type of diagnostic.
|
long |
getColumnNumber()
Get the column number within the line of source referred to by this diagnostic.
|
JCDiagnostic.DiagnosticPosition |
getDiagnosticPosition() |
DiagnosticSource |
getDiagnosticSource()
Get the source referred to by this diagnostic.
|
long |
getEndPosition()
Gets the character offset from the beginning of the file
associated with this diagnostic that indicates the end of the
problem.
|
static DiagnosticFormatter<JCDiagnostic> |
getFragmentFormatter()
Deprecated.
|
protected int |
getIntEndPosition() |
protected int |
getIntPosition() |
protected int |
getIntStartPosition() |
Diagnostic.Kind |
getKind()
Gets the kind of this diagnostic, for example, error or
warning.
|
long |
getLineNumber()
Get the line number within the source referred to by this diagnostic.
|
Lint.LintCategory |
getLintCategory()
Get the associated lint category, or null if none.
|
String |
getMessage(Locale locale)
Gets a localized message for the given locale.
|
long |
getPosition()
Gets a character offset from the beginning of the source object
associated with this diagnostic that indicates the location of
the problem.
|
String |
getPrefix()
Get the prefix string associated with this type of diagnostic.
|
String |
getPrefix(JCDiagnostic.DiagnosticType dt)
Get the prefix string associated with a particular type of diagnostic.
|
JavaFileObject |
getSource()
Get the name of the source file referred to by this diagnostic.
|
long |
getStartPosition()
Gets the character offset from the beginning of the file
associated with this diagnostic that indicates the start of the
problem.
|
List<JCDiagnostic> |
getSubdiagnostics()
Get the subdiagnostic list
|
JCDiagnostic.DiagnosticType |
getType()
Get the type of this diagnostic.
|
boolean |
hasLintCategory()
Check whether this diagnostic has an associated lint category.
|
boolean |
isFlagSet(JCDiagnostic.DiagnosticFlag flag) |
boolean |
isMandatory()
Check whether or not this diagnostic is required to be shown.
|
boolean |
isMultiline() |
void |
setFlag(JCDiagnostic.DiagnosticFlag flag) |
String |
toString()
Return the standard presentation of this diagnostic.
|
protected final Object[] args
protected JCDiagnostic(DiagnosticFormatter<JCDiagnostic> formatter, JCDiagnostic.DiagnosticType dt, Lint.LintCategory lc, Set<JCDiagnostic.DiagnosticFlag> flags, DiagnosticSource source, JCDiagnostic.DiagnosticPosition pos, String key, Object... args)
formatter
- the formatter to use for the diagnosticdt
- the type of diagnosticlc
- the lint category for the diagnosticsource
- the name of the source file, or null if none.pos
- the character offset within the source file, if given.key
- a resource key to identify the text of the diagnosticargs
- arguments to be included in the text of the diagnostic@Deprecated public static JCDiagnostic fragment(String key, Object... args)
key
- The key for the localized error message.args
- Fields of the error message.@Deprecated public static DiagnosticFormatter<JCDiagnostic> getFragmentFormatter()
public JCDiagnostic.DiagnosticType getType()
public List<JCDiagnostic> getSubdiagnostics()
public boolean isMultiline()
public boolean isMandatory()
public boolean hasLintCategory()
public Lint.LintCategory getLintCategory()
public JavaFileObject getSource()
getSource
in interface Diagnostic<JavaFileObject>
public DiagnosticSource getDiagnosticSource()
protected int getIntStartPosition()
protected int getIntPosition()
protected int getIntEndPosition()
public long getStartPosition()
Diagnostic
getStartPosition
in interface Diagnostic<JavaFileObject>
Diagnostic.NOPOS
if and
only if Diagnostic.getPosition()
returns Diagnostic.NOPOS
public long getPosition()
Diagnostic
getStartPostion() <= getPosition()
getPosition() <= getEndPosition()
getPosition
in interface Diagnostic<JavaFileObject>
Diagnostic.NOPOS
if Diagnostic.getSource()
would return null
or if
no location is suitablepublic long getEndPosition()
Diagnostic
getEndPosition
in interface Diagnostic<JavaFileObject>
Diagnostic.NOPOS
if and
only if Diagnostic.getPosition()
returns Diagnostic.NOPOS
public JCDiagnostic.DiagnosticPosition getDiagnosticPosition()
public long getLineNumber()
getLineNumber
in interface Diagnostic<JavaFileObject>
public long getColumnNumber()
getColumnNumber
in interface Diagnostic<JavaFileObject>
public Object[] getArgs()
public String getPrefix()
public String getPrefix(JCDiagnostic.DiagnosticType dt)
public String toString()
public Diagnostic.Kind getKind()
Diagnostic
getKind
in interface Diagnostic<JavaFileObject>
public String getCode()
Diagnostic
null
.getCode
in interface Diagnostic<JavaFileObject>
public String getMessage(Locale locale)
Diagnostic
null
use the default locale.getMessage
in interface Diagnostic<JavaFileObject>
locale
- a locale; might be null
public void setFlag(JCDiagnostic.DiagnosticFlag flag)
public boolean isFlagSet(JCDiagnostic.DiagnosticFlag flag)
Copyright © 2015. All rights reserved.