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;
}
}
- // 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");
}
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");
}
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