Friday, December 12, 2014

webidl, jsinterop and overloaded methods

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