爲什麼這個通用的接口實現不兼容?爲什麼這個通用的接口實現不兼容?
//The type Client<T> must implement the inherited abstract method IClient.compareTo(IClient)
class Client<T> implements IClient {
//The method compareTo(IClient<T>) of type Client<T> must override or implement a supertype method
//The Eclipse quick fix creates exactly the same supertype method which is defined in the interface.
@Override
public int compareTo(IClient<T> o) {
return this.getClass().getName().compareTo(o.getClass().getName());
}
}
interface IClient<T> extends Comparable<IClient<T>> {
@Override
int compareTo(IClient<T> o);
}
這就是@ysdx所說的。 – 2011-03-08 09:02:24
@精英紳士:oliholz在ysdx之前發佈了他的回答。 – 2011-03-08 09:11:03
@Joachim Sauer:對不起,從來沒有見過時間... – 2011-03-08 09:19:45