/* * Compilers tested: * * ECJ { 3.4.1, 3.5 } * Javac { 1.6.0_16 } * * Javac compiles everything, but 3.4.1 and 3.5 fail differently. */ class GenericsTests { interface I {} interface G { G get(); } interface A> { T get(); } interface Test1 { /* * All compilers allow this code. */ interface B & G> extends G { B get(); } /* * Only 3.5 rejects this, if Q and A are transposed. */ interface C & A> extends G { C get(); } } interface Test2 { interface S { void set(T t); } interface SS extends S> { void set(S s); } interface SI extends SS { void set(S s); } interface GS extends G, SI { GS get(); } interface F> { T get(); } /* * Compiles with 3.4.1 and javac, but not 3.5. */ class B & F> implements GS { T t; F f; B(T r) { f = t = r; } public B get() { return new B(f.get()); } public void set(S s) { t.set(s); t.set(null); } } /* * Only javac compiles this class. */ class C & GS> implements GS { T t; F f; C(T r) { f = t = r; } public C get() { return new C(f.get()); } public void set(S s) { t.set(s); t.set(null); } } } }