Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.

Bug 317762

Summary: Some classes fail to compile in Helios that compile under Sun javac
Product: [Eclipse Project] JDT Reporter: Dan Fabulich <dan>
Component: CoreAssignee: Srikanth Sankaran <srikanth_sankaran>
Status: VERIFIED DUPLICATE QA Contact:
Severity: major    
Priority: P3 CC: amj87.iitr, Olivier_Thomann, satyam.kandula, srikanth_sankaran
Version: 3.7   
Target Milestone: 3.7.1   
Hardware: PC   
OS: Mac OS X - Carbon (unsup.)   
Whiteboard:

Description Dan Fabulich CLA 2010-06-23 22:04:43 EDT
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.
Comment 1 Dan Fabulich CLA 2010-06-23 22:05:39 EDT
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.
Comment 2 Srikanth Sankaran CLA 2010-06-24 02:33:51 EDT
(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 ***
Comment 3 Ayushman Jain CLA 2010-08-03 09:06:12 EDT
Verified for 3.7M1.
Comment 4 Srikanth Sankaran CLA 2011-08-09 10:13:01 EDT
junit has been added as a part of the fix for bug 317719
Comment 5 Satyam Kandula CLA 2011-08-25 08:53:49 EDT
Verified for 3.7.1 using build M20110824-0800
Comment 6 Olivier Thomann CLA 2011-09-14 11:25:07 EDT
Verified for 3.8M2.