]> source.dussan.org Git - aspectj.git/commitdiff
275032: test and fix: itd of no-arg constructor should overwrite a generated default...
authoraclement <aclement>
Tue, 5 May 2009 23:40:59 +0000 (23:40 +0000)
committeraclement <aclement>
Tue, 5 May 2009 23:40:59 +0000 (23:40 +0000)
tests/bugs165/pr275032/A.java [new file with mode: 0644]
tests/bugs165/pr275032/X.java [new file with mode: 0644]
tests/bugs165/pr275032/c2/A.java [new file with mode: 0644]
tests/bugs165/pr275032/c2/X.java [new file with mode: 0644]
tests/src/org/aspectj/systemtest/ajc165/Ajc165Tests.java
tests/src/org/aspectj/systemtest/ajc165/ajc165.xml

diff --git a/tests/bugs165/pr275032/A.java b/tests/bugs165/pr275032/A.java
new file mode 100644 (file)
index 0000000..3b2db00
--- /dev/null
@@ -0,0 +1,7 @@
+public class A {
+  int i = 5;
+
+  public static void main(String[] argv) {
+    new A();
+  }
+}
diff --git a/tests/bugs165/pr275032/X.java b/tests/bugs165/pr275032/X.java
new file mode 100644 (file)
index 0000000..5556cf0
--- /dev/null
@@ -0,0 +1,6 @@
+import org.aspectj.lang.annotation.*;
+aspect X {
+  @SuppressAjWarnings
+  public A.new() {System.out.println("itd ctor");}
+
+}
diff --git a/tests/bugs165/pr275032/c2/A.java b/tests/bugs165/pr275032/c2/A.java
new file mode 100644 (file)
index 0000000..8f7645b
--- /dev/null
@@ -0,0 +1,9 @@
+public class A {
+  public A() {
+    System.out.println("real default ctor");
+  }
+
+  public static void main(String[] argv) {
+    new A();
+  }
+}
diff --git a/tests/bugs165/pr275032/c2/X.java b/tests/bugs165/pr275032/c2/X.java
new file mode 100644 (file)
index 0000000..0c560d6
--- /dev/null
@@ -0,0 +1,4 @@
+aspect X {
+  public A.new() {System.out.println("itd");}
+
+}
index dcb857f8d7efa030b53eb1e32a1a8c316a619c20..ec98633a28a346dbb184788be3dfee7cacf88777 100644 (file)
@@ -20,6 +20,26 @@ import org.aspectj.weaver.LintMessage;
 
 public class Ajc165Tests extends org.aspectj.testing.XMLBasedAjcTestCase {
 
+       // check ITD can replace a generated default constructor
+       public void testItdDefaultCtor_pr275032() {
+               runTest("itd default ctor");
+       }
+
+       // check ITD can't overwrite an existing constructor
+       public void testItdDefaultCtor_pr275032_2() {
+               runTest("itd default ctor - 2");
+       }
+
+       // binary weaving version of case 2 - check ITD can't overwrite an existing constructor
+       public void testItdDefaultCtor_pr275032_3() {
+               runTest("itd default ctor - 3");
+       }
+
+       // binary weaving version of case 4 - check ITD can replace a generated default constructor
+       public void testItdDefaultCtor_pr275032_4() {
+               runTest("itd default ctor - 4");
+       }
+
        public void testVerifyOnAnnoBind_pr273628() {
                runTest("verifyerror on anno bind");
        }
@@ -60,7 +80,7 @@ public class Ajc165Tests extends org.aspectj.testing.XMLBasedAjcTestCase {
        public void testGenericITD_pr272825() {
                runTest("generic ITD");
        }
-       
+
        // ---
 
        public static Test suite() {
index c15e75830222c7673ca806da07b690977be41737..169b857556fd2bf82b3eaaa7c86dc4bf0fed2c01 100644 (file)
@@ -2,6 +2,39 @@
 
 <suite>
 
+   <ajc-test dir="bugs165/pr275032" title="itd default ctor">
+     <compile files="A.java X.java" options="-1.5 -Xlint:ignore"/>
+     <run class="A">
+       <stdout>
+         <line text="itd ctor"/>
+       </stdout>
+     </run>
+   </ajc-test>
+   
+   <ajc-test dir="bugs165/pr275032/c2" title="itd default ctor - 2">
+     <compile files="A.java X.java" options="-1.5 -Xlint:ignore">
+            <message kind="error" text="inter-type declaration from X conflicts with existing"/>
+     </compile>
+   </ajc-test>
+   
+   <ajc-test dir="bugs165/pr275032/c2" title="itd default ctor - 3">
+     <compile files="A.java" options="-outjar foo.jar"/>
+     <compile files="X.java" options="-1.5 -Xlint:ignore"  inpath="foo.jar">
+            <message kind="error" text="inter-type declaration from X conflicts with existing"/>
+     </compile>
+   </ajc-test>
+   
+   <ajc-test dir="bugs165/pr275032" title="itd default ctor - 4">
+     <compile files="A.java" options="-outjar foo.jar"/>
+     <compile files="X.java" options="-1.5" inpath="foo.jar">
+     </compile>
+     <run class="A">
+       <stdout>
+         <line text="itd ctor"/>
+       </stdout>
+     </run>
+   </ajc-test>
+   
    <ajc-test dir="bugs165/pr272233" title="funky pointcut">
      <compile files="Iffy.java" options="-1.5">
        <message kind="warning" text="void is not a generic type"/>