Community
Participate
Working Groups
Build Identifier: 20100617-1415 This test class compiles under javac, but doesn't compile in Eclipse Helios: import java.util.List; import java.util.Set; public class Test { public <T extends List> T foo() { return null; } public <T extends Set> T foo() { return null; } } $ javac -version javac 1.6.0_20 $ javac Test.java $ ls Test.class Test.class Reproducible: Always Steps to Reproduce: 1. Copy and paste the above source into a file called Test.java inside an Eclipse Java project.
Eclipse Helios generates the error: "Duplicate method foo() in type Test" Frankly, I think I agree with Helios here, but if it compiles in javac, it has to compile in Helios, too.
(In reply to comment #1) > Eclipse Helios generates the error: "Duplicate method foo() in type Test" > > Frankly, I think I agree with Helios here, but if it compiles in javac, it has > to compile in Helios, too. See that this fails to compile with javac 7 (b91): Test.java:6: name clash: <T#1>foo() and <T#2>foo() have the same erasure public <T extends Set> T foo() { return null; } ^ where T#1,T#2 are type-variables: T#1 extends Set declared in method <T#1>foo() T#2 extends List declared in method <T#2>foo() Test.java:5: warning: [rawtypes] found raw type: List public <T extends List> T foo() { return null; } ^ missing type parameters for generic class List<E> where E is a type-variable: E extends Object declared in interface List Test.java:6: warning: [rawtypes] found raw type: Set public <T extends Set> T foo() { return null; } ^ missing type parameters for generic class Set<E> where E is a type-variable: E extends Object declared in interface Set 1 error 2 warnings *** This bug has been marked as a duplicate of bug 317719 ***
Verified for 3.7M1.
junit has been added as a part of the fix for bug 317719
Verified for 3.7.1 using build M20110824-0800
Verified for 3.8M2.