aboutsummaryrefslogtreecommitdiffstats
path: root/weaver
diff options
context:
space:
mode:
authoraclement <aclement>2005-01-05 16:42:01 +0000
committeraclement <aclement>2005-01-05 16:42:01 +0000
commita504e4ab1f4778a365848bd7975955edc2202ea5 (patch)
tree33dca2ce60dce34441c67b835eb0fee8901e971d /weaver
parent39be3b9710c6ca753dc78c4bcfdbea940df0e052 (diff)
downloadaspectj-a504e4ab1f4778a365848bd7975955edc2202ea5.tar.gz
aspectj-a504e4ab1f4778a365848bd7975955edc2202ea5.zip
BWD: improved source loc creation
Diffstat (limited to 'weaver')
-rw-r--r--weaver/src/org/aspectj/weaver/bcel/BcelMethod.java15
1 files changed, 15 insertions, 0 deletions
diff --git a/weaver/src/org/aspectj/weaver/bcel/BcelMethod.java b/weaver/src/org/aspectj/weaver/bcel/BcelMethod.java
index 006f9d6a0..e7725f374 100644
--- a/weaver/src/org/aspectj/weaver/bcel/BcelMethod.java
+++ b/weaver/src/org/aspectj/weaver/bcel/BcelMethod.java
@@ -22,8 +22,11 @@ import org.aspectj.apache.bcel.classfile.LocalVariable;
import org.aspectj.apache.bcel.classfile.LocalVariableTable;
import org.aspectj.apache.bcel.classfile.Method;
import org.aspectj.apache.bcel.classfile.annotation.Annotation;
+import org.aspectj.bridge.ISourceLocation;
+import org.aspectj.bridge.SourceLocation;
import org.aspectj.weaver.AjAttribute;
import org.aspectj.weaver.BCException;
+import org.aspectj.weaver.ISourceContext;
import org.aspectj.weaver.ResolvedMember;
import org.aspectj.weaver.ResolvedTypeX;
import org.aspectj.weaver.ShadowMunger;
@@ -51,6 +54,7 @@ final class BcelMethod extends ResolvedMember {
method.getName(),
method.getSignature());
this.method = method;
+ this.sourceContext = declaringType.getResolvedTypeX().getSourceContext();
this.world = declaringType.getResolvedTypeX().getWorld();
unpackAjAttributes(world);
unpackJavaAttributes();
@@ -132,6 +136,17 @@ final class BcelMethod extends ResolvedMember {
return -1;
}
}
+
+ public ISourceLocation getSourceLocation() {
+ ISourceLocation ret = super.getSourceLocation();
+ if ((ret == null || ret.getLine()==0) && hasDeclarationLineNumberInfo()) {
+ // lets see if we can do better
+ ISourceContext isc = getSourceContext();
+ if (isc !=null) ret = isc.makeSourceLocation(getDeclarationLineNumber());
+ else ret = new SourceLocation(null,getDeclarationLineNumber());
+ }
+ return ret;
+ }
public Kind getKind() {
if (associatedShadowMunger != null) {