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)
*/
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 {
import java.util.List;
import org.aspectj.bridge.IMessage;
-import org.aspectj.bridge.ISourceLocation;
import org.aspectj.weaver.patterns.AndPointcut;
import org.aspectj.weaver.patterns.PerClause;
import org.aspectj.weaver.patterns.Pointcut;
import java.util.Set;
import org.aspectj.asm.IRelationship;
-import org.aspectj.bridge.*;
+import org.aspectj.bridge.IMessage;
+import org.aspectj.bridge.ISourceLocation;
+import org.aspectj.bridge.Message;
import org.aspectj.bridge.MessageUtil;
+import org.aspectj.bridge.WeaveMessage;
import org.aspectj.lang.JoinPoint;
import org.aspectj.util.PartialOrder;
import org.aspectj.util.TypeSafeEnum;
msg = WeaveMessage.constructWeavingMessage(
WeaveMessage.WEAVEMESSAGE_SOFTENS,
new String[]{advisedType,beautifyLocation(getSourceLocation()),
- advisingType,beautifyLocation(munger.getSourceLocation())});
+ advisingType,beautifyLocation(munger.getSourceLocation())},
+ advisedType,
+ advisingType);
} else {
boolean runtimeTest = ((BcelAdvice)advice).hasDynamicTests();
msg = WeaveMessage.constructWeavingMessage(WeaveMessage.WEAVEMESSAGE_ADVISES,
- new String[]{ advisedType, beautifyLocation(getSourceLocation()),
+ new String[]{ advisedType, beautifyLocation(getSourceLocation()),
description,
advisingType,beautifyLocation(munger.getSourceLocation()),
- (runtimeTest?" [with runtime test]":"")});
+ (runtimeTest?" [with runtime test]":"")},
+ advisedType,
+ advisingType);
// Boolean.toString(runtimeTest)});
}
getIWorld().getMessageHandler().handleMessage(msg);
if (parentTM.getNewParent().isInterface()) {
weaver.getWorld().getMessageHandler().handleMessage(WeaveMessage.constructWeavingMessage(WeaveMessage.WEAVEMESSAGE_DECLAREPARENTSIMPLEMENTS,
new String[]{weaver.getLazyClassGen().getType().getName(),
- tName,parentTM.getNewParent().getName(),fName}));
+ tName,parentTM.getNewParent().getName(),fName},
+ weaver.getLazyClassGen().getClassName(), getAspectType().getName()));
} else {
System.err.println("BANG, you need to fix this. BcelTypeMunger");
}
new String[]{weaver.getLazyClassGen().getType().getName(),
tName,munger.getKind().toString().toLowerCase(),
getAspectType().getName(),
- fName+":'"+munger.getSignature()+"'"}));
+ fName+":'"+munger.getSignature()+"'"},
+ weaver.getLazyClassGen().getClassName(), getAspectType().getName()));
// ??? If only type mungers knew their originating line numbers ...
}
}
}
}
}
+
\ No newline at end of file
}
}
- private BcelObjectType makeBcelObjectType(ResolvedTypeX.Name resolvedTypeX, JavaClass jc, boolean exposedToWeaver) {
+ protected BcelObjectType makeBcelObjectType(ResolvedTypeX.Name resolvedTypeX, JavaClass jc, boolean exposedToWeaver) {
BcelObjectType ret = new BcelObjectType(resolvedTypeX, jc, exposedToWeaver);
resolvedTypeX.setDelegate(ret);
return ret;