Class DiagMessage
- java.lang.Object
-
- org.checkerframework.framework.source.DiagMessage
-
@AnnotatedFor("nullness") public class DiagMessage extends java.lang.Object
ADiagMessage
is a kind, a message key, and arguments. The message key will be expanded according to the user locale. Any arguments will then be interpolated into the localized message.By contrast,
javax.tools.Diagnostic
has just a string message.
-
-
Constructor Summary
Constructors Constructor Description DiagMessage(javax.tools.Diagnostic.Kind kind, @CompilerMessageKey java.lang.String messageKey, java.lang.Object... args)
Create a DiagMessage.
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description boolean
equals(@Nullable java.lang.Object obj)
static DiagMessage
error(@CompilerMessageKey java.lang.String messageKey, java.lang.Object... args)
Create a DiagMessage with kind ERROR.java.lang.Object[]
getArgs()
Returns the customized optional arguments for the message.javax.tools.Diagnostic.Kind
getKind()
Returns the kind of this DiagMessage.@CompilerMessageKey java.lang.String
getMessageKey()
Returns the message key of this DiagMessage.int
hashCode()
static @Nullable java.util.List<DiagMessage>
mergeLists(@Nullable java.util.List<DiagMessage> list1, @Nullable java.util.List<DiagMessage> list2)
Returns the concatenation of the lists.java.lang.String
toString()
-
-
-
Constructor Detail
-
DiagMessage
public DiagMessage(javax.tools.Diagnostic.Kind kind, @CompilerMessageKey java.lang.String messageKey, java.lang.Object... args)
Create a DiagMessage.- Parameters:
kind
- the kind of messagemessageKey
- the message keyargs
- the arguments that will be interpolated into the localized message
-
-
Method Detail
-
error
public static DiagMessage error(@CompilerMessageKey java.lang.String messageKey, java.lang.Object... args)
Create a DiagMessage with kind ERROR.- Parameters:
messageKey
- the message keyargs
- the arguments that will be interpolated into the localized message- Returns:
- a new DiagMessage
-
getKind
public javax.tools.Diagnostic.Kind getKind()
Returns the kind of this DiagMessage.- Returns:
- the kind of this DiagMessage
-
getMessageKey
public @CompilerMessageKey java.lang.String getMessageKey()
Returns the message key of this DiagMessage.- Returns:
- the message key of this DiagMessage
-
getArgs
public java.lang.Object[] getArgs()
Returns the customized optional arguments for the message.- Returns:
- the customized optional arguments for the message
-
equals
public boolean equals(@Nullable java.lang.Object obj)
- Overrides:
equals
in classjava.lang.Object
-
hashCode
@Pure public int hashCode()
- Overrides:
hashCode
in classjava.lang.Object
-
toString
@SideEffectFree public java.lang.String toString()
- Overrides:
toString
in classjava.lang.Object
-
mergeLists
public static @Nullable java.util.List<DiagMessage> mergeLists(@Nullable java.util.List<DiagMessage> list1, @Nullable java.util.List<DiagMessage> list2)
Returns the concatenation of the lists.- Parameters:
list1
- a list of DiagMessage, or nulllist2
- a list of DiagMessage, or null- Returns:
- the concatenation of the lists
-
-