The JSNI method does not accept any parameters but return a Java Object type:
public static native String nativeJSFuncGwt() /*-{
$wnd.console.log($wnd.someJSFunc());
return "" + $wnd.someJSFunc() + "" ;
}-*/;
//someJSFunc returns { abc:xcv, def:asd}
I can see the value getting printed in the javascript console but java side is not able to understand the casting.
Is it because the native method does not accept any parameters ?
String tokenFromNativeJS = nativeJSFuncGwt(); // String value is null
The documentation also is not clear enough in GWT.
I am posting here what finally worked for due to GWT version(2.4) constraint
From GWT Doc:
My code with modification would like:
I wish documentation could have been more clear.