我的 GWT 应用程序抛出此异常:
Caused by: java.lang.ClassCastException: com.google.gwt.core.client.JavaScriptObject$ cannot be cast to java.lang.String
通过 JSNI 获取该函数的 String 响应时:
public final native String data()/*-{
return $wnd.getdata();
}-*/;
}
这是Javascript代码:
function getdata(){
var data = MyObject.data();
console.log(data);
return data;
}
我正在记录 Firebug 的数据输出,这是输出(检查 js 函数是否真的返回了一些东西):
-0.00030517578125,0.00006103515625,0.00115966796875,0.00146484375,-0.00091552734375,-0.000946044921875,-0.001983642578125,-0.003997802734375,-0.005126953125,-0.00360107421875,-0.0032958984375,-0.004119873046875,-0.00433349609375,-0.0023193359375,-0.0008544921875,-0.003448486328125,-0.00347900390625,-0.0054931640625 ,-0.0067138671875,-0.005279541015625,-0.006072998046875,