diff options
Diffstat (limited to 'weaver')
-rw-r--r-- | weaver/src/org/aspectj/weaver/AsmRelationshipProvider.java | 14 | ||||
-rw-r--r-- | weaver/src/org/aspectj/weaver/ShadowMunger.java | 26 |
2 files changed, 28 insertions, 12 deletions
diff --git a/weaver/src/org/aspectj/weaver/AsmRelationshipProvider.java b/weaver/src/org/aspectj/weaver/AsmRelationshipProvider.java index d2c837c65..bd4d72876 100644 --- a/weaver/src/org/aspectj/weaver/AsmRelationshipProvider.java +++ b/weaver/src/org/aspectj/weaver/AsmRelationshipProvider.java @@ -15,7 +15,6 @@ package org.aspectj.weaver; import java.util.ArrayList; import java.util.Iterator; - import org.aspectj.asm.*; import org.aspectj.asm.internal.ProgramElement; import org.aspectj.bridge.ISourceLocation; @@ -61,12 +60,13 @@ public class AsmRelationshipProvider { 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(); diff --git a/weaver/src/org/aspectj/weaver/ShadowMunger.java b/weaver/src/org/aspectj/weaver/ShadowMunger.java index a8cf1dd80..57c629ff2 100644 --- a/weaver/src/org/aspectj/weaver/ShadowMunger.java +++ b/weaver/src/org/aspectj/weaver/ShadowMunger.java @@ -15,6 +15,7 @@ package org.aspectj.weaver; 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; @@ -38,6 +39,8 @@ public abstract class ShadowMunger implements PartialOrder.PartialComparable, IH // 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) { @@ -72,14 +75,27 @@ public abstract class ShadowMunger implements PartialOrder.PartialComparable, IH } 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]; |