Community
Participate
Working Groups
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.
Created attachment 181914 [details] Sample Java class to reproduce
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 ***
Verified with I20101027-1800
Reverified for 3.7 RC0 using Build id: I20110428-0848
junit has been added as a part of the fix for bug 317719
Verified for 3.7.1 RC2 using build M20110824-0800
Verified for 3.8M2 using build id I20110912-0800