aboutsummaryrefslogtreecommitdiffstats
path: root/bridge
diff options
context:
space:
mode:
Diffstat (limited to 'bridge')
-rw-r--r--bridge/src/org/aspectj/bridge/IMessage.java7
-rw-r--r--bridge/src/org/aspectj/bridge/Message.java37
2 files changed, 44 insertions, 0 deletions
diff --git a/bridge/src/org/aspectj/bridge/IMessage.java b/bridge/src/org/aspectj/bridge/IMessage.java
index fe2a2124d..7fddcb089 100644
--- a/bridge/src/org/aspectj/bridge/IMessage.java
+++ b/bridge/src/org/aspectj/bridge/IMessage.java
@@ -117,4 +117,11 @@ public interface IMessage {
return name;
}
}
+
+ /**
+ * @return Detailed information about the message. For example, for declare
+ * error/warning messages this returns information about the corresponding
+ * join point's static part.
+ */
+ public String getDetails();
}
diff --git a/bridge/src/org/aspectj/bridge/Message.java b/bridge/src/org/aspectj/bridge/Message.java
index ada78629a..408a2d4f3 100644
--- a/bridge/src/org/aspectj/bridge/Message.java
+++ b/bridge/src/org/aspectj/bridge/Message.java
@@ -29,6 +29,7 @@ public class Message implements IMessage { // XXX toString or renderer?
private final IMessage.Kind kind;
private final Throwable thrown;
private final ISourceLocation sourceLocation;
+ private final String details;
/** convenience for constructing failure messages */
public static Message fail(String message, Throwable thrown) {
@@ -45,6 +46,38 @@ public class Message implements IMessage { // XXX toString or renderer?
this(message, (isError ? IMessage.ERROR : IMessage.WARNING), null,
location);
}
+
+ /**
+ * Create a message, handling null values for message and kind
+ * if thrown is not null.
+ * @param message the String used as the underlying message
+ * @param kind the IMessage.Kind of message - not null
+ * @param thrown the Throwable, if any, associated with this message
+ * @param sourceLocation the ISourceLocation, if any, associated with this message
+ * @param 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.
+ */
+ public Message(String message, String details, IMessage.Kind kind,
+ ISourceLocation sourceLocation) {
+ this.details = details;
+ this.message = message;
+ this.kind = kind;
+ this.sourceLocation = sourceLocation;
+ this.thrown = null;
+ if (null == message) {
+ if (null != thrown) {
+ message = thrown.getMessage();
+ }
+ if (null == message) {
+ throw new IllegalArgumentException("null message");
+ }
+ }
+ if (null == kind) {
+ throw new IllegalArgumentException("null kind");
+ }
+ }
/**
* Create a message, handling null values for message and kind
@@ -63,6 +96,7 @@ public class Message implements IMessage { // XXX toString or renderer?
this.kind = kind;
this.thrown = thrown;
this.sourceLocation = sourceLocation;
+ this.details = "";
if (null == message) {
if (null != thrown) {
message = thrown.getMessage();
@@ -163,4 +197,7 @@ public class Message implements IMessage { // XXX toString or renderer?
return buf.getBuffer().toString();
}
+ public String getDetails() {
+ return details;
+ }
}