Bug 328910 - [compiler]method "Name clash" errors are reported
Summary: [compiler]method "Name clash" errors are reported
Status: VERIFIED DUPLICATE of bug 317719
Alias: None
Product: JDT
Classification: Eclipse Project
Component: Core (show other bugs)
Version: 3.6.1   Edit
Hardware: All All
: P3 critical (vote)
Target Milestone: 3.7.1   Edit
Assignee: Ayushman Jain CLA
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2010-10-28 04:33 EDT by Christian Dupuis CLA
Modified: 2011-09-14 01:57 EDT (History)
4 users (show)

See Also:


Attachments
Sample Java class to reproduce (977 bytes, application/octet-stream)
2010-10-28 04:35 EDT, Christian Dupuis CLA
no flags Details

Note You need to log in before you can comment on or make changes to this bug.
Description Christian Dupuis CLA 2010-10-28 04:33:52 EDT
Build Identifier: 20100917-0705

The attached MappedLinkedCollection implementation does not compile within Eclipse. The following two errors are being reported:

Description	Resource	Path	Location	Type
Name clash: The method get(Key) of type MappedLinkedCollection<Key,Value> has the same erasure as get(Object) of type LinkedHashMap<K,V> but does not override it	MappedLinkedCollection.java	/test1/src/com/springsource	line 33	Java Problem
Name clash: The method put(Key, Value) of type MappedLinkedCollection<Key,Value> has the same erasure as put(K, V) of type HashMap<K,V> but does not override it	MappedLinkedCollection.java	/test1/src/com/springsource	line 24	Java Problem

Please note that the class compiles fine with javac and in previous versions of Eclipse (tried with Eclipse 3.5.2).

Reproducible: Always

Steps to Reproduce:
1. Import the attached class into a Java project
2. Open the Problems view and see two problems being reported.
Comment 1 Christian Dupuis CLA 2010-10-28 04:35:10 EDT
Created attachment 181914 [details]
Sample Java class to reproduce
Comment 2 Ayushman Jain CLA 2010-10-28 05:00:48 EDT
This was a bug in java 6 which has been fixed in java7. Eclipse's behaviour is correct and also consistent with java 7. 
See that the attached file gives the following error when compiled with javac 7 ver. b76

C:\Documents and Settings\Administrator\My Documents\Downloads\MappedLinkedColle
ction.java:24: name clash: put(Key,Value) in MappedLinkedCollection and put(K,V)
 in HashMap have the same erasure, yet neither overrides the other
    public Collection<Value> put(Key k, Value v) {
                             ^
  where Key,Value,K,V are type-variables:
    Key extends Object declared in class MappedLinkedCollection
    Value extends Object declared in class MappedLinkedCollection
    K extends Object declared in class HashMap
    V extends Object declared in class HashMap
C:\Documents and Settings\Administrator\My Documents\Downloads\MappedLinkedColle
ction.java:33: name clash: get(Key) in MappedLinkedCollection and get(Object) in
 LinkedHashMap have the same erasure, yet neither overrides the other
    public Collection<Value> get(Key k) {
                             ^
  where Key,Value,V are type-variables:
    Key extends Object declared in class MappedLinkedCollection
    Value extends Object declared in class MappedLinkedCollection
    V extends Object declared in class LinkedHashMap
2 errors

*** This bug has been marked as a duplicate of bug 317719 ***
Comment 3 Olivier Thomann CLA 2010-10-28 14:49:10 EDT
Verified with I20101027-1800
Comment 4 Srikanth Sankaran CLA 2011-05-03 01:59:54 EDT
Reverified for 3.7 RC0 using Build id: I20110428-0848
Comment 5 Srikanth Sankaran CLA 2011-08-09 10:13:04 EDT
junit has been added as a part of the fix for bug 317719
Comment 6 Satyam Kandula CLA 2011-08-25 09:15:24 EDT
Verified for 3.7.1 RC2 using build M20110824-0800
Comment 7 Srikanth Sankaran CLA 2011-09-14 01:57:39 EDT
Verified for 3.8M2 using build id  I20110912-0800