java.lang.IllegalArgumentException: invoke arguments: JS value of type number, expected java.lang.Object
at com.google.gwt.dev.shell.JsValueGlue.get(JsValueGlue.java:178)
at com.google.gwt.dev.shell.MethodDispatch.invoke(MethodDispatch.java:65)
at com.google.gwt.dev.shell.OophmSessionHandler.invoke(OophmSessionHandler.java:172)
at com.google.gwt.dev.shell.BrowserChannelServer.reactToMessagesWhileWaitingForReturn(BrowserChannelServer.java:338)
at com.google.gwt.dev.shell.BrowserChannelServer.invokeJavascript(BrowserChannelServer.java:219)
at com.google.gwt.dev.shell.ModuleSpaceOOPHM.doInvoke(ModuleSpaceOOPHM.java:136)
at com.google.gwt.dev.shell.ModuleSpace.invokeNative(ModuleSpace.java:571)
at com.google.gwt.dev.shell.ModuleSpace.invokeNativeObject(ModuleSpace.java:279)
at com.google.gwt.dev.shell.JavaScriptHost.invokeNativeObject(JavaScriptHost.java:91)
Upon closer examination of the get method of JsValueGlue which looks something like this:
public static <T> T get(JsValue value, CompilingClassLoader cl, Class<T> type, String msgPrefix) {
if (type.isPrimitive()) {
//ommitted for brevity
}
if (value.isNull() || value.isUndefined()) {
return null;
}
if (value.isWrappedJavaObject()) {
return type.cast(value.getWrappedJavaObject());
}
if (value.isString()) {
return type.cast(value.getString());
}
if (value.isJavaScriptObject()) {
return type.cast(createJavaScriptObject(value, cl));
}
// Just don't know what do to with this.
/*
* TODO (amitmanjhi): does throwing a HostedModeException here and catching
* a RuntimeException in user test
* com.google.gwt.dev.jjs.test.HostedTest::testObjectReturns() make sense
*/
throw new IllegalArgumentException(msgPrefix + ": JS value of type "
+ value.getTypeString() + ", expected "
+ TypeInfo.getSourceRepresentation(type));
}
I saw that there is no check when the value is a number. Not sure if it is a bug in JsValueGlue.get or there is a reason number is excluded. I believe the code misses something like:
if (value.isNumber()) {
return type.cast(value.getNumber());
}
If this is a bug I'd be willing to create an issue and probably a patch if the whole procedure isn't too complicated.
You received this message because you are subscribed to the Google Groups "Google Web Toolkit" 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 http://groups.google.com/group/google-web-toolkit.
For more options, visit https://groups.google.com/groups/opt_out.
No comments:
Post a Comment