Bug 320514 - Eclipse fails with "Method .. has the same erasure as another method", but javac does not
Summary: Eclipse fails with "Method .. has the same erasure as another method", but ja...
Status: VERIFIED DUPLICATE of bug 317719
Alias: None
Product: JDT
Classification: Eclipse Project
Component: Core (show other bugs)
Version: 3.6   Edit
Hardware: All All
: P3 major (vote)
Target Milestone: 3.7.1   Edit
Assignee: Srikanth Sankaran CLA
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2010-07-21 10:25 EDT by Peter Arrenbrecht CLA
Modified: 2011-09-14 02:22 EDT (History)
3 users (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Peter Arrenbrecht CLA 2010-07-21 10:25:48 EDT
Build Identifier: I20100608-0911

Compile class with two methods with params List<X> and List<Y> respectively, and distinct return types. This works with javac (1.6.0_21), but Eclipse complains. If I change the return type to be the same, then javac complains too (as now the erased method signatures really are identical).

Reproducible: Always

Steps to Reproduce:
Compile this class in Eclipse:

import java.util.ArrayList;
import java.util.List;

public class EclipseBugDemo {
    public static boolean foo(List<String> x) {return true;}
    public static int foo(List<Integer> x) {return 1;}
}
Comment 1 Olivier Thomann CLA 2010-07-21 10:30:53 EDT
Another duplicate of bug 289247?
Comment 2 Srikanth Sankaran CLA 2010-07-21 10:35:26 EDT
Brought about by the changes made in bug# 289247 ; Closing as a
duplicate of bug# 317719

The sample code fails to compile with JDK7:


C:\jtests>C:\jdk-7-ea-bin-b100-windows-i586-09_jul_2010\jdk7\bin\javac -Xlint:un
checked -Xlint:rawtypes -Xlint:deprecation -sourcepath c:\jtests EclipseBugDemo.
java
EclipseBugDemo.java:6: name clash: foo(List<Integer>) and foo(List<String>) have
 the same erasure
    public static int foo(List<Integer> x) {return 1;}
                      ^
1 error

*** This bug has been marked as a duplicate of bug 317719 ***
Comment 3 Ayushman Jain CLA 2010-08-03 09:06:38 EDT
Verified for 3.7M1
Comment 4 Srikanth Sankaran CLA 2011-08-09 10:13:02 EDT
junit has been added as a part of the fix for bug 317719
Comment 5 Satyam Kandula CLA 2011-08-25 09:01:59 EDT
Verified for 3.7.1 RC2 using build M20110824-0800
Comment 6 Satyam Kandula CLA 2011-09-14 02:22:04 EDT
Verified for 3.8M2 using build I20110912-0800