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;
}
可悲的是,当我尝试运行我的GWT测试类时,我收到编译错误
[ERROR] Line 113: The method clone() is undefined for the type Object
有人知道如何重写上面的内容以避免编译错误,同时保留功能吗?谢谢,-戴夫
I'm using GWT 2.4. I have this class, which overrides the clone() method ...
public class Attribute implements Serializable, Cloneable {
...
public Object clone() {
Object ret = null;
try {
ret = super.clone();
} catch (CloneNotSupportedException e) {
} // try
return ret;
}
Sadly, when I try and run my GWT test class, I get the compilation error
[ERROR] Line 113: The method clone() is undefined for the type Object
Anyone know how I can rewrite the above to avoid the compile errors while preserving the functionality? Thanks, - Dave
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
GWT 编译器不支持
Object.clone
。如果您确实需要支持,可以按照此 GWT 问题中建议的解决方法进行操作:http://code.google.com/p/google-web-toolkit/issues/detail?id=5068Object.clone
is not supported by the GWT compiler. If you really need support for it you can follow a work around suggested in this GWT issue: http://code.google.com/p/google-web-toolkit/issues/detail?id=5068