summaryrefslogtreecommitdiffstats
path: root/tests/java5/generics
diff options
context:
space:
mode:
authoraclement <aclement>2005-08-23 12:56:16 +0000
committeraclement <aclement>2005-08-23 12:56:16 +0000
commit4aacf20ad0fd3f3782fe1ff936aa13f666431beb (patch)
tree8e950e2e59c24fe629cc3587ffb476e8c3d58d07 /tests/java5/generics
parentbc187a6e0fe8b714c07c2f87be15203e55f1a744 (diff)
downloadaspectj-4aacf20ad0fd3f3782fe1ff936aa13f666431beb.tar.gz
aspectj-4aacf20ad0fd3f3782fe1ff936aa13f666431beb.zip
@override with ITDs - testcases.
Diffstat (limited to 'tests/java5/generics')
-rw-r--r--tests/java5/generics/itds/AtOverride.aj27
-rw-r--r--tests/java5/generics/itds/AtOverride1.aj13
-rw-r--r--tests/java5/generics/itds/AtOverride2.aj15
-rw-r--r--tests/java5/generics/itds/AtOverride3.aj20
-rw-r--r--tests/java5/generics/itds/AtOverride4.aj17
-rw-r--r--tests/java5/generics/itds/AtOverride5.aj13
-rw-r--r--tests/java5/generics/itds/AtOverride6.aj28
7 files changed, 133 insertions, 0 deletions
diff --git a/tests/java5/generics/itds/AtOverride.aj b/tests/java5/generics/itds/AtOverride.aj
new file mode 100644
index 000000000..9571b2218
--- /dev/null
+++ b/tests/java5/generics/itds/AtOverride.aj
@@ -0,0 +1,27 @@
+// should give *no* errors....
+class Parent {
+ // declared in Parent, overridden in Child
+ public void parent_child() {} // AAA
+
+ // declared in Parent, overridden in Injector
+ public void parent_injector() {} // BBB
+}
+
+class Child extends Parent {
+ // works
+ @Override public void parent_child() {} // AAA
+
+ // must override a superclass method
+ @Override public void injector_child() {} // CCC
+}
+
+aspect Injector {
+ public void Parent.injector_child() {} // CCC
+ public void Parent.injector_injector() {} // DDD
+
+ // must override a superclass method
+ @Override public void Child.parent_injector() {} // BBB
+
+ // must override a superclass method
+ @Override public void Child.injector_injector() {} // DDD
+}
diff --git a/tests/java5/generics/itds/AtOverride1.aj b/tests/java5/generics/itds/AtOverride1.aj
new file mode 100644
index 000000000..519d79697
--- /dev/null
+++ b/tests/java5/generics/itds/AtOverride1.aj
@@ -0,0 +1,13 @@
+// 1. child specifies override but there was no parent (error)
+
+class Parent {
+
+}
+
+class Child extends Parent {
+
+ @Override public void method() {} // ERROR, doesnt override anything
+
+}
+
+aspect Injector { }
diff --git a/tests/java5/generics/itds/AtOverride2.aj b/tests/java5/generics/itds/AtOverride2.aj
new file mode 100644
index 000000000..0a38f98c4
--- /dev/null
+++ b/tests/java5/generics/itds/AtOverride2.aj
@@ -0,0 +1,15 @@
+// 2. child specifies override and there was a parent (no error)
+
+class Parent {
+ public void method() {}
+ public Object method2() {return null;}
+}
+
+class Child extends Parent {
+
+ @Override public void method() {} // OK
+ @Override public String method2() {return null;} // OK, covariance at work
+
+}
+
+aspect Injector { }
diff --git a/tests/java5/generics/itds/AtOverride3.aj b/tests/java5/generics/itds/AtOverride3.aj
new file mode 100644
index 000000000..be358f5e2
--- /dev/null
+++ b/tests/java5/generics/itds/AtOverride3.aj
@@ -0,0 +1,20 @@
+// 3. child specifies override and parent was placed via ITD (no error)
+
+
+class Parent {
+}
+
+class Child extends Parent {
+
+ @Override public void method() {} // OK
+ @Override public String method2() {return null;} // OK, covariance at work
+
+}
+
+aspect Injector {
+
+ public void Parent.method() {}
+
+ public Object Parent.method2() {return null;}
+
+}
diff --git a/tests/java5/generics/itds/AtOverride4.aj b/tests/java5/generics/itds/AtOverride4.aj
new file mode 100644
index 000000000..123125d94
--- /dev/null
+++ b/tests/java5/generics/itds/AtOverride4.aj
@@ -0,0 +1,17 @@
+// 4. parent and child placed by ITD, @override on child (no error)
+
+class Parent {
+}
+
+class Child extends Parent {
+}
+
+aspect Injector {
+
+ public void Parent.method() {}
+ @Override public void Child.method() {} // OK, parent ITD'd
+
+ public Object Parent.method2() {return null;}
+ @Override public String Child.method2() {return null;} // OK, parent ITD'd, covariance
+
+}
diff --git a/tests/java5/generics/itds/AtOverride5.aj b/tests/java5/generics/itds/AtOverride5.aj
new file mode 100644
index 000000000..aa9304772
--- /dev/null
+++ b/tests/java5/generics/itds/AtOverride5.aj
@@ -0,0 +1,13 @@
+// 5. child placed by ITD, @override on child, no parent (error)
+
+class Parent {
+}
+
+class Child extends Parent {
+}
+
+aspect Injector {
+
+ @Override public void Child.method() {} // ERROR, no parent
+
+}
diff --git a/tests/java5/generics/itds/AtOverride6.aj b/tests/java5/generics/itds/AtOverride6.aj
new file mode 100644
index 000000000..4f8deb0e0
--- /dev/null
+++ b/tests/java5/generics/itds/AtOverride6.aj
@@ -0,0 +1,28 @@
+import java.util.*;
+
+class Parent {
+
+ Object method1() {return null;}
+ void method2(String a) {}
+ void method3(List l,String b) {}
+
+}
+
+class Child extends Parent {
+
+ @Override String method1() {return null;}
+ @Override void method2(String b) {}
+ @Override void method3(List l,String b) {}
+
+}
+
+class Child2 extends Parent {
+}
+
+aspect Injector {
+
+ @Override public String Child2.method1() {return null;}
+ @Override public void Child2.method2(String s) {}
+ @Override public void Child2.method3(List l,String b) {}
+
+}