Community
Participate
Working Groups
Top of BETA_JAVA7 branch: class C {} interface I {} public class X<T extends C & I> { X() {} X f = new X<>(); } This code doesn't compile with eclipse, JDK7b138 compiles it OK.
I'll follow up.
Problem stems from eclipse's underlying failure to compile this code: class C {} interface I {} public class X<T extends C & I> { static <U extends C & I> X<U> getX() { return null; } X f2 = getX(); } See that javac 5 & 6 reject this code as well with: X.java:8: type parameters of <U>X<U> cannot be determined; no unique maximal ins tance exists for type variable U with upper bounds C,I X f2 = getX(); ^ 7b138 compiles it alright. Under investigation.\
Released disabled junit via org.eclipse.jdt.core.tests.compiler.regression.GenericsRegressionTest_1_7._test0030()
See also that eclipse fails to compile the following: class C {} interface I {} public class X<T extends C & I> { static <U extends C & I> X<U> getX() { return null; } X<?> f2 = getX(); } while javac 5,6,7 all compile it alright.
Same as bug 341795 *** This bug has been marked as a duplicate of bug 341795 ***
Verified using Java 7 feature patch.