背景:我们遇到的主要问题是在 Redhat linux Santiago 6 中运行的 Eclipse Helios 崩溃并且有时没有响应。我们无法找出根本原因,并尝试了我从不同网站(包括 stackoverflow)读到的不同解决方案。
到目前为止我所做的:所以我决定下载 Eclipse Luna 并从 Eclipse Helios 导入现有项目,并将 eclipse luna 中安装的 jre 更改为 WLS 1.8 中内置的 jrockit(因为我们使用的是遗留框架)
问题:导入现有项目后,eclipse luna 出现问题。
Duplicate methods named put with the parameters (K, V) and (Object, Object) are inherited from the types HashMap and AbstractMap
The method put(Object, Object) is ambiguous for the type
但是在 eclipse helios 中没有遇到此错误。
我还下载了 eclipse Juno、Kepler,但问题与 luna 相同。
问题:是否有解决方法,或者如何在 eclipse luna 中关闭并忽略此错误?
编辑:根据要求示例代码
这是有错误的类之一。
public class DummyMessageMap extends HashMap implements MessageMap {
// implementation of the interface but returns null values.
}
public interface MessageMap extends Map{
public Message getMessage(String key);
public String getLanguage();
}
最佳答案
这里的问题是接口(interface)java.util.Map
通过两条路径到达您的类DummyMessageMap
,即DummyMessageMap extends HashMap extends AbstractMap Implements Map
和DummyMessageMap Implements MessageMap extends Map
。在第二条路径中,如错误所示,泛型类型 K
和 V
在代码中被指定为 object
和 object
。这是一种称为多路径层次结构的设计味道,除了消除这种路径冲突之外别无他法。如果可能,请尝试从 MessageMap
中删除 extends Map
。
关于java - Eclipse luna 重复方法名称,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/34347442/