--- /dev/null
+interface Base<T> {
+ static interface Inner {
+ }
+}
+class Test<T extends Test.InnerTest> implements Base<T> {
+ static class InnerTest implements Inner {
+ }
+}
--- /dev/null
+interface I<T>{ }
+
+public class Basic{
+
+ public static void main(String[]argv) {
+ Basic b = new Basic();
+ if (b instanceof I) throw new RuntimeException("Should implement I??");
+ }
+}
+
+aspect X{
+ declare parents: Basic implements I<String>;
+}
--- /dev/null
+// error, can't implement two variants of a generic type
+interface I<T>{ }
+
+public class Basic implements I<String> {
+
+ public static void main(String[]argv) {
+ }
+}
+
+aspect X{
+ declare parents: Basic implements I<Integer>; // error
+}
--- /dev/null
+public class A {
+ public static void main(String[] argv) {
+ Integer two = 2;
+ Integer four= 4;
+ System.err.println("min(2,4)=>"+ new Utils().min(two,four));
+ System.err.println("max(2,4)=>"+new Utils().max(two,four));
+ }
+}
+
+
+aspect X {
+ <T extends Number> T Utils.max(T first,T second) {
+ if (first>second) return first; else return second;
+ }
+}
+
+class Utils {
+ <T extends Number> T min(T first,T second) {
+ if (first.intValue()<second.intValue()) return first; else return second;
+ }
+}
--- /dev/null
+public class B {
+ public static void main(String[] argv) {
+ Integer two = 2;
+ Integer four= 4;
+ System.err.println("min(2,4)=>"+ Utils.min(two,four));
+ System.err.println("max(2,4)=>"+Utils.max(two,four));
+ }
+}
+
+
+aspect X {
+ static <T extends Number> T Utils.max(T first,T second) {
+ if (first>second) return first; else return second;
+ }
+}
+
+class Utils {
+ static <T extends Number> T min(T first,T second) {
+ if (first.intValue()<second.intValue()) return first; else return second;
+ }
+}
--- /dev/null
+// Using type parameter in ITD
+public abstract aspect C<T> {
+ private T Foo.data;
+
+ public T Foo.getData(T defaultValue) {
+ return (this.data!=null?data:defaultValue);
+ }
+}
--- /dev/null
+public abstract aspect D<T> {
+
+ private T Goo<T>.data;
+
+ public T Goo<T>.getData(T defaultValue) {
+ return (this.data != null ? data : defaultValue);
+ }
+
+}
+
+class Goo<P> {}
--- /dev/null
+// Simple non-static ITDM
+public class Parse1 { }
+
+aspect X {
+ <T> T Parse1.m(T) {}
+}
--- /dev/null
+// Simple static ITDM
+public class Parse2 { }
+
+aspect X {
+ static <T> T Parse2.m(T) {}
+}
--- /dev/null
+// Simple ITDC
+public class Parse1 { }
+
+aspect X {
+ <T> T Parse1.new(T) {}
+}
--- /dev/null
+import java.util.*;
+
+// Complex ITDM
+public class Parse1 { }
+
+aspect X {
+ <T> Parse1.sort(List<T> elements,Comparator<? super T> comparator) {}
+}
--- /dev/null
+// ITDs on generic types
+public class Parse5<T,S extends Number> {}
+
+aspect X {
+ String Parse5.m1() {}
+
+ String Parse5<Q,R extends Number>.m2() {}
+
+ String Parse5<T,V>.m3() {} // error
+
+ String Parse5<A,B extends Number,C>.m4() {} // error
+
+ String Parse5<A>.m5() {} // error
+
+ String Parse5<String,Integer>.m6() {} // error
+}