gwt:如何编写一个不会导致"方法clone()未定义类型Object"错误的clone()方法?

Dav*_*ave 5 gwt clone

我正在使用GWT 2.4.我有这个类,它覆盖了clone()方法......

public class Attribute implements Serializable, Cloneable {
    ...

public Object clone() {
    Object ret = null;
    try {
        ret = super.clone();
    } catch (CloneNotSupportedException e) {
    }   // try
    return ret;
}
Run Code Online (Sandbox Code Playgroud)

遗憾的是,当我尝试运行我的GWT测试类时,我得到了编译错误

[ERROR] Line 113: The method clone() is undefined for the type Object
Run Code Online (Sandbox Code Playgroud)

任何人都知道如何在保留功能的同时重写上述内容以避免编译错误?谢谢, - 戴夫

Str*_*lok 4

Object.cloneGWT 编译器不支持。如果您确实需要支持,可以按照此 GWT 问题中建议的解决方法进行操作:http://code.google.com/p/google-web-toolkit/issues/detail ?id=5068