Package org.codehaus.groovy.control.messages

# Class WarningMessage

java.lang.Object
org.codehaus.groovy.control.messages.Message
org.codehaus.groovy.control.messages.SimpleMessage
org.codehaus.groovy.control.messages.LocatedMessage
org.codehaus.groovy.control.messages.WarningMessage

public class WarningMessage extends LocatedMessage
A class for warning messages.

- ## Field Summary

  Fields
  Modifier and Type
  Field
  Description
  `static final int`
  `LIKELY_ERRORS`
  Warning indicates likely error
  `static final int`
  `NONE`
  Ignore all (for querying)
  `static final int`
  `PARANOIA`
  Warning indicates paranoia on the part of the compiler
  `static final int`
  `POSSIBLE_ERRORS`
  Warning indicates possible error

  ### Fields inherited from class org.codehaus.groovy.control.messages.SimpleMessage

  `data, message, owner`

- ## Constructor Summary

  Constructors
  Constructor
  Description
  `WarningMessage(int importance, String message, Object data, CSTNode context, SourceUnit owner)`
  Creates a new warning message.
  `WarningMessage(int importance, String message, CSTNode context, SourceUnit owner)`
  Creates a new warning message.

- ## Method Summary

  Modifier and Type
  Method
  Description
  `boolean`
  `isRelevant(int importance)`
  Returns true if this message is as or more important than the specified importance level.
  `static boolean`
  `isRelevant(int actual, int limit)`
  Returns true if a warning would be relevant to the specified level.
  `void`
  `write(PrintWriter writer, Janitor janitor)`
  Writes this warning with a `warning:` prefix.

  ### Methods inherited from class org.codehaus.groovy.control.messages.LocatedMessage

  `getContext`

  ### Methods inherited from class org.codehaus.groovy.control.messages.SimpleMessage

  `getMessage`

  ### Methods inherited from class org.codehaus.groovy.control.messages.Message

  `create, create, create, write`

  ### Methods inherited from class java.lang.Object

  `clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

- ## Field Details

  - ### NONE

    public static final int NONE
    Ignore all (for querying)
    See Also:
      - Constant Field Values

  - ### LIKELY_ERRORS

    public static final int LIKELY_ERRORS
    Warning indicates likely error
    See Also:
      - Constant Field Values

  - ### POSSIBLE_ERRORS

    public static final int POSSIBLE_ERRORS
    Warning indicates possible error
    See Also:
      - Constant Field Values

  - ### PARANOIA

    public static final int PARANOIA
    Warning indicates paranoia on the part of the compiler
    See Also:
      - Constant Field Values

- ## Constructor Details

  - ### WarningMessage

    public WarningMessage(int importance, String message, CSTNode context, SourceUnit owner)
    Creates a new warning message.
    Parameters:
      `importance` - the warning level
      `message` - the message text
      `context` - for locating the offending source text

  - ### WarningMessage

    public WarningMessage(int importance, String message, Object data, CSTNode context, SourceUnit owner)
    Creates a new warning message.
    Parameters:
      `importance` - the warning level
      `message` - the message text
      `data` - data needed for generating the message
      `context` - for locating the offending source text

- ## Method Details

  - ### isRelevant

    public static boolean isRelevant(int actual, int limit)
    Returns true if a warning would be relevant to the specified level.

  - ### isRelevant

    public boolean isRelevant(int importance)
    Returns true if this message is as or more important than the specified importance level.

  - ### write

    public void write(PrintWriter writer, Janitor janitor)
    Writes this warning with a `warning:` prefix.
    Overrides:
      `write` in class `LocatedMessage`
    Parameters:
      `writer` - the destination writer
      `janitor` - the cleanup helper for temporary source access