Thanks for the reply! I'm not sure I understand why "this" evaluates to the plain JS context. I was going off the documentation here which seems to suggest you can use "this" in this way: http://code.google.com/webtoolkit/doc/latest/DevGuideCodingBasicsJSNI.html#methods-fields
Or perhaps you just can't use it for $entry type JSNI? Having said that, I've updated to a non-static method - silly me. I did actually try that first but only pasted in my last attempt at getting some working code. I have tried both of the below now with the same stack trace as a result. Note, there are not actually any spaces before the .@ in my code I'm just working around Google Groups mangling it. private native void initialiseCallbacks() /*-{ var that = this; $wnd.js_callback = $entry(that ....@com.mine.playerimpl::callback()); }-*/; and private native void initialiseCallbacks(PlayerImpl pl) /*-{ $wnd.js_callback = $entry(pl ....@com.mine.playerimpl::callback()); }-*/; On Mar 22, 5:17 pm, Thomas Broyer <t.bro...@gmail.com> wrote: > On Mar 22, 4:23 pm, ChrisK <cknow...@gmail.com> wrote: > > > My above code got a little mangled along the way, the $entry part has > > "(this", followed by a full stop, followed by > > "@com.mine.PlayerImpl::callback());" > > And that's the problem: "this" is a special keyword and will evaluate > to the "this" context of the calling "plain JS" code, whereas you'd > want it to be some PlayerImpl instance. > > There are several ways to fix this: > // evaluates "this" right now > var that = this; > // then uses "that" > $wnd.js_callback = $entry(t...@com.mine.playerimpl::callback()); > > or pass the instance as an argument to the method and then use its > name. > > But there's another bug in your code: there's no "this" in a "static" > method! -- You received this message because you are subscribed to the Google Groups "Google Web Toolkit" group. To post to this group, send email to google-web-tool...@googlegroups.com. To unsubscribe from this group, send email to google-web-toolkit+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/google-web-toolkit?hl=en.