diff options
author | acolyer <acolyer> | 2003-09-11 08:46:16 +0000 |
---|---|---|
committer | acolyer <acolyer> | 2003-09-11 08:46:16 +0000 |
commit | be5b37f766faa5086aebcc4c751742ce4fb3458a (patch) | |
tree | 5328a361f12d382cf129032c1a96e529771342fd /weaver | |
parent | d78d9ed48963cf302c26daab6af782d9b01ea3ac (diff) | |
download | aspectj-be5b37f766faa5086aebcc4c751742ce4fb3458a.tar.gz aspectj-be5b37f766faa5086aebcc4c751742ce4fb3458a.zip |
remember source location and handle identifier across invocations
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]; |