Community
Participate
Working Groups
One of our developers upgraded from 3.1.0 to 3.1.1 and started complaining about syntax errors in some of our classes. They are valid, and compile fine with javac and Eclipse 3.1.0. Here is a simplified example: import java.util.Collection; import java.util.Collections; public class Example { public Collection<? extends Integer> getCollection() { return Collections.emptyList(); } } This fails to compile in Eclipse 3.1.1. The return statement is flagged "Type mismatch: cannot convert from List<Object> to Collection<? extends Integer>" which is incorrect, because the emptyList() function in Java 5's Collections class is designed to return a list of whatever type is required of it.
This is fixed in the 3.1 maintenance stream. You can use one of the latest maintenance stream to get the fix or you wait for the 3.1.2 release. Closing as a duplicate of bug 112500. Added regression test org.eclipse.jdt.core.tests.compiler.regression.GenericTypeTest.test871 *** This bug has been marked as a duplicate of 112500 ***
Verified in M20060109-0800 for 3.1.2