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 google-web-toolkit+unsubscribe@googlegroups.com.
To post to this group, send email to google-web-toolkit@googlegroups.com.
Visit this group at https://groups.google.com/group/google-web-toolkit.
For more options, visit https://groups.google.com/d/optout.

No comments:

Post a Comment