]> source.dussan.org Git - aspectj.git/commitdiff
test/fix for 148786: new array joinpoint problem. tiny one line change, safe for...
authoraclement <aclement>
Tue, 27 Jun 2006 11:34:41 +0000 (11:34 +0000)
committeraclement <aclement>
Tue, 27 Jun 2006 11:34:41 +0000 (11:34 +0000)
tests/bugs152/pr148786/A.java [new file with mode: 0644]
tests/src/org/aspectj/systemtest/ajc152/Ajc152Tests.java
tests/src/org/aspectj/systemtest/ajc152/ajc152.xml
weaver/src/org/aspectj/weaver/bcel/BcelWorld.java

diff --git a/tests/bugs152/pr148786/A.java b/tests/bugs152/pr148786/A.java
new file mode 100644 (file)
index 0000000..8250730
--- /dev/null
@@ -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());
+  }
+}
index 17996d89effbacae3c48101895ef3778b2788110..e53fc4f4a724fd93c095b9883a754379908e43c7 100644 (file)
@@ -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");}
index 481e3243c5488645d936bc67f0f52243974704b9..cbff0e3d1277f738efd3d7c38a0784113f3534c9 100644 (file)
         <compile files="TheWholeShow.aj" options="-1.5"/>
         <run class="TheWholeShow"/>
     </ajc-test>    
+    
+    <ajc-test dir="bugs152/pr148786" title="freaky new array joinpoint">
+        <compile files="A.java" options="-Xjoinpoints:arrayconstruction"/>
+        <run class="A">
+          <stderr>
+            <line text="new array: class [[B"/>
+          </stderr>
+        </run>
+    </ajc-test>    
 </suite>
\ No newline at end of file
index c06f963c0c64f36baf73ebcee9363bd81f0ad3f8..f7bd4d5f1955f2c2fa493c50fb398c80718ca847 100644 (file)
@@ -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, "<init>", new ResolvedType[]{ResolvedType.INT});
-                       
                } else if (i instanceof MULTIANEWARRAY) {
                        MULTIANEWARRAY arrayInstruction = (MULTIANEWARRAY)i;
                        UnresolvedType ut = null;