]> source.dussan.org Git - aspectj.git/commitdiff
testcode and fix for pr112476: binary weaving decp
authoraclement <aclement>
Fri, 4 Nov 2005 10:47:47 +0000 (10:47 +0000)
committeraclement <aclement>
Fri, 4 Nov 2005 10:47:47 +0000 (10:47 +0000)
tests/bugs150/pr112476/case1/lib/A.java [new file with mode: 0644]
tests/bugs150/pr112476/case1/lib/B.java [new file with mode: 0644]
tests/bugs150/pr112476/case1/lib/C.java [new file with mode: 0644]
tests/bugs150/pr112476/case1/weaved/DeclareAspect.aj [new file with mode: 0644]
tests/bugs150/pr112476/case1/weaved/SuperC.java [new file with mode: 0644]
tests/src/org/aspectj/systemtest/ajc150/Ajc150Tests.java
tests/src/org/aspectj/systemtest/ajc150/ajc150.xml
weaver/src/org/aspectj/weaver/bcel/BcelTypeMunger.java

diff --git a/tests/bugs150/pr112476/case1/lib/A.java b/tests/bugs150/pr112476/case1/lib/A.java
new file mode 100644 (file)
index 0000000..dc0641a
--- /dev/null
@@ -0,0 +1,8 @@
+package lib;
+
+public class A {
+
+       public A(String s) {            
+       }
+
+}
diff --git a/tests/bugs150/pr112476/case1/lib/B.java b/tests/bugs150/pr112476/case1/lib/B.java
new file mode 100644 (file)
index 0000000..2436e24
--- /dev/null
@@ -0,0 +1,9 @@
+package lib;
+
+public class B extends A{
+
+       public B(String s) {
+               super(s);
+       }
+
+}
diff --git a/tests/bugs150/pr112476/case1/lib/C.java b/tests/bugs150/pr112476/case1/lib/C.java
new file mode 100644 (file)
index 0000000..3760bf2
--- /dev/null
@@ -0,0 +1,14 @@
+/*
+ * Created on Oct 13, 2005 
+ * \u00462004-2005 Business Process Engineering S.r.L.  All rights reserved
+ */
+
+package lib;
+
+public class C extends B {
+
+       public C(String s) {
+               super(s);
+       }
+
+}
diff --git a/tests/bugs150/pr112476/case1/weaved/DeclareAspect.aj b/tests/bugs150/pr112476/case1/weaved/DeclareAspect.aj
new file mode 100644 (file)
index 0000000..29feee1
--- /dev/null
@@ -0,0 +1,5 @@
+package weaved;
+
+public aspect DeclareAspect {
+       declare parents : lib.C extends SuperC;
+}
diff --git a/tests/bugs150/pr112476/case1/weaved/SuperC.java b/tests/bugs150/pr112476/case1/weaved/SuperC.java
new file mode 100644 (file)
index 0000000..f2e1b03
--- /dev/null
@@ -0,0 +1,17 @@
+package weaved;
+
+import lib.B;
+import lib.C;
+
+public class SuperC extends B {
+
+       public SuperC(String s) {
+               super(s);
+       }
+       
+       public static void main(String[] args) {
+               C c = new C("test");
+               System.out.println("Is ["+C.class+"] subcass of ["+SuperC.class+"]? "+(SuperC.class.isAssignableFrom(c.getClass())));
+       }
+
+}
index 8d8f2a8370222f9fb631719c2fbc7a6981db04b5..26c4d16fcab129d10414c9ff6baf81e8280997ef 100644 (file)
@@ -51,6 +51,7 @@ public class Ajc150Tests extends org.aspectj.testing.XMLBasedAjcTestCase {
   public void testITDCtor_pr112783()       { runTest("Problem with constructor ITDs");}
   */
   
+  public void testBrokenDecp_pr112476()       { runTest("binary weaving decp broken");}
   public void testUnboundFormal_pr112027()    { runTest("unexpected error unboundFormalInPC");}
   public void testNPEScopeSetup_pr115038()    { runTest("NPE in ensureScopeSetup");}
   public void testCCEGenerics_pr113445()      { runTest("Generics ClassCastException");}
index b6b5e6bf83cebe4f953ae5dbd8a3f84ae927b38f..63481ee2f759bea15c209d5d8f12f4a150cc8b3e 100644 (file)
@@ -3,6 +3,20 @@
 <!-- AspectJ v1.5.0 Tests -->
 <suite>
 
+    <ajc-test dir="bugs150/pr112476/case1" title="binary weaving decp broken">
+        <compile files="lib/A.java,lib/B.java,lib/C.java" outjar="library.jar" options="-1.5"/>
+        <!-- library.jar on the aspectpath here just for resolution when compiling SuperC -->
+        <compile aspectpath="library.jar" files="weaved/SuperC.java" outjar="newsuper.jar" options="-1.5"/>
+        <compile inpath="library.jar;newsuper.jar" files="weaved/DeclareAspect.aj" options="-1.5 -showWeaveInfo">
+          <message kind="weave" text="Setting superclass of type 'lib.C' (C.java) to 'weaved.SuperC' (DeclareAspect.aj)"/>
+        </compile>
+        <run class="weaved.SuperC">
+          <stdout>
+             <line text="Is [class lib.C] subcass of [class weaved.SuperC]? true"/>
+          </stdout>
+        </run>
+    </ajc-test>
+    
     <ajc-test dir="java5/staticImports" title="import static java.lang.System.out">
         <compile files="StaticImport.aj" options="-1.5"/>
     </ajc-test>
@@ -10,7 +24,7 @@
     <ajc-test dir="bugs150" title="Problem with constructor ITDs">
         <compile files="pr112783.aj" options="-1.5"/>
     </ajc-test>
+
     <ajc-test dir="bugs150" title="NPE in ensureScopeSetup">
         <compile files="pr115038.aj" options="-1.5">
           <!-- fixme asc the 'static ref' messages are a bit poor and ought to be eliminated... -->
         </compile>
     </ajc-test>
  
-   <ajc-test dir="bugs150" title="ITDC with no explicit cons call">
+    <ajc-test dir="bugs150" title="ITDC with no explicit cons call">
       <compile files="Pr62606.aj" options="-1.5">
         <message kind="warning" line="6" text="[Xlint:noExplicitConstructorCall]"/>
       </compile>
     </ajc-test>
+    
     <ajc-test dir="java5/generics/bugs" title="using same type variable in ITD">
       <compile files="SameTypeVariable.aj" options="-1.5">
       </compile>
index a93d6859d383089b1229f7af15aa64f19f3f80cf..464f1e65a05cf7e477aeefadb90be8cab9e16947 100644 (file)
@@ -424,7 +424,7 @@ public class BcelTypeMunger extends ConcreteTypeMunger {
                                 }
                                                }
                      
-                                               int idx = cpg.addMethodref(newParent.getClassName(), invokeSpecial.getMethodName(cpg), invokeSpecial.getSignature(cpg));
+                                               int idx = cpg.addMethodref(newParent.getName(), invokeSpecial.getMethodName(cpg), invokeSpecial.getSignature(cpg));
                                                invokeSpecial.setIndex(idx);
                                        }
                                }