Name clash when attempting to override a method in a paramaterized class
The following code gives me a name clash, I do not understand why this happens, anyone care to explain?
import java.util.Comparator;
import java.util.Map;
import java.util.Map.Entry;
publicclass Test<K,V>{
publicvoid sort(Comparator<Entry<?extends K, ?extends V>> comparator){
}
}
class Test2<K, V>extends Test<K, V>{
@Override
publicvoid sort(Comparator<Entry<?extends K, ?extends V>> comparator){
super.sort(comparator);
}
}
This code compiles just fine both with javac and the Eclipse compiler. But just recently I've run accross similar code, that confused an older version of javac (1.5.0_06 vs. 1.5.0_11 IIRC).
So check, if you've got a recent version of the JDK installed.
i think it it a version problem, thanks
the error i get is:
Name clash: The method sort(Comparator<Map.Entry><? extends K,? extends V>>) of
type Test2<K,V> has the same erasure as sort(Comparator<Map.Entry><? extends
K,? extends V>>) of type Test<K,V> but does not override it
Message was edited by:
hans_bladerDeeg