]> source.dussan.org Git - aspectj.git/commitdiff
257754: decp anno: test and fix
authoraclement <aclement>
Sat, 6 Dec 2008 05:12:23 +0000 (05:12 +0000)
committeraclement <aclement>
Sat, 6 Dec 2008 05:12:23 +0000 (05:12 +0000)
tests/bugs163/pr257754/DefaultFoo.java [new file with mode: 0644]
tests/bugs163/pr257754/Foo.java [new file with mode: 0644]
tests/bugs163/pr257754/Main.java [new file with mode: 0644]
tests/bugs163/pr257754/Main2.java [new file with mode: 0644]

diff --git a/tests/bugs163/pr257754/DefaultFoo.java b/tests/bugs163/pr257754/DefaultFoo.java
new file mode 100644 (file)
index 0000000..b0aaf41
--- /dev/null
@@ -0,0 +1,13 @@
+package impl;
+
+import org.aspectj.lang.annotation.Aspect;
+import org.aspectj.lang.annotation.DeclareParents;
+
+public class DefaultFoo implements Foo {
+//    Uncommenting the following fixes the error    
+    DefaultFoo() {
+    }
+    public void doFoo() {
+        System.out.println("In doFoo " + this.getClass());
+    }
+}
diff --git a/tests/bugs163/pr257754/Foo.java b/tests/bugs163/pr257754/Foo.java
new file mode 100644 (file)
index 0000000..466ba55
--- /dev/null
@@ -0,0 +1,6 @@
+package impl;
+
+public interface Foo {
+    public void doFoo();
+}
+
diff --git a/tests/bugs163/pr257754/Main.java b/tests/bugs163/pr257754/Main.java
new file mode 100644 (file)
index 0000000..1da2bd1
--- /dev/null
@@ -0,0 +1,38 @@
+package example;
+
+import org.aspectj.lang.annotation.Aspect;
+import org.aspectj.lang.annotation.DeclareParents;
+
+public class Main {
+    public static void main(String[] args) {
+        Bar bar = new Bar();
+        ((Foo)bar).doFoo();
+       bar.doBar();
+    }
+}
+
+interface Foo {
+    public void doFoo();
+}
+
+class DefaultFoo implements Foo {
+//    Uncommenting the following fixes the error    
+//    public DefaultFoo() {
+//    }
+    public void doFoo() {
+        System.out.println("In doFoo " + this.getClass());
+    }
+}
+
+class Bar {
+    public void doBar() {
+        System.out.println("Bar");
+    }
+}
+
+@Aspect
+class Introduce {
+    @DeclareParents(value="example.Bar", defaultImpl=DefaultFoo.class)
+    private Foo mixin;
+}
+
diff --git a/tests/bugs163/pr257754/Main2.java b/tests/bugs163/pr257754/Main2.java
new file mode 100644 (file)
index 0000000..4f40a5b
--- /dev/null
@@ -0,0 +1,26 @@
+package example;
+import impl.*;
+
+import org.aspectj.lang.annotation.Aspect;
+import org.aspectj.lang.annotation.DeclareParents;
+
+public class Main2 {
+    public static void main(String[] args) {
+        Bar bar = new Bar();
+        ((Foo)bar).doFoo();
+       bar.doBar();
+    }
+}
+
+class Bar {
+    public void doBar() {
+        System.out.println("Bar");
+    }
+}
+
+@Aspect
+class Introduce {
+    @DeclareParents(value="example.Bar", defaultImpl=impl.DefaultFoo.class)
+    private Foo mixin;
+}
+