Hi.
I'm trying to convert js native number to GWT Long and send it over gwt-rpc. But I got very weird results..
public class gwtbugEntryPoint implements EntryPoint { @Override public void onModuleLoad() { String data = "{\"type\":\"upd\", \"id\":123}"; ServerEvent serverEvent = JsonUtils.<ServerEvent>safeEval(data); RootPanel.get().add(new HTML("GWT id="+serverEvent.getId())); } } class ServerEvent extends JavaScriptObject { protected ServerEvent() { } public final native String getType()/*-{ return this.type; }-*/; public final Long getId(){ String idStr = _getId(); GWT.log("idSTr:" + idStr); Long id = new Long(idStr); GWT.log("id:"+id); return id; } public final native String _getId()/*-{ return this.id; }-*/; }
console output:
idSTr:123
id:0
Can anyone explain me, how that could happen?
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/d/optout.
No comments:
Post a Comment