From: jhugunin Date: Thu, 1 May 2003 02:02:56 +0000 (+0000) Subject: fix for X-Git-Tag: V1_1_0_RC2~102 X-Git-Url: https://source.dussan.org/?a=commitdiff_plain;h=abe705ad6b4926e7c02cf49b3ba033c320cf2b60;p=aspectj.git fix for Bugzilla Bug 37020 wrong line for method execution join point (but points to first executable line rather than method declaration) and Bugzilla Bug 37021 source path wrong in declare warning on binary files --- diff --git a/weaver/src/org/aspectj/weaver/bcel/BcelSourceContext.java b/weaver/src/org/aspectj/weaver/bcel/BcelSourceContext.java index 72a7939e1..f8c4c3c9a 100644 --- a/weaver/src/org/aspectj/weaver/bcel/BcelSourceContext.java +++ b/weaver/src/org/aspectj/weaver/bcel/BcelSourceContext.java @@ -29,6 +29,12 @@ public class BcelSourceContext implements ISourceContext { public BcelSourceContext(BcelObjectType inObject) { this.inObject = inObject; + sourceFileName = inObject.getJavaClass().getSourceFileName(); + + String pname = inObject.getResolvedTypeX().getPackageName(); + if (pname != null) { + sourceFileName = pname.replace('.', '/') + '/' + sourceFileName; + } } private File getSourceFile() { diff --git a/weaver/src/org/aspectj/weaver/bcel/Utility.java b/weaver/src/org/aspectj/weaver/bcel/Utility.java index 4d54a786e..402c85b2f 100644 --- a/weaver/src/org/aspectj/weaver/bcel/Utility.java +++ b/weaver/src/org/aspectj/weaver/bcel/Utility.java @@ -421,6 +421,8 @@ public class Utility { /** returns -1 if no source line attribute */ public static int getSourceLine(InstructionHandle ih) { + if (ih == null) return -1; + InstructionTargeter[] ts = ih.getTargeters(); if (ts != null) { for (int j = ts.length - 1; j >= 0; j--) { @@ -430,7 +432,7 @@ public class Utility { } } } - return -1; + return getSourceLine(ih.getNext()); } // assumes that there is no already extant source line tag. Otherwise we'll have to be better.