Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

gwt: How do I write a clone() method that doesn't result in "The method clone() is undefined for the type Object" error?

Tags:

clone

gwt

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

like image 285
Dave Avatar asked Oct 09 '22 02:10

Dave


1 Answers

Object.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

like image 153
Strelok Avatar answered Oct 14 '22 02:10

Strelok