summaryrefslogtreecommitdiffstats
path: root/tests
diff options
context:
space:
mode:
authoraclement <aclement>2008-10-30 15:43:42 +0000
committeraclement <aclement>2008-10-30 15:43:42 +0000
commit19e1e92ad7a75f9f00c4a31ce7db98527f2c0c62 (patch)
tree2509b1f2b133d764d28477cf36e0b01000059661 /tests
parentaa557a28af6ccb3bc0aa427665d5ec615d61d546 (diff)
downloadaspectj-19e1e92ad7a75f9f00c4a31ce7db98527f2c0c62.tar.gz
aspectj-19e1e92ad7a75f9f00c4a31ce7db98527f2c0c62.zip
173978: test and fix: local var table for method-execution and around advice
Diffstat (limited to 'tests')
-rw-r--r--tests/bugs163/pr173978/Test.java7
-rw-r--r--tests/bugs163/pr173978/TestAroundAspect.java6
-rw-r--r--tests/src/org/aspectj/systemtest/ajc161/Ajc161Tests.java24
-rw-r--r--tests/src/org/aspectj/systemtest/ajc163/Ajc163Tests.java48
-rw-r--r--tests/src/org/aspectj/systemtest/ajc163/ajc163.xml4
5 files changed, 65 insertions, 24 deletions
diff --git a/tests/bugs163/pr173978/Test.java b/tests/bugs163/pr173978/Test.java
new file mode 100644
index 000000000..459d3cd20
--- /dev/null
+++ b/tests/bugs163/pr173978/Test.java
@@ -0,0 +1,7 @@
+public class Test{
+ public void sayHello(String message){
+ System.out.println(message);
+ }
+}
+
+
diff --git a/tests/bugs163/pr173978/TestAroundAspect.java b/tests/bugs163/pr173978/TestAroundAspect.java
new file mode 100644
index 000000000..9a884dd63
--- /dev/null
+++ b/tests/bugs163/pr173978/TestAroundAspect.java
@@ -0,0 +1,6 @@
+public aspect TestAroundAspect{
+ void around(): execution(void Test.sayHello(String)){
+ proceed();
+ }
+}
+
diff --git a/tests/src/org/aspectj/systemtest/ajc161/Ajc161Tests.java b/tests/src/org/aspectj/systemtest/ajc161/Ajc161Tests.java
index ee702e5e1..dfb8ca594 100644
--- a/tests/src/org/aspectj/systemtest/ajc161/Ajc161Tests.java
+++ b/tests/src/org/aspectj/systemtest/ajc161/Ajc161Tests.java
@@ -16,8 +16,6 @@ import java.util.Set;
import junit.framework.Test;
-import org.aspectj.apache.bcel.classfile.LocalVariable;
-import org.aspectj.apache.bcel.classfile.LocalVariableTable;
import org.aspectj.asm.AsmManager;
import org.aspectj.asm.IRelationshipMap;
import org.aspectj.testing.XMLBasedAjcTestCase;
@@ -154,28 +152,6 @@ public class Ajc161Tests extends org.aspectj.testing.XMLBasedAjcTestCase {
}
}
- // public void testLVTableAround_pr173978() throws Exception {
- // runTest("lv table for around");
- // JavaClass jc = Utils.getClassFrom(ajc.getSandboxDirectory().getAbsolutePath(),"Test");
- // Method[] ms = jc.getMethods();
- // Method m = null;
- // for (int i = 0; i < ms.length; i++) {
- // if (ms[i].getName().equals("sayHello")) {
- // m = ms[i];
- // }
- // }
- // if (m.getLocalVariableTable()==null) fail("Local variable table should not be null");
- // print(m.getLocalVariableTable());
- // }
-
- private void print(LocalVariableTable localVariableTable) {
- LocalVariable[] lvs = localVariableTable.getLocalVariableTable();
- for (int i = 0; i < lvs.length; i++) {
- LocalVariable localVariable = lvs[i];
- System.out.println(localVariable);
- }
- }
-
public void testITDPrecedence_pr233838_1() {
runTest("itd precedence - 1");
}
diff --git a/tests/src/org/aspectj/systemtest/ajc163/Ajc163Tests.java b/tests/src/org/aspectj/systemtest/ajc163/Ajc163Tests.java
index 7563a372b..e0dadda18 100644
--- a/tests/src/org/aspectj/systemtest/ajc163/Ajc163Tests.java
+++ b/tests/src/org/aspectj/systemtest/ajc163/Ajc163Tests.java
@@ -14,10 +14,48 @@ import java.io.File;
import junit.framework.Test;
+import org.aspectj.apache.bcel.classfile.JavaClass;
+import org.aspectj.apache.bcel.classfile.LocalVariable;
+import org.aspectj.apache.bcel.classfile.LocalVariableTable;
+import org.aspectj.apache.bcel.classfile.Method;
+import org.aspectj.testing.Utils;
import org.aspectj.testing.XMLBasedAjcTestCase;
public class Ajc163Tests extends org.aspectj.testing.XMLBasedAjcTestCase {
+ public void testMissingLocalVariableTableEntriesOnAroundAdvice_pr173978() throws Exception {
+ runTest("missing local variable table on around advice");
+ JavaClass jc = Utils.getClassFrom(ajc.getSandboxDirectory().getAbsolutePath(), "Test");
+ Method[] ms = jc.getMethods();
+ Method m = null;
+ for (int i = 0; i < ms.length; i++) {
+ if (ms[i].getName().equals("sayHello")) {
+ m = ms[i];
+ }
+ }
+ if (m.getLocalVariableTable() == null) {
+ fail("Local variable table should not be null");
+ }
+ assertEquals(2, m.getLocalVariableTable().getLocalVariableTable().length);
+ // LocalVariableTable:
+ // Start Length Slot Name Signature
+ // 0 12 0 this LTest;
+ // 0 12 1 message Ljava/lang/String;
+ LocalVariable lv = m.getLocalVariableTable().getLocalVariable(0);
+ assertNotNull(lv);
+ assertEquals("this", lv.getName());
+ assertEquals(0, lv.getStartPC(), 0);
+ assertEquals(12, lv.getLength(), 12);
+ assertEquals("LTest;", lv.getSignature());
+ lv = m.getLocalVariableTable().getLocalVariable(1);
+ assertNotNull(lv);
+ assertEquals("message", lv.getName());
+ assertEquals(0, lv.getStartPC(), 0);
+ assertEquals(12, lv.getLength(), 12);
+ assertEquals("Ljava/lang/String;", lv.getSignature());
+ // print(m.getLocalVariableTable());
+ }
+
public void testTerminateAfterCompilation_pr249710() {
runTest("terminateAfterCompilation");
}
@@ -50,4 +88,14 @@ public class Ajc163Tests extends org.aspectj.testing.XMLBasedAjcTestCase {
return new File("../tests/src/org/aspectj/systemtest/ajc163/ajc163.xml");
}
+ // ---
+
+ private void print(LocalVariableTable localVariableTable) {
+ LocalVariable[] lvs = localVariableTable.getLocalVariableTable();
+ for (int i = 0; i < lvs.length; i++) {
+ LocalVariable localVariable = lvs[i];
+ System.out.println(localVariable);
+ }
+ }
+
} \ No newline at end of file
diff --git a/tests/src/org/aspectj/systemtest/ajc163/ajc163.xml b/tests/src/org/aspectj/systemtest/ajc163/ajc163.xml
index 921444abe..9119c6f5d 100644
--- a/tests/src/org/aspectj/systemtest/ajc163/ajc163.xml
+++ b/tests/src/org/aspectj/systemtest/ajc163/ajc163.xml
@@ -18,6 +18,10 @@
<message kind="error" line="4" text="Syntax error"/>
</compile>
</ajc-test>
+
+ <ajc-test dir="bugs163/pr173978" title="missing local variable table on around advice">
+ <compile files="Test.java TestAroundAspect.java" options="-1.5"/>
+ </ajc-test>
<ajc-test dir="bugs163/pr249710" title="terminateAfterCompilation">
<compile files="Foo.java" options="-1.5">