Tuesday, August 30, 2016

Re: jsinterop export method that returns Optional

Thanks guys, I've gone with Jens' suggestion in the end. I don't need the full Function et al stuff, just isPresent and get for my use case. So I was able to just export only those methods. 

On Tuesday, 30 August 2016 10:11:31 UTC+1, Ian Preston wrote:
I'm trying to export a Java method with @JsMethod which returns an Optional. 

Clearly GWT is emulating Optional under the hood for internal code. Is it possible to export the Optional class as well?

At the moment it compiles, but gives me a warning:
[unusable-by-js] Return type of 'Optional MyClass.myMethod(String)' is not usable by but exposed to JavaScript.

You received this message because you are subscribed to the Google Groups "GWT Users" 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 https://groups.google.com/group/google-web-toolkit.
For more options, visit https://groups.google.com/d/optout.

No comments:

Post a Comment