Tuesday, December 16, 2014

Re: webidl, jsinterop and overloaded methods

rhmoller:
  You can see in this thread a discussion of method overloading, and the proposed support for next release of GWT.

El viernes, 12 de diciembre de 2014 19:00:15 UTC-3, rhmoller escribió:
Hi

I am toying around with generating Java interfaces annotated with @JsType and @JsProperty from webidl. But I have a problem with overloaded methods.

For example: The idl for CanvasRenderingContext2 has several overloaded methods

fx

  void stroke();
  void stroke(Path2D path);

and

  ImageData createImageData(double sw, double sh);
  ImageData createImageData(ImageData imagedata);

I can generate a corresponding Java interface with the overloaded methods, but the GWT compiler fails with this

Error:(75, 0) GWT Compiler: JsType methods cannot overload another method.

I know JS does not support function overloading as such, but on the other hand, you can pass anything to a js function regardless of the specified parameters.

Do you have any ideas for how I can resolve these issues?

/Rene

--
You received this message because you are subscribed to the Google Groups "Google Web Toolkit" group.
To unsubscribe from this group and stop receiving emails from it, send an email to google-web-toolkit+unsubscribe@googlegroups.com.
To post to this group, send email to google-web-toolkit@googlegroups.com.
Visit this group at http://groups.google.com/group/google-web-toolkit.
For more options, visit https://groups.google.com/d/optout.

No comments:

Post a Comment