GWT Native Method Warning
I'm doing a project in GWT to deploy in AppEngine and I'm getting a warning in Eclipse saying: JavaScript parsing: Expected an identifier in JSNI reference Any ideas on what's causing this? public void callFacebookAPI(String url) { JsonpRequestBuilder requestBuilder = new JsonpRequestBuilder(); requestBuilder.requestObject(url, new AsyncCallbackFbUser() { public void onFailure(Throwable caught) { System.out.println(FAIL ); } @Override public void onSuccess(FbUser result) { facebookUser = result; System.out.println(Facebook name: + facebookUser.getName()); } }); } private final native void doFbLoginFunction() /*-{ FB.login(function(response) { if (response.authResponse) { // connected //return response.session; var accessToken = response.accessToken; var url = http://graph.facebook.com/me?access_token=;; var facebookUrl = url + accessToken; @com.google.gwt.smartpark.client.map.SmartPark::callFacebookAPI(Ljava/lang/String;Ljava/lang/ String;)(facebookUrl); } else { -- You received this message because you are subscribed to the Google Groups Google Web Toolkit group. To view this discussion on the web visit https://groups.google.com/d/msg/google-web-toolkit/-/CHN9aE_Fz6gJ. To post to this group, send email to google-web-toolkit@googlegroups.com. To unsubscribe from this group, send email to google-web-toolkit+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/google-web-toolkit?hl=en.
Re: GWT Native Method Warning
On Sun, Nov 18, 2012 at 11:16 AM, Patrax pje...@gmail.com wrote: public void callFacebookAPI(String url) { This is an instance method. FB.login(function(response) { [FYI, you should probably wrap your callback in $entry(). See https://developers.google.com/web-toolkit/doc/latest/DevGuideCodingBasicsJSNI#calling ] @com.google.gwt.smartpark.client.map.SmartPark::callFacebookAPI(Ljava/lang/String;Ljava/lang/ String;)(facebookUrl); You're calling the instance method without a receiver object. You either need to change the instance method into a static method, or add a receiver object like foo.@[...](facebookUrl); See https://developers.google.com/web-toolkit/doc/latest/DevGuideCodingBasicsJSNI#methods-fields -- You received this message because you are subscribed to the Google Groups Google Web Toolkit group. To post to this group, send email to google-web-toolkit@googlegroups.com. To unsubscribe from this group, send email to google-web-toolkit+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/google-web-toolkit?hl=en.
Re: GWT Native Method Warning
In addition to matthew's comment, you are invoking a method that apparently has two arguments callFacebookAPI(Ljava/lang/String;Ljava/lang/String;) with only one: (facebookUrl) Delete one of the two Ljava/lang/String; parts on the method invocation so you actually point to your method callFacebookAPI(String url) correctly. On Sunday, November 18, 2012 1:16:15 PM UTC-6, Patrax wrote: I'm doing a project in GWT to deploy in AppEngine and I'm getting a warning in Eclipse saying: JavaScript parsing: Expected an identifier in JSNI reference Any ideas on what's causing this? public void callFacebookAPI(String url) { JsonpRequestBuilder requestBuilder = new JsonpRequestBuilder(); requestBuilder.requestObject(url, new AsyncCallbackFbUser() { public void onFailure(Throwable caught) { System.out.println(FAIL ); } @Override public void onSuccess(FbUser result) { facebookUser = result; System.out.println(Facebook name: + facebookUser.getName()); } }); } private final native void doFbLoginFunction() /*-{ FB.login(function(response) { if (response.authResponse) { // connected //return response.session; var accessToken = response.accessToken; var url = http://graph.facebook.com/me?access_token=;; var facebookUrl = url + accessToken; @com.google.gwt.smartpark.client.map.SmartPark::callFacebookAPI(Ljava/lang/String;Ljava/lang/ String;)(facebookUrl); } else { -- You received this message because you are subscribed to the Google Groups Google Web Toolkit group. To view this discussion on the web visit https://groups.google.com/d/msg/google-web-toolkit/-/oxSY6FEfI60J. To post to this group, send email to google-web-toolkit@googlegroups.com. To unsubscribe from this group, send email to google-web-toolkit+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/google-web-toolkit?hl=en.