Overloading methods and GWT-Exporter

71 views
Skip to first unread message

David La Motta

unread,
Oct 18, 2012, 10:58:48 PM10/18/12
to gwtex...@googlegroups.com
Hi.

How does the GWT-Exporter deal with method overloading?  I've taken the approach of creating a new project, which extends the original GWT project, that will ultimately be exported using GWT-Exporter--following one of the suggestions in the documentation.

I am hitting, unfortunately, problems with methods that are overloaded, getting error messages such as:

[ERROR] Ambiguous method signature lienzo.client.core.Context2D::drawImage(Lcom/google/gwt/dom/client/Element;DDDDDDDD) would conflict in JS with another method

How exactly should I deal with overloaded methods?  Clearly, GWT is getting around this somehow (surely it is renaming things as it translates to JS), but when exporting situations like this cause problems.

Thanks in advance.

// David

Manuel Carrasco Moñino

unread,
Oct 19, 2012, 1:36:26 AM10/19/12
to gwtex...@googlegroups.com
yes, gwtexporter supports method overload. There could be edge cases wich could fail. Attach some simple code which fails so as we can see if its a bug.

- manolo
--
 
 

David La Motta

unread,
Oct 20, 2012, 11:03:49 AM10/20/12
to gwtex...@googlegroups.com
Hi Manolo, 

We have overloaded methods such as:

public Context2D drawImage(ImageJSO image, double sx, double sy, double sw, double sh, double x, double y, double w, double h)

and

public Context2D drawImage(Element image, double sx, double sy, double sw, double sh, double x, double y, double w, double h)


Where ImageJSO is a [public inner] class of ours that extends from JavaScriptObject, and Element is a GWT class, which also extends from JavaScriptObject.

Could that be causing trouble?

Thanks for the help.

// David

Manuel Carrasco Moñino

unread,
Oct 21, 2012, 3:47:50 AM10/21/12
to gwtex...@googlegroups.com

Thats the problem, you can not overload a method with the same number of arguments and same types in exporter. In js JavaScriptobjects have the same signature, since they are gwt overlay types which can be cast.

- Manolo

--
 
 

David La Motta

unread,
Oct 21, 2012, 9:47:50 AM10/21/12
to gwtex...@googlegroups.com
Thanks, Manolo.  @NoExport on some of the overloaded methods clears the ambiguity problem.

// David


--
 
 

Reply all
Reply to author
Forward
0 new messages