To be honest, I don't know what the *problem* is, but there should be a
simple workaround:
private final native <B> Promise<B> thenJava(Thenable<B> thenable) /*-{
return this.then(function() {
then: function(arg) {
return @::staticThen(*)(thenable, arg);
}
});
}-*/;
private static <B> Promise<B> staticThen(Thenable<B> thenable, B arg) {
return thenable.then(arg);
}
(or something along those lines)
BTW, you might want to add a bunch of calls to $entry() here and there.
On Thursday, February 26, 2015 at 1:18:01 PM UTC+1, Mickaël Leduque wrote:
>
> Hi,
>
> We switched to gwt 2.7 and now i have a compilation failure
>
> [ERROR] JSNI method
> JsPromise.thenJava(Lcom/codenvy/api/promises/client/Thenable;)Lcom/codenvy/api/promises/client/Promise;
>
> attempts to call method
> Thenable.then(Ljava/lang/Object;)Lcom/codenvy/api/promises/client/Thenable;
> on an instance which might be a JavaScriptObject. Such a method call is
> only allowed in pure Java (non-JSNI) functions.
>
> The code in question does
>
> @Override
> public final <B> Promise<B> then(final Thenable<B> thenable) {
> if (thenable instanceof JavaScriptObject) {
> return this.thenJs((JavaScriptObject)thenable);
> } else {
> return this.thenJava(thenable);
> }
> }
>
> private final native <B> Promise<B> thenJs(JavaScriptObject thenable)
> /*-{
> return this.then(thenable);
> }-*/;
>
> private final native <B> Promise<B> thenJava(Thenable<B> thenable) /*-{
> return this.then(function() {
> then: function(arg) {
> return
> [email protected]::then(*)(arg);
> }
> });
> }-*/;
>
> And there's a JSO implementation of the Thenale interface.
>
> I've seen for example
> https://code.google.com/p/google-web-toolkit/issues/detail?id=9008, but
> that's not the case as ThenJava will never be called with a JavaScripObject
> (unless I misunderstood).
>
> So what's the problem?
>
--
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 [email protected].
To post to this group, send email to [email protected].
Visit this group at http://groups.google.com/group/google-web-toolkit.
For more options, visit https://groups.google.com/d/optout.