From: aclement Date: Sat, 6 Dec 2008 05:12:23 +0000 (+0000) Subject: 257754: decp anno: test and fix X-Git-Tag: V1_6_3rc1~46 X-Git-Url: https://source.dussan.org/?a=commitdiff_plain;h=baf669ff24513592a4e553e7aa6f629e42ec54db;p=aspectj.git 257754: decp anno: test and fix --- diff --git a/tests/bugs163/pr257754/DefaultFoo.java b/tests/bugs163/pr257754/DefaultFoo.java new file mode 100644 index 000000000..b0aaf41d5 --- /dev/null +++ b/tests/bugs163/pr257754/DefaultFoo.java @@ -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 index 000000000..466ba55d5 --- /dev/null +++ b/tests/bugs163/pr257754/Foo.java @@ -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 index 000000000..1da2bd117 --- /dev/null +++ b/tests/bugs163/pr257754/Main.java @@ -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 index 000000000..4f40a5bf7 --- /dev/null +++ b/tests/bugs163/pr257754/Main2.java @@ -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; +} +