summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authoraclement <aclement>2009-05-05 23:40:59 +0000
committeraclement <aclement>2009-05-05 23:40:59 +0000
commit262cb6dd7fa047f97b9c76e7425964ae542b147c (patch)
tree4a10009ded5ecffa8120cd3bb323699d182ab80d
parentf9578daa1e5153f241aee8b640d58351db26241f (diff)
downloadaspectj-262cb6dd7fa047f97b9c76e7425964ae542b147c.tar.gz
aspectj-262cb6dd7fa047f97b9c76e7425964ae542b147c.zip
275032: test and fix: itd of no-arg constructor should overwrite a generated default constructor
-rw-r--r--tests/bugs165/pr275032/A.java7
-rw-r--r--tests/bugs165/pr275032/X.java6
-rw-r--r--tests/bugs165/pr275032/c2/A.java9
-rw-r--r--tests/bugs165/pr275032/c2/X.java4
-rw-r--r--tests/src/org/aspectj/systemtest/ajc165/Ajc165Tests.java22
-rw-r--r--tests/src/org/aspectj/systemtest/ajc165/ajc165.xml33
6 files changed, 80 insertions, 1 deletions
diff --git a/tests/bugs165/pr275032/A.java b/tests/bugs165/pr275032/A.java
new file mode 100644
index 000000000..3b2db0089
--- /dev/null
+++ b/tests/bugs165/pr275032/A.java
@@ -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
index 000000000..5556cf042
--- /dev/null
+++ b/tests/bugs165/pr275032/X.java
@@ -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
index 000000000..8f7645bec
--- /dev/null
+++ b/tests/bugs165/pr275032/c2/A.java
@@ -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
index 000000000..0c560d6c0
--- /dev/null
+++ b/tests/bugs165/pr275032/c2/X.java
@@ -0,0 +1,4 @@
+aspect X {
+ public A.new() {System.out.println("itd");}
+
+}
diff --git a/tests/src/org/aspectj/systemtest/ajc165/Ajc165Tests.java b/tests/src/org/aspectj/systemtest/ajc165/Ajc165Tests.java
index dcb857f8d..ec98633a2 100644
--- a/tests/src/org/aspectj/systemtest/ajc165/Ajc165Tests.java
+++ b/tests/src/org/aspectj/systemtest/ajc165/Ajc165Tests.java
@@ -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() {
diff --git a/tests/src/org/aspectj/systemtest/ajc165/ajc165.xml b/tests/src/org/aspectj/systemtest/ajc165/ajc165.xml
index c15e75830..169b85755 100644
--- a/tests/src/org/aspectj/systemtest/ajc165/ajc165.xml
+++ b/tests/src/org/aspectj/systemtest/ajc165/ajc165.xml
@@ -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"/>