diff options
author | aclement <aclement> | 2005-01-04 13:15:57 +0000 |
---|---|---|
committer | aclement <aclement> | 2005-01-04 13:15:57 +0000 |
commit | 98976598593e8a1f89e9628e8fc11c7822b8e3d4 (patch) | |
tree | 30e0ea7e81e896be0ffca52b61ca5a210d9c219b /bridge | |
parent | c6e8e5a0d522eb5fc0f402c97d42d456516bfc6a (diff) | |
download | aspectj-98976598593e8a1f89e9628e8fc11c7822b8e3d4.tar.gz aspectj-98976598593e8a1f89e9628e8fc11c7822b8e3d4.zip |
Fix for Bug 82062: WeaveMessage should provide more information
(Bug and fix from Martin Lippert)
Diffstat (limited to 'bridge')
-rw-r--r-- | bridge/src/org/aspectj/bridge/WeaveMessage.java | 44 |
1 files changed, 41 insertions, 3 deletions
diff --git a/bridge/src/org/aspectj/bridge/WeaveMessage.java b/bridge/src/org/aspectj/bridge/WeaveMessage.java index 3f2e72297..3dfd82fca 100644 --- a/bridge/src/org/aspectj/bridge/WeaveMessage.java +++ b/bridge/src/org/aspectj/bridge/WeaveMessage.java @@ -33,32 +33,70 @@ public class WeaveMessage extends Message { new WeaveMessageKind(5,"Softening exceptions in type '%1' (%2) as defined by aspect '%3' (%4)"); + private String affectedtypename; + private String aspectname; + + // private ctor - use the static factory method - private WeaveMessage(String message) { + private WeaveMessage(String message, String affectedtypename, String aspectname) { super(message, IMessage.WEAVEINFO, null, null); + this.affectedtypename = affectedtypename; + this.aspectname = aspectname; } /** * Static helper method for constructing weaving messages. * @param kind what kind of message (e.g. declare parents) * @param inserts inserts for the message (inserts are marked %n in the message) + * @return new weaving message + */ + public static WeaveMessage constructWeavingMessage( + WeaveMessageKind kind, + String[] inserts) { + StringBuffer str = new StringBuffer(kind.getMessage()); + int pos = -1; + while ((pos=new String(str).indexOf("%"))!=-1) { + int n = Character.getNumericValue(str.charAt(pos+1)); + str.replace(pos,pos+2,inserts[n-1]); + } + return new WeaveMessage(str.toString(), null, null); + } + + /** + * Static helper method for constructing weaving messages. + * @param kind what kind of message (e.g. declare parents) + * @param inserts inserts for the message (inserts are marked %n in the message) * @param affectedtypename the type which is being advised/declaredUpon * @param aspectname the aspect that defined the advice or declares * @return new weaving message */ public static WeaveMessage constructWeavingMessage( WeaveMessageKind kind, - String[] inserts) { + String[] inserts, + String affectedtypename, + String aspectname) { StringBuffer str = new StringBuffer(kind.getMessage()); int pos = -1; while ((pos=new String(str).indexOf("%"))!=-1) { int n = Character.getNumericValue(str.charAt(pos+1)); str.replace(pos,pos+2,inserts[n-1]); } - return new WeaveMessage(str.toString()); + return new WeaveMessage(str.toString(), affectedtypename, aspectname); } + /** + * @return Returns the aspectname. + */ + public String getAspectname() { + return aspectname; + } + /** + * @return Returns the affectedtypename. + */ + public String getAffectedtypename() { + return affectedtypename; + } public static class WeaveMessageKind { |