Re: jsinterop export method that returns Optional

2016-08-30 Thread Ian Preston
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

Re: jsinterop export method that returns Optional

2016-08-30 Thread Thomas Broyer
Except you'd also want to add @JsFunction on Function, Predicate and Supplier to make Optional "useful"; so, no, adding @JsType on Optional is not a good idea (also note that for collections this is only on interfaces; constructors and static fields/methods are all @JsIgnore-d). When exposing s

Re: jsinterop export method that returns Optional

2016-08-30 Thread Jens
As a workaround you can probably copy GWT's Optional emulation into your own project, add JsInterop annotations and then it should work. GWT does not place JsInterop annotations on most JRE emulations because the compiler only has an "all-or-nothing" switch (-generatesJsInteropExports). That me

jsinterop export method that returns Optional

2016-08-30 Thread Ian Preston
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 MyC