Thursday, February 25, 2016

Bogus warnings from GWT-2.8 Beta

If we define a class Foo in GWT with a JSNI method:

 private native void logStuff() /*-{   
            $wnd.myLog("This object has class" + this.@java.lang.Object::getClass()());

then we getting a spurious warning:

[WARN] JSNI method Foo.logStuff()V calls method java.lang.Object.getClass()Ljava/lang/Class;. Instance java.lang.Object methods should not be called on String, Array or JSO instances.

In this case, "this" is an object of type Foo, not a String, Array, or JSO instance.  Why can't I treat it as an Object?  (Actually, why can't I treat a String and Array as Objects, since that's what they are, while we're at it?)

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 post to this group, send email to
Visit this group at
For more options, visit

No comments:

Post a Comment