Class Message

java.lang.Object
org.aspectj.bridge.Message
All Implemented Interfaces:
IMessage
Direct Known Subclasses:
LintMessage, WeaveMessage

public class Message extends Object implements IMessage
Implement messages. This implementation is immutable if ISourceLocation is immutable.
  • Constructor Details

    • Message

      public Message(String message, ISourceLocation location, boolean isError)
      Create a (compiler) error or warning message
      Parameters:
      message - the String used as the underlying message
      location - the ISourceLocation, if any, associated with this message
      isError - if true, use IMessage.ERROR; else use IMessage.WARNING
    • Message

      public Message(String message, ISourceLocation location, boolean isError, ISourceLocation[] extraSourceLocations)
    • Message

      public Message(String message, String details, IMessage.Kind kind, ISourceLocation sourceLocation, Throwable thrown, ISourceLocation[] extraSourceLocations)
      Create a message, handling null values for message and kind if thrown is not null.
      Parameters:
      message - the String used as the underlying message
      kind - the IMessage.Kind of message - not null
      thrown - the Throwable, if any, associated with this message
      sourceLocation - the ISourceLocation, if any, associated with this message
      details - descriptive information about the message
      Throws:
      IllegalArgumentException - if message is null and thrown is null or has a null message, or if kind is null and thrown is null.
    • Message

      public Message(String message, String details, IMessage.Kind kind, ISourceLocation sLoc, Throwable thrown, ISourceLocation[] otherLocs, boolean declared, int id, int sourcestart, int sourceend)
    • Message

      public Message(String message, IMessage.Kind kind, Throwable thrown, ISourceLocation sourceLocation)
      Create a message, handling null values for message and kind if thrown is not null.
      Parameters:
      message - the String used as the underlying message
      kind - the IMessage.Kind of message - not null
      thrown - the Throwable, if any, associated with this message
      sourceLocation - the ISourceLocation, if any, associated with this message
      Throws:
      IllegalArgumentException - if message is null and thrown is null or has a null message, or if kind is null and thrown is null.
  • Method Details

    • getKind

      public IMessage.Kind getKind()
      Specified by:
      getKind in interface IMessage
      Returns:
      the kind of this message
    • isError

      public boolean isError()
      Specified by:
      isError in interface IMessage
      Returns:
      true if kind == IMessage.ERROR
    • isWarning

      public boolean isWarning()
      Specified by:
      isWarning in interface IMessage
      Returns:
      true if kind == IMessage.WARNING
    • isDebug

      public boolean isDebug()
      Specified by:
      isDebug in interface IMessage
      Returns:
      true if kind == IMessage.DEBUG
    • isUsage

      public boolean isUsage()
      Specified by:
      isUsage in interface IMessage
      Returns:
      true if kind == IMessage.USAGE
    • isTaskTag

      public boolean isTaskTag()
      Specified by:
      isTaskTag in interface IMessage
      Returns:
      true if this is a task tag message
    • isInfo

      public boolean isInfo()
      Specified by:
      isInfo in interface IMessage
      Returns:
      true if kind == IMessage.INFO
    • isAbort

      public boolean isAbort()
      Specified by:
      isAbort in interface IMessage
      Returns:
      true if kind == IMessage.ABORT
    • getDeclared

      public boolean getDeclared()
      Caller can verify if this message came about because of a DEOW
      Specified by:
      getDeclared in interface IMessage
    • isFailed

      public boolean isFailed()
      Specified by:
      isFailed in interface IMessage
      Returns:
      true if kind == IMessage.FAIL
    • getMessage

      public final String getMessage()
      Specified by:
      getMessage in interface IMessage
      Returns:
      non-null String with simple message
    • getThrown

      public final Throwable getThrown()
      Specified by:
      getThrown in interface IMessage
      Returns:
      Throwable associated with this message, or null if none
    • getSourceLocation

      public final ISourceLocation getSourceLocation()
      Specified by:
      getSourceLocation in interface IMessage
      Returns:
      ISourceLocation associated with this message, or null if none
    • toString

      public String toString()
      Overrides:
      toString in class Object
    • getDetails

      public String getDetails()
      Specified by:
      getDetails in interface IMessage
      Returns:
      Detailed information about the message. For example, for declare error/warning messages this returns information about the corresponding join point's static part.
    • getExtraSourceLocations

      public List<ISourceLocation> getExtraSourceLocations()
      Description copied from interface: IMessage
      Return a List of ISourceLocation instances that indicate additional source locations relevent to this message as specified by the message creator. The list should not include the primary source location associated with the message which can be obtained from getSourceLocation().

      An example of using extra locations would be in a warning message that flags all shadow locations that will go unmatched due to a pointcut definition being based on a subtype of a defining type.

      Specified by:
      getExtraSourceLocations in interface IMessage
      Returns:
      a list of additional source locations
      See Also:
      AspectJ bug 41952
    • getID

      public int getID()
      Description copied from interface: IMessage
      Return the ID of the message where applicable, see IProblem for list of valid IDs
      Specified by:
      getID in interface IMessage
    • getSourceStart

      public int getSourceStart()
      Description copied from interface: IMessage
      Return the start position of the problem (inclusive), or -1 if unknown.
      Specified by:
      getSourceStart in interface IMessage
    • getSourceEnd

      public int getSourceEnd()
      Description copied from interface: IMessage
      Return the end position of the problem (inclusive), or -1 if unknown.
      Specified by:
      getSourceEnd in interface IMessage