From baf669ff24513592a4e553e7aa6f629e42ec54db Mon Sep 17 00:00:00 2001 From: aclement Date: Sat, 6 Dec 2008 05:12:23 +0000 Subject: [PATCH] 257754: decp anno: test and fix --- tests/bugs163/pr257754/DefaultFoo.java | 13 +++++++++ tests/bugs163/pr257754/Foo.java | 6 ++++ tests/bugs163/pr257754/Main.java | 38 ++++++++++++++++++++++++++ tests/bugs163/pr257754/Main2.java | 26 ++++++++++++++++++ 4 files changed, 83 insertions(+) create mode 100644 tests/bugs163/pr257754/DefaultFoo.java create mode 100644 tests/bugs163/pr257754/Foo.java create mode 100644 tests/bugs163/pr257754/Main.java create mode 100644 tests/bugs163/pr257754/Main2.java 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; +} + -- 2.39.5