Eclipse 3.1 M4 关于Generics的Bug

类别:Java 点击:0 评论:0 推荐:

我使用 Eclipse 3.1M4 进行如下编码时:

class Test implements Iterator<Integer> {
public boolean hasNext() { return false; }   public Integer next() { return null; }   public void remove() {}
}

问题出现在 next() 方法,上面显示编译器警告:

Type safety: The return type Integer of the method next() of type Test needs unchecked conversion to conform to the return type E of inherited method

这是一个Eclipse的Bug

本文地址:http://com.8s8s.com/it/it11422.htm