为什么这个通用的接口实现不兼容?为什么这个通用的接口实现不兼容?
//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