From 792d1dfd50e8b9ca5df70ea84c0b35de9cfba0f3 Mon Sep 17 00:00:00 2001 From: aclement Date: Tue, 27 Jun 2006 11:34:41 +0000 Subject: [PATCH] test/fix for 148786: new array joinpoint problem. tiny one line change, safe for committing post RC. --- tests/bugs152/pr148786/A.java | 11 +++++++++++ .../org/aspectj/systemtest/ajc152/Ajc152Tests.java | 1 + tests/src/org/aspectj/systemtest/ajc152/ajc152.xml | 9 +++++++++ weaver/src/org/aspectj/weaver/bcel/BcelWorld.java | 3 +-- 4 files changed, 22 insertions(+), 2 deletions(-) create mode 100644 tests/bugs152/pr148786/A.java diff --git a/tests/bugs152/pr148786/A.java b/tests/bugs152/pr148786/A.java new file mode 100644 index 000000000..8250730b2 --- /dev/null +++ b/tests/bugs152/pr148786/A.java @@ -0,0 +1,11 @@ +public class A { + public static void main(String []argv) { + byte[][] bytes = new byte[][]{{0},{1}}; + } +} + +aspect X { + after() returning(Object o) : call(*[][].new(..)) { + System.err.println("new array: "+o.getClass()); + } +} diff --git a/tests/src/org/aspectj/systemtest/ajc152/Ajc152Tests.java b/tests/src/org/aspectj/systemtest/ajc152/Ajc152Tests.java index 17996d89e..e53fc4f4a 100644 --- a/tests/src/org/aspectj/systemtest/ajc152/Ajc152Tests.java +++ b/tests/src/org/aspectj/systemtest/ajc152/Ajc152Tests.java @@ -35,6 +35,7 @@ public class Ajc152Tests extends org.aspectj.testing.XMLBasedAjcTestCase { // public void testItdCallingGenericMethod_pr145391_2() { runTest("itd calling generic method - 2");} // public void testAdviceNotWovenAspectPath_pr147841() { runTest("advice not woven on aspectpath");} // public void testClassCastForInvalidAnnotationValue_pr148537() { runTest("classcast annotation value");} + public void testFreakyNewArrayJoinpoint_pr148786() { runTest("freaky new array joinpoint"); } public void testPrivilegeGeneric_pr148545() { runTest("nosuchmethoderror for privileged aspect");} public void testPrivilegeGeneric_pr148545_2() { runTest("nosuchmethoderror for privileged aspect - 2");} public void testUnknownAnnotationNPE() { runTest("NPE for unknown annotation");} diff --git a/tests/src/org/aspectj/systemtest/ajc152/ajc152.xml b/tests/src/org/aspectj/systemtest/ajc152/ajc152.xml index 481e3243c..cbff0e3d1 100644 --- a/tests/src/org/aspectj/systemtest/ajc152/ajc152.xml +++ b/tests/src/org/aspectj/systemtest/ajc152/ajc152.xml @@ -783,4 +783,13 @@ + + + + + + + + + \ No newline at end of file diff --git a/weaver/src/org/aspectj/weaver/bcel/BcelWorld.java b/weaver/src/org/aspectj/weaver/bcel/BcelWorld.java index c06f963c0..f7bd4d5f1 100644 --- a/weaver/src/org/aspectj/weaver/bcel/BcelWorld.java +++ b/weaver/src/org/aspectj/weaver/bcel/BcelWorld.java @@ -479,11 +479,10 @@ public class BcelWorld extends World implements Repository { if (i instanceof ANEWARRAY) { ANEWARRAY arrayInstruction = (ANEWARRAY)i; - ObjectType ot = arrayInstruction.getLoadClassType(cpg); + Type ot = arrayInstruction.getType(cpg); UnresolvedType ut = fromBcel(ot); ut = UnresolvedType.makeArray(ut,1); retval = MemberImpl.method(ut, Modifier.PUBLIC, ResolvedType.VOID, "", new ResolvedType[]{ResolvedType.INT}); - } else if (i instanceof MULTIANEWARRAY) { MULTIANEWARRAY arrayInstruction = (MULTIANEWARRAY)i; UnresolvedType ut = null; -- 2.39.5