Friday, June 14, 2019

JSNI - access inner class attribute from external JS?

I am absolutely pulling my hear out with this one and I'm hoping someone can help.  I have been able to use JSNI on numerous other occasions to call GWT class functionality when needed.  It works very well once the syntax is figured out.  I need to do something similar but with an inner class.  I have an app that has an inner class within a GWT class.  I need to be able to access and change an attribute on that inner class from external/hand-written javascript.  

The GWT compiler is throwing an error: "Missing qualifier on instance method" and it's complaining about this line -- "$wnd.setValueFromExternal"

What is the proper way to call a GWT accessor from an external/hand-written javascript file when that accessor is within an inner class?

public class Foo extends DataEntryListener{


    public class Bar(){

        private int value;

        public int getValue(){

            return value;


        public void setValue(int val){

            this.value = val;



public native void setValueFromExternal(int newValue) /*-{
$wnd.setValueFromExternal = $entry(@pkg.Foo.Bar::setValue(I)(newValue);

Here is the call from an external/hand-written javascript file:

function setValue(value){


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
To view this discussion on the web visit

No comments:

Post a Comment