From a504e4ab1f4778a365848bd7975955edc2202ea5 Mon Sep 17 00:00:00 2001 From: aclement Date: Wed, 5 Jan 2005 16:42:01 +0000 Subject: [PATCH] BWD: improved source loc creation --- .../src/org/aspectj/weaver/bcel/BcelMethod.java | 15 +++++++++++++++ 1 file changed, 15 insertions(+) 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) { -- 2.39.5