Thursday, December 13, 2018

A class cast exception when upgrading from GWT 2.8.0 to 2.8.2 ?

I just upgraded from GWT 2.8.0 to 2.8.2 and get a class cast exception which I don't understand, please some help.

It goes wrong in the following line of code:
ZtoeslagAppConfig this.bla = new JsoZtoeslagAppConfig(getZtoeslagConfig());


All relevant code:
private <T extends JavaScriptObject & ZtoeslagAppConfig> T getZtoeslagConfig() {
return (T) UtilsJsni.getProperty(getJson(), getMiscValues().zorgtoeslag());
}

private JavaScriptObject getJson() {
return this.json;
}

public interface ZtoeslagAppConfig {
AppPage[] getPages();
}

public final class JsoZtoeslagAppConfig  implements ZtoeslagAppConfig {
private final JavaScriptObject jsoConfig;

public <T extends JavaScriptObject & ZtoeslagAppConfig> JsoZtoeslagAppConfig(final T jsoConfig) {
        super(jsoConfig);
}

public AppPage[] getPages() {
return UtilsJsArrays.toArray(getJsoPages());
}

private JsArray<? extends JsoAppPage> getJsoPages() {
return UtilsJsni.getPropertyAsArray(getJsoConfig(), getMiscValues().pages());
}

private JavaScriptObject getJsoConfig() {
return this.jsoConfig;
}
}


During super dev mode, in Chrome the values of this.json above:
json_1_g$:
 newsletter: "825eceb44f"
 zorgtoeslag: {payments: Array(3), pages: Array(3)} 

Just before calling the constructor in: 
new JsoZtoeslagAppConfig(getZtoeslagConfig());
It is calling a gwt method for casting that seems to fail:
 static Object castTo(Object src, JavaScriptObject dstId) {
    checkType(src == null || canCast(src, dstId));

In this method, I see that dstId has the value 1891, and src is some json value.
When performing the above body it calls the following method, that I don't directly understand as I don't see the method call in the above function:
  static native boolean jsEquals(Object a, Object b) /*-{
    return a == b;
  }-*/;
I think this method fails as a is some json and b has the value null.

What goes wrong here? 



    






--
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