简体   繁体   English

如何解决名称冲突有相同的擦除?

[英]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.

相关问题 由于相同的擦除而命名冲突 - Name clash because of same erasure Java名称冲突,具有相同的擦除方式,但两者都不隐藏 - Java name clash, have the same erasure, neither hides the other Java泛型名称冲突,具有相同的擦除 - Java generics name clash , has the same erasure 实现Comparable,compareTo名称冲突:“具有相同的擦除,但不会覆盖其他” - Implementing Comparable, compareTo name clash: “have the same erasure, yet neither overrides the other” 名称冲突 - 具有相同的擦除但在方法参数generic中不会覆盖另一个 - Name clash - have the same erasure yet neither overrides the other in method parameter generic 名称冲突,覆盖失败,在实现具有相同擦除的两个接口的类上 - Name Clash, override fail, on a class implementing two interfaces with same erasure Java名称冲突错误,一种方法与另一种方法具有相同的擦除 - Java name clash error, a method has the same erasure as another method SkuDetailsResponseListener() 中的“两种方法都具有相同的擦除功能,但都不会覆盖另一个”方法冲突错误 - 'Both methods have same erasure, yet neither overides the other' method clash error in SkuDetailsResponseListener() 界面和一个类。名称冲突:相同的擦除,但都不会覆盖其他 - interface and a class. name clash: same erasure, yet neither overrides other 类型分区器的getPartition的名称冲突在MapReduce,Hadoop中具有与类型主类相同的擦除 - Name clash of getPartition of type Partitioner has the same erasure of type main class in MapReduce, Hadoop
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM