--- /dev/null
+public class A {
+ int i = 5;
+
+ public static void main(String[] argv) {
+ new A();
+ }
+}
--- /dev/null
+import org.aspectj.lang.annotation.*;
+aspect X {
+ @SuppressAjWarnings
+ public A.new() {System.out.println("itd ctor");}
+
+}
--- /dev/null
+public class A {
+ public A() {
+ System.out.println("real default ctor");
+ }
+
+ public static void main(String[] argv) {
+ new A();
+ }
+}
--- /dev/null
+aspect X {
+ public A.new() {System.out.println("itd");}
+
+}
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");
}
public void testGenericITD_pr272825() {
runTest("generic ITD");
}
-
+
// ---
public static Test suite() {
<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"/>