aboutsummaryrefslogtreecommitdiffstats
path: root/bridge
diff options
context:
space:
mode:
authormkersten <mkersten>2003-08-07 10:51:36 +0000
committermkersten <mkersten>2003-08-07 10:51:36 +0000
commit684c9c1c3dd084b43645f537774bea0b4a9c1222 (patch)
tree403302230f48deabdbd9eb538c219ff6120f2dcf /bridge
parent672bf9d46e415a259612aea3dee579b81fa28817 (diff)
downloadaspectj-684c9c1c3dd084b43645f537774bea0b4a9c1222.tar.gz
aspectj-684c9c1c3dd084b43645f537774bea0b4a9c1222.zip
40534: Declare warning/error output - more detail required.
- Added getDetails() to messages. This String corresponding to thisJoinPointStatic part can be used by tools that need to display additional info.
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;
+ }
}