Class DiagMessage

java.lang.Object
org.checkerframework.framework.source.DiagMessage

@AnnotatedFor("nullness") public class DiagMessage extends Object
A DiagMessage 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 Details

    • DiagMessage

      public DiagMessage(Diagnostic.Kind kind, @CompilerMessageKey String messageKey, Object... args)
      Create a DiagMessage.
      Parameters:
      kind - the kind of message
      messageKey - the message key
      args - the arguments that will be interpolated into the localized message
  • Method Details

    • error

      public static DiagMessage error(@CompilerMessageKey String messageKey, Object... args)
      Create a DiagMessage with kind ERROR.
      Parameters:
      messageKey - the message key
      args - the arguments that will be interpolated into the localized message
      Returns:
      a new DiagMessage
    • getKind

      public Diagnostic.Kind getKind()
      Returns the kind of this DiagMessage.
      Returns:
      the kind of this DiagMessage
    • getMessageKey

      public @CompilerMessageKey String getMessageKey()
      Returns the message key of this DiagMessage.
      Returns:
      the message key of this DiagMessage
    • getArgs

      public Object[] getArgs()
      Returns the customized optional arguments for the message.
      Returns:
      the customized optional arguments for the message
    • equals

      public boolean equals(@Nullable Object obj)
      Overrides:
      equals in class Object
    • hashCode

      @Pure public int hashCode()
      Overrides:
      hashCode in class Object
    • toString

      @SideEffectFree public String toString()
      Overrides:
      toString in class Object
    • mergeLists

      public static List<DiagMessage> mergeLists(List<DiagMessage> list1, List<DiagMessage> list2)
      Returns the concatenation of the lists.
      Parameters:
      list1 - a list of DiagMessage, or null
      list2 - a list of DiagMessage, or null
      Returns:
      the concatenation of the lists