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);

}

}

[1247 byte] By [hans_bladerDeega] at [2007-11-27 11:54:18]
# 1

What? I don't get any compiler errors.

Kaj

kajbja at 2007-7-29 18:55:09 > top of Java-index,Java Essentials,Java Programming...
# 2

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.

JoachimSauera at 2007-7-29 18:55:09 > top of Java-index,Java Essentials,Java Programming...
# 3

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

hans_bladerDeega at 2007-7-29 18:55:09 > top of Java-index,Java Essentials,Java Programming...