]> source.dussan.org Git - aspectj.git/commitdiff
testcode for 147701: @DeclareParents
authoraclement <aclement>
Tue, 20 Jun 2006 07:18:02 +0000 (07:18 +0000)
committeraclement <aclement>
Tue, 20 Jun 2006 07:18:02 +0000 (07:18 +0000)
tests/bugs152/pr147701/TestBean.java [new file with mode: 0644]
tests/bugs152/pr147701/TestBean2.java [new file with mode: 0644]
tests/bugs152/pr147701/TestBean3.java [new file with mode: 0644]

diff --git a/tests/bugs152/pr147701/TestBean.java b/tests/bugs152/pr147701/TestBean.java
new file mode 100644 (file)
index 0000000..e22f092
--- /dev/null
@@ -0,0 +1,26 @@
+// simple version - we go bang if Impl doesnt implement I...
+
+package a.b.c;
+
+import org.aspectj.lang.annotation.*;
+
+interface I { public void m(); }
+
+class Impl implements I {
+  public Impl() {}
+  public void m() {}
+}
+
+@Aspect
+class TestBeanAdvice {
+  @DeclareParents(value="a.b.c.TestBean", defaultImpl=a.b.c.Impl.class)
+  private I implementationInterface;
+}
+
+public class TestBean {
+  public static void main(String []argv) throws Exception {
+    ((I)new TestBean()).m();
+  }
+}
+
+class BeansException extends Exception {}
diff --git a/tests/bugs152/pr147701/TestBean2.java b/tests/bugs152/pr147701/TestBean2.java
new file mode 100644 (file)
index 0000000..229de4a
--- /dev/null
@@ -0,0 +1,24 @@
+package a.b.c;
+
+import org.aspectj.lang.annotation.*;
+
+interface I { public void m() throws BeansException; }
+
+class Impl implements I {
+  public Impl() {}
+  public void m() throws BeansException { }
+}
+
+@Aspect
+class TestBeanAdvice {
+  @DeclareParents(value="a.b.c.TestBean2", defaultImpl=a.b.c.Impl.class)
+  private I implementationInterface;
+}
+
+public class TestBean2 {
+  public static void main(String []argv) throws Exception {
+    ((I)new TestBean2()).m();
+  }
+}
+
+class BeansException extends Exception {}
diff --git a/tests/bugs152/pr147701/TestBean3.java b/tests/bugs152/pr147701/TestBean3.java
new file mode 100644 (file)
index 0000000..ad5fe1d
--- /dev/null
@@ -0,0 +1,26 @@
+// simple version - we go bang if Impl doesnt implement I...
+
+package a.b.c;
+
+import org.aspectj.lang.annotation.*;
+
+interface I { public void m(); }
+
+class Impl { // error!!!  implements I {
+  public Impl() {}
+  public void m() {}
+}
+
+@Aspect
+class TestBeanAdvice {
+  @DeclareParents(value="a.b.c.TestBean3", defaultImpl=a.b.c.Impl.class)
+  private I implementationInterface;
+}
+
+public class TestBean3 {
+  public static void main(String []argv) throws Exception {
+    ((I)new TestBean3()).m();
+  }
+}
+
+class BeansException extends Exception {}