Add Object.clone as throwing implementation

102 views
Skip to first unread message

Rocco De Angelis

unread,
May 26, 2014, 5:37:07 AM5/26/14
to google-web-tool...@googlegroups.com
Hi all,

I would like to added a clone method to the java.lang.Object class in the GWT SDK which simply throws a CloneNotSupportedException.
This makes it possible to implement the clone method in subclasses.

Daniel Kurka has already done a similar patch but without an adaption of GenerateJavaScriptAST.java class.
My patch is already in the review system but still not approved.
Thomas Broyer started with the review and asked me why the patch of Daniel was reverted.   
I think that Daniel simply forgot the changes in the GenerateJavaScriptAST.java.
Some feedback would be nice :)

BR
Rocco




Daniel Kurka

unread,
May 26, 2014, 11:10:09 AM5/26/14
to google-web-tool...@googlegroups.com
I rolled the patch because it broke internal apps and it seemed to hard and not worthwhile to clean this up.
I just imported the change and running some tests internally I get back once I can see what needs to be done.


--
You received this message because you are subscribed to the Google Groups "GWT Contributors" group.
To unsubscribe from this group and stop receiving emails from it, send an email to google-web-toolkit-co...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/google-web-toolkit-contributors/b2d067e8-f9c1-4fca-ab10-911e966b09f1%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.



--
Google Germany GmbH
Dienerstr. 12
80331 München

Registergericht und -nummer: Hamburg, HRB 86891
Sitz der Gesellschaft: Hamburg
Geschäftsführer: Graham Law, Katherine Stephens

Patrick Tucker

unread,
May 26, 2014, 5:03:09 PM5/26/14
to google-web-tool...@googlegroups.com
I wish Java's Object didn't implement Cloneable, seems crazy to implement an interface that you don't actually implement.

Roberto Lublinerman

unread,
May 26, 2014, 11:30:43 PM5/26/14
to google-web-tool...@googlegroups.com
The problem with implementing clone() at object is that it is an breaking change because of the rules for JSOs. JSOs are required to implement (and declare final) all Object methods because there is no dynamic dispatch. So having clone() at Object implies either implementing it in JavaScriptObject (and declare it final there), breaking all projects that have JSOs that implement clone() or required all JSOs to implement clone() again breaking all projects that have JSOs.


Rocco De Angelis

unread,
May 27, 2014, 5:00:35 AM5/27/14
to google-web-tool...@googlegroups.com
Hi Roberto,

okay I understand the problem. But is it really necessary to also add the clone method to JSO?
Implementing a clone method for objects in javaScript can be very hard if it should work in all cases :)

Rocco De Angelis

unread,
Jun 17, 2014, 7:28:33 AM6/17/14
to google-web-tool...@googlegroups.com
Some news regarding the your tests? 


Am Montag, 26. Mai 2014 17:10:09 UTC+2 schrieb Daniel Kurka:
I rolled the patch because it broke internal apps and it seemed to hard and not worthwhile to clean this up.
I just imported the change and running some tests internally I get back once I can see what needs to be done.
On Mon, May 26, 2014 at 11:37 AM, Rocco De Angelis <rdeang...@gmail.com> wrote:
Hi all,

I would like to added a clone method to the java.lang.Object class in the GWT SDK which simply throws a CloneNotSupportedException.
This makes it possible to implement the clone method in subclasses.

Daniel Kurka has already done a similar patch but without an adaption of GenerateJavaScriptAST.java class.
My patch is already in the review system but still not approved.
Thomas Broyer started with the review and asked me why the patch of Daniel was reverted.   
I think that Daniel simply forgot the changes in the GenerateJavaScriptAST.java.
Some feedback would be nice :)

BR
Rocco




--
You received this message because you are subscribed to the Google Groups "GWT Contributors" group.
To unsubscribe from this group and stop receiving emails from it, send an email to google-web-toolkit-contributors+unsubscribe@googlegroups.com.
Reply all
Reply to author
Forward
0 new messages