org.aspectj.bridge
Class Message

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

public class Message
extends java.lang.Object
implements IMessage

Implement messages. This implementation is immutable if ISourceLocation is immutable.


Nested Class Summary
 
Nested classes/interfaces inherited from interface org.aspectj.bridge.IMessage
IMessage.Kind
 
Field Summary
 
Fields inherited from interface org.aspectj.bridge.IMessage
ABORT, DEBUG, ERROR, FAIL, INFO, KINDS, RA_IMessage, TASKTAG, WARNING, WEAVEINFO
 
Constructor Summary
Message(java.lang.String message, IMessage.Kind kind, java.lang.Throwable thrown, ISourceLocation sourceLocation)
          Create a message, handling null values for message and kind if thrown is not null.
Message(java.lang.String message, ISourceLocation location, boolean isError)
          Create a (compiler) error or warning message
Message(java.lang.String message, ISourceLocation location, boolean isError, ISourceLocation[] extraSourceLocations)
           
Message(java.lang.String message, java.lang.String details, IMessage.Kind kind, ISourceLocation sourceLocation, java.lang.Throwable thrown, ISourceLocation[] extraSourceLocations)
          Create a message, handling null values for message and kind if thrown is not null.
Message(java.lang.String message, java.lang.String details, IMessage.Kind kind, ISourceLocation sLoc, java.lang.Throwable thrown, ISourceLocation[] otherLocs, boolean declared, int id, int sourcestart, int sourceend)
           
 
Method Summary
 boolean getDeclared()
          Caller can verify if this message came about because of a DEOW
 java.lang.String getDetails()
           
 java.util.List<ISourceLocation> getExtraSourceLocations()
           
 int getID()
          Return the ID of the message where applicable, see IProblem for list of valid IDs
 IMessage.Kind getKind()
           
 java.lang.String getMessage()
           
 int getSourceEnd()
          Return the end position of the problem (inclusive), or -1 if unknown.
 ISourceLocation getSourceLocation()
           
 int getSourceStart()
          Return the start position of the problem (inclusive), or -1 if unknown.
 java.lang.Throwable getThrown()
           
 boolean isAbort()
           
 boolean isDebug()
           
 boolean isError()
           
 boolean isFailed()
           
 boolean isInfo()
           
 boolean isTaskTag()
           
 boolean isWarning()
           
 java.lang.String toString()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

Message

public Message(java.lang.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(java.lang.String message,
               ISourceLocation location,
               boolean isError,
               ISourceLocation[] extraSourceLocations)

Message

public Message(java.lang.String message,
               java.lang.String details,
               IMessage.Kind kind,
               ISourceLocation sourceLocation,
               java.lang.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:
java.lang.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(java.lang.String message,
               java.lang.String details,
               IMessage.Kind kind,
               ISourceLocation sLoc,
               java.lang.Throwable thrown,
               ISourceLocation[] otherLocs,
               boolean declared,
               int id,
               int sourcestart,
               int sourceend)

Message

public Message(java.lang.String message,
               IMessage.Kind kind,
               java.lang.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:
java.lang.IllegalArgumentException - if message is null and thrown is null or has a null message, or if kind is null and thrown is null.
Method Detail

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

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 java.lang.String getMessage()
Specified by:
getMessage in interface IMessage
Returns:
non-null String with simple message

getThrown

public final java.lang.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 java.lang.String toString()
Overrides:
toString in class java.lang.Object

getDetails

public java.lang.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 java.util.List<ISourceLocation> getExtraSourceLocations()
Specified by:
getExtraSourceLocations in interface IMessage
Returns:
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.

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