Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.
Bug 346026 - [1.7][compiler] Eclipse fails to compile diamond usage
Summary: [1.7][compiler] Eclipse fails to compile diamond usage
Status: VERIFIED DUPLICATE of bug 341795
Alias: None
Product: JDT
Classification: Eclipse Project
Component: Core (show other bugs)
Version: 3.7   Edit
Hardware: PC Windows XP
: P3 normal (vote)
Target Milestone: 3.7.1   Edit
Assignee: Srikanth Sankaran CLA
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2011-05-16 23:46 EDT by Srikanth Sankaran CLA
Modified: 2011-08-05 02:54 EDT (History)
4 users (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Srikanth Sankaran CLA 2011-05-16 23:46:53 EDT
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.
Comment 1 Srikanth Sankaran CLA 2011-05-16 23:47:30 EDT
I'll follow up.
Comment 2 Srikanth Sankaran CLA 2011-05-17 00:08:37 EDT
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.\
Comment 3 Srikanth Sankaran CLA 2011-05-17 01:14:49 EDT
Released disabled junit via org.eclipse.jdt.core.tests.compiler.regression.GenericsRegressionTest_1_7._test0030()
Comment 4 Srikanth Sankaran CLA 2011-05-17 05:21:26 EDT
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.
Comment 5 Srikanth Sankaran CLA 2011-05-24 18:58:46 EDT
Same as bug 341795

*** This bug has been marked as a duplicate of bug 341795 ***
Comment 6 Satyam Kandula CLA 2011-06-29 03:17:14 EDT
Verified using Java 7 feature patch.