From af08e729f0ca9f49ca139f1099eb2dd197be6ce2 Mon Sep 17 00:00:00 2001 From: aclement Date: Tue, 3 Oct 2006 10:32:55 +0000 Subject: [PATCH] fixes for 145442: better line numbers for woven code --- .../systemtest/ajc153/Ajc153Tests.java | 4 ++-- .../org/aspectj/systemtest/ajc153/ajc153.xml | 4 ++-- .../org/aspectj/weaver/bcel/BcelShadow.java | 2 +- weaver/testdata/AroundAllFancyHelloWorld.txt | 20 +++++++++---------- weaver/testdata/AroundAllHelloWorld.txt | 4 ++-- weaver/testdata/TjpAround2HelloWorld.txt | 4 ++-- weaver/testdata/TjpAroundHelloWorld.txt | 2 +- weaver/testdata/TraceJarHello.txt | 2 +- 8 files changed, 21 insertions(+), 21 deletions(-) diff --git a/tests/src/org/aspectj/systemtest/ajc153/Ajc153Tests.java b/tests/src/org/aspectj/systemtest/ajc153/Ajc153Tests.java index 50998bf7f..e32630e4c 100644 --- a/tests/src/org/aspectj/systemtest/ajc153/Ajc153Tests.java +++ b/tests/src/org/aspectj/systemtest/ajc153/Ajc153Tests.java @@ -24,13 +24,13 @@ import org.aspectj.weaver.bcel.Utility; public class Ajc153Tests extends org.aspectj.testing.XMLBasedAjcTestCase { //public void testGenericsProblem_pr151978() { runTest("generics problem");} -// public void testMissingLineNumbersInStacktraceAfter_pr145442() { runTest("missing line numbers in stacktrace after");} -// public void testMissingLineNumbersInStacktraceAround_pr145442() { runTest("missing line numbers in stacktrace around");} // public void testArgnamesAndJavac_pr148381() { runTest("argNames and javac");} // public void testCFlowXMLAspectLTW_pr149096() { runTest("cflow xml concrete aspect"); } // public void testAmbiguousBinding_pr121805() { runTest("ambiguous binding");} // public void testNoIllegalStateExceptionWithGenericInnerAspect_pr156058() { runTest("no IllegalStateException with generic inner aspect"); } // public void testNegatedAnnotationMatchingProblem_pr153464() { runTest("negated annotation matching problem");} + public void testMissingLineNumbersInStacktraceAfter_pr145442() { runTest("missing line numbers in stacktrace after");} + public void testMissingLineNumbersInStacktraceAround_pr145442() { runTest("missing line numbers in stacktrace around");} public void testGenericArrays_pr158624() { runTest("generics and arrays"); } public void testMissingLineNumbersInStacktraceBefore_pr145442() { runTest("missing line numbers in stacktrace before");} public void testMissingLineNumbersInStacktraceBefore_pr145442_Binary() { runTest("missing line numbers in stacktrace before - binary");} diff --git a/tests/src/org/aspectj/systemtest/ajc153/ajc153.xml b/tests/src/org/aspectj/systemtest/ajc153/ajc153.xml index 710a14809..9ebb3fca3 100644 --- a/tests/src/org/aspectj/systemtest/ajc153/ajc153.xml +++ b/tests/src/org/aspectj/systemtest/ajc153/ajc153.xml @@ -248,7 +248,7 @@ - + @@ -259,7 +259,7 @@ - + diff --git a/weaver/src/org/aspectj/weaver/bcel/BcelShadow.java b/weaver/src/org/aspectj/weaver/bcel/BcelShadow.java index 50d8bb045..cb47bb9a0 100644 --- a/weaver/src/org/aspectj/weaver/bcel/BcelShadow.java +++ b/weaver/src/org/aspectj/weaver/bcel/BcelShadow.java @@ -3058,7 +3058,7 @@ public class BcelShadow extends Shadow { // invoke the advice advice.append(munger.getNonTestAdviceInstructions(this)); advice.append(returnConversionCode); - if (getKind()==Shadow.MethodExecution) { + if (getKind()==Shadow.MethodExecution && linenumber>0) { advice.getStart().addTargeter(new LineNumberTag(linenumber)); } diff --git a/weaver/testdata/AroundAllFancyHelloWorld.txt b/weaver/testdata/AroundAllFancyHelloWorld.txt index b7a8d8623..d1f593c67 100644 --- a/weaver/testdata/AroundAllFancyHelloWorld.txt +++ b/weaver/testdata/AroundAllFancyHelloWorld.txt @@ -1,6 +1,6 @@ public abstract class FancyHelloWorld extends java.lang.Object: public void (): - ALOAD_0 // FancyHelloWorld this (line 7) + ALOAD_0 // LFancyHelloWorld; this (line 7) INVOKESPECIAL java.lang.Object. ()V constructor-execution(void FancyHelloWorld.()) | BIPUSH 1 @@ -24,7 +24,7 @@ public abstract class FancyHelloWorld extends java.lang.Object: ALOAD_0 ASTORE 15 method-execution(void FancyHelloWorld.main(java.lang.String[])) - | BIPUSH 1 + | BIPUSH 1 (line 9) | ANEWARRAY java.lang.Object | ASTORE 16 | ALOAD 16 @@ -43,7 +43,7 @@ public abstract class FancyHelloWorld extends java.lang.Object: public static String getName(): method-execution(java.lang.String FancyHelloWorld.getName()) - | BIPUSH 0 + | BIPUSH 0 (line 20) | ANEWARRAY java.lang.Object | ASTORE 10 | NEW FancyHelloWorld$AjcClosure21 @@ -101,7 +101,7 @@ public abstract class FancyHelloWorld extends java.lang.Object: ASTORE_3 (line 9) finally -> E1 | catch java.lang.Exception -> E0 - | | ALOAD_3 // java.io.PrintStream out (line 11) + | | ALOAD_3 // Ljava/io/PrintStream; out (line 11) | | LDC "bye" | | ASTORE 5 | | ASTORE 7 @@ -127,8 +127,8 @@ public abstract class FancyHelloWorld extends java.lang.Object: | | GOTO L0 | catch java.lang.Exception -> E0 | E0: ASTORE 11 (line 12) - | ALOAD_3 // java.io.PrintStream out (line 13) - | ALOAD 11 // java.lang.Exception e + | ALOAD_3 // Ljava/io/PrintStream; out (line 13) + | ALOAD 11 // Ljava/lang/Exception; e | ASTORE 13 | ASTORE 15 | method-call(void java.io.PrintStream.println(java.lang.Object)) @@ -159,7 +159,7 @@ public abstract class FancyHelloWorld extends java.lang.Object: L0: JSR L1 GOTO L2 L1: ASTORE 21 - ALOAD_3 // java.io.PrintStream out (line 15) + ALOAD_3 // Ljava/io/PrintStream; out (line 15) LDC "finally" ASTORE 23 ASTORE 25 @@ -216,7 +216,7 @@ public abstract class FancyHelloWorld extends java.lang.Object: static final String getName_aroundBody20(): ICONST_0 (line 20) ISTORE_0 - ILOAD_0 // int x (line 21) + ILOAD_0 // I x (line 21) LDC "name" ASTORE_2 method-call(int java.lang.String.hashCode()) @@ -235,7 +235,7 @@ public abstract class FancyHelloWorld extends java.lang.Object: | INVOKESTATIC org.aspectj.runtime.internal.Conversions.intValue (Ljava/lang/Object;)I method-call(int java.lang.String.hashCode()) IADD - ISTORE_0 // int x + ISTORE_0 // I x LDC "name" (line 22) ASTORE 6 constructor-call(void java.lang.StringBuffer.(java.lang.String)) @@ -253,7 +253,7 @@ public abstract class FancyHelloWorld extends java.lang.Object: | INVOKESTATIC Aspect.ajc_around (Lorg/aspectj/runtime/internal/AroundClosure;)Ljava/lang/Object; | CHECKCAST java.lang.StringBuffer constructor-call(void java.lang.StringBuffer.(java.lang.String)) - ILOAD_0 // int x + ILOAD_0 // I x ISTORE 10 ASTORE 12 method-call(java.lang.StringBuffer java.lang.StringBuffer.append(int)) diff --git a/weaver/testdata/AroundAllHelloWorld.txt b/weaver/testdata/AroundAllHelloWorld.txt index ea505e316..7adbca1f3 100644 --- a/weaver/testdata/AroundAllHelloWorld.txt +++ b/weaver/testdata/AroundAllHelloWorld.txt @@ -1,6 +1,6 @@ public class HelloWorld extends java.lang.Object: public void (): - ALOAD_0 // HelloWorld this (line 5) + ALOAD_0 // LHelloWorld; this (line 5) INVOKESPECIAL java.lang.Object. ()V constructor-execution(void HelloWorld.()) | BIPUSH 1 @@ -24,7 +24,7 @@ public class HelloWorld extends java.lang.Object: ALOAD_0 ASTORE 5 method-execution(void HelloWorld.main(java.lang.String[])) - | BIPUSH 1 + | BIPUSH 1 (line 8) | ANEWARRAY java.lang.Object | ASTORE 6 | ALOAD 6 diff --git a/weaver/testdata/TjpAround2HelloWorld.txt b/weaver/testdata/TjpAround2HelloWorld.txt index a267a3351..ab1a100f8 100644 --- a/weaver/testdata/TjpAround2HelloWorld.txt +++ b/weaver/testdata/TjpAround2HelloWorld.txt @@ -44,7 +44,7 @@ public class HelloWorld extends java.lang.Object: INVOKESTATIC org.aspectj.runtime.reflect.Factory.makeJP (Lorg/aspectj/lang/JoinPoint$StaticPart;Ljava/lang/Object;Ljava/lang/Object;Ljava/lang/Object;)Lorg/aspectj/lang/JoinPoint; ASTORE 10 method-execution(void HelloWorld.main(java.lang.String[])) - | BIPUSH 2 + | BIPUSH 2 (line 8) | ANEWARRAY java.lang.Object | ASTORE 12 | ALOAD 12 @@ -271,7 +271,7 @@ public class HelloWorld extends java.lang.Object: end static final void main_aroundBody12(String[], org.aspectj.lang.JoinPoint) static final void main_aroundBody14(String[], org.aspectj.lang.JoinPoint): - BIPUSH 2 + BIPUSH 2 (line 8) ANEWARRAY java.lang.Object ASTORE_2 ALOAD_2 diff --git a/weaver/testdata/TjpAroundHelloWorld.txt b/weaver/testdata/TjpAroundHelloWorld.txt index 4c8654948..92065df50 100644 --- a/weaver/testdata/TjpAroundHelloWorld.txt +++ b/weaver/testdata/TjpAroundHelloWorld.txt @@ -44,7 +44,7 @@ public class HelloWorld extends java.lang.Object: INVOKESTATIC org.aspectj.runtime.reflect.Factory.makeJP (Lorg/aspectj/lang/JoinPoint$StaticPart;Ljava/lang/Object;Ljava/lang/Object;Ljava/lang/Object;)Lorg/aspectj/lang/JoinPoint; ASTORE 8 method-execution(void HelloWorld.main(java.lang.String[])) - | BIPUSH 2 + | BIPUSH 2 (line 8) | ANEWARRAY java.lang.Object | ASTORE 9 | ALOAD 9 diff --git a/weaver/testdata/TraceJarHello.txt b/weaver/testdata/TraceJarHello.txt index 7e313b911..8589536d6 100644 --- a/weaver/testdata/TraceJarHello.txt +++ b/weaver/testdata/TraceJarHello.txt @@ -91,7 +91,7 @@ public class DynamicHelloWorld extends java.lang.Object implements java.io.Seria end static final String doit_aroundBody0(DynamicHelloWorld, String, java.util.List) static final String doit_aroundBody2(DynamicHelloWorld, String, java.util.List): - INVOKESTATIC MyTrace.aspectOf ()LMyTrace; + INVOKESTATIC MyTrace.aspectOf ()LMyTrace; (line 21) ALOAD_0 BIPUSH 3 ANEWARRAY java.lang.Object -- 2.39.5