aboutsummaryrefslogtreecommitdiffstats
path: root/tests/new
diff options
context:
space:
mode:
authoracolyer <acolyer>2003-03-27 17:01:11 +0000
committeracolyer <acolyer>2003-03-27 17:01:11 +0000
commit517d030a531bd6397c5f76ae3e190fe52175360d (patch)
treef4a08cc7006e64c87ff94536a03c9a1e790128c7 /tests/new
parent989aaf7855fdb2e4f176d6e7b32a3bd0131ee515 (diff)
downloadaspectj-517d030a531bd6397c5f76ae3e190fe52175360d.tar.gz
aspectj-517d030a531bd6397c5f76ae3e190fe52175360d.zip
Test cases for declare parent scenarios
Diffstat (limited to 'tests/new')
-rw-r--r--tests/new/declareParents/Driver.java33
-rw-r--r--tests/new/declareParents/IllegalAdoption.java16
2 files changed, 49 insertions, 0 deletions
diff --git a/tests/new/declareParents/Driver.java b/tests/new/declareParents/Driver.java
new file mode 100644
index 000000000..ec70d26a1
--- /dev/null
+++ b/tests/new/declareParents/Driver.java
@@ -0,0 +1,33 @@
+import org.aspectj.testing.Tester;
+
+public class Driver {
+ public static void main(String[] args) { test(); }
+
+ public static void test() {
+
+ C c = new C();
+ D d = new D();
+ E e = new E();
+
+ Tester.check( c instanceof A, "C should extend A");
+ Tester.check( c instanceof B, "Declare parents threw away superclass info: C should extend B");
+
+ Tester.check( d instanceof A, "D should extend A");
+ Tester.check( e instanceof A, "E should extend A");
+
+ }
+
+
+ static class A {};
+ static class B extends A {};
+ static class C extends B {};
+
+ static class D {};
+ static class E extends D {};
+
+ static aspect Adoption {
+ declare parents : C extends A;
+ declare parents : D extends A;
+ };
+}
+
diff --git a/tests/new/declareParents/IllegalAdoption.java b/tests/new/declareParents/IllegalAdoption.java
new file mode 100644
index 000000000..3df00a8e1
--- /dev/null
+++ b/tests/new/declareParents/IllegalAdoption.java
@@ -0,0 +1,16 @@
+import org.aspectj.testing.Tester;
+
+public class IllegalAdoption {
+
+ static class A {};
+ static class B extends A {};
+ static class C extends B {};
+
+ static class D {};
+ static class E extends D {};
+
+ static aspect Adoption {
+ declare parents : E extends C; // should cause a compilation error
+ }
+}
+