import java.util.ArrayList;
import java.util.Iterator;
-
import org.aspectj.asm.*;
import org.aspectj.asm.internal.ProgramElement;
import org.aspectj.bridge.ISourceLocation;
return;
}
IRelationshipMap mapper = AsmManager.getDefault().getRelationshipMap();
- IProgramElement targetNode = getNode(AsmManager.getDefault().getHierarchy(), shadow);
- if (advice.getSourceLocation() != null && targetNode != null) {
- String adviceHandle = ProgramElement.createHandleIdentifier(
- advice.getSourceLocation().getSourceFile(),
- advice.getSourceLocation().getLine(),
- advice.getSourceLocation().getColumn());
+ IProgramElement targetNode = getNode(AsmManager.getDefault().getHierarchy(), shadow);
+ String adviceHandle = advice.getHandle();
+ if (adviceHandle != null && targetNode != null) {
+// ProgramElement.createHandleIdentifier(
+// advice.getSourceLocation().getSourceFile(),
+// advice.getSourceLocation().getLine(),
+// advice.getSourceLocation().getColumn());
if (targetNode != null) {
String targetHandle = targetNode.getHandleIdentifier();
import java.util.Collection;
+import org.aspectj.asm.internal.ProgramElement;
import org.aspectj.bridge.ISourceLocation;
import org.aspectj.util.PartialOrder;
import org.aspectj.weaver.patterns.PerClause;
// these three fields hold the source location of this munger
protected int start, end;
protected ISourceContext sourceContext;
+ private ISourceLocation sourceLocation;
+ private String handle = null;
public ShadowMunger(Pointcut pointcut, int start, int end, ISourceContext sourceContext) {
}
public ISourceLocation getSourceLocation() {
- //System.out.println("get context: " + this + " is " + sourceContext);
- if (sourceContext == null) {
- //System.err.println("no context: " + this);
- return null;
+ if (sourceLocation == null) {
+ if (sourceContext != null) {
+ sourceLocation = sourceContext.makeSourceLocation(this);
+ }
}
- return sourceContext.makeSourceLocation(this);
+ return sourceLocation;
}
+ public String getHandle() {
+ if (null == handle) {
+ ISourceLocation sl = getSourceLocation();
+ if (sl != null) {
+ handle = ProgramElement.createHandleIdentifier(
+ sl.getSourceFile(),
+ sl.getLine(),
+ sl.getColumn());
+ }
+ }
+ return handle;
+ }
+
// ---- fields
public static final ShadowMunger[] NONE = new ShadowMunger[0];