[英]How to solve name clash have the same erasure?
I have this problem by this moment, I got a class with two methods with the same erasure:此刻我遇到了这个问题,我得到了一个具有两个相同擦除方法的类:
public class VO implements Map<String,String> , Serializable{
public synchronized String put (Object key, Object value){
if (key == null)
return null;
if (value == null)
return remove(key);
String stringKey = key.toString();
String stringValue = value.toString();
if (value instanceof Boolean)
stringValue = ((Boolean)value) ? "Y" : "N";
return put(stringKey,stringValue);
}
@Override
public synchronized String put (String key, String value)
{
if (key == null)
return null;
if (value == null)
return remove(key);
//
int index = m_keys.indexOf(key);
if (index != -1)
return m_values.set(index, value);
m_keys.add(key);
m_values.add(value);
return null;
} // put
}
Both methods are used by this app a lot, I can't change the name of any and I can't delete put(Object key, Object value)
method, any ideas how I can fix this?这个应用程序经常使用这两种方法,我无法更改任何名称,也无法删除
put(Object key, Object value)
方法,有什么想法可以解决这个问题吗?
@Aris_Kortex well firts of all, VO is used a LOT, to create the UImodel of this application and the constructor of VO is this: @Aris_Kortex 首先,VO 被大量使用,来创建这个应用程序的 UImodel,VO 的构造函数是这样的:
public VO (Map<String,String> map)
{
this();
Iterator<String> it = map.keySet().iterator();
while (it.hasNext())
{
Object key = it.next().toString();
Object value = map.get(key);
put (key, value);
}
} // VO
/** Base SerVersion */
private static final long serialVersionUID = 8683452581122892189L;
/** Keys */
private ArrayList<String> m_keys;
/** Values */
private ArrayList<String> m_values;
/** Embedded VOs */
protected ArrayList<VO> p_vos = null;
then i am affraid i can't measure the impact of changing something here...i need to create a package of this proyect that i refactoriced because before was a mess..but maven throw me that error...然后我害怕我无法衡量在这里更改某些内容的影响......我需要创建一个我重构的这个项目的包,因为之前是一团糟......但是maven向我抛出了那个错误......
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.