Tuesday, December 30, 2014

Calling getVersion() to get the GWT version from a Linker

I'd like to get the GWT version from inside a linker (say the link() method) which in client code can be done via GWT.getVersionI(), however, nothing I've tried appears to work.  You can't use the client version of GWT as that leads to a runtime Java exception since the method getVersion() cannot be found:

java.lang.UnsatisfiedLinkError: com.google.gwt.core.client.GWT.getVersion0()Ljava/lang/String;
     [java]     at com.google.gwt.core.client.GWT.getVersion0(Native Method)
     [java]     at com.google.gwt.core.client.GWT.getVersion(GWT.java:191)
               :

which is understandable since we're not in client code, but I also can't use the ServerGwtBridge via something like: ServerGwtBridge.getInstance().getVersion(), as that just returns the string "unknown".  Indeed it's hardcoded as "unknown" in the source so I'm not sure what good it is - unless something else is supposed to inject a valid version string.  Finally, if I import the class com.google.gwt.core.shared.GWT and call GWt.getVersion() on that, then it will run (unlike when you try to refer to the "client" package), but the result is null.  Nice, right?

All I can think of at this point is using something like System.getenv() to try to read GWT_HOME, but that seems wrong.  Is there no working getVersion() I can call?

--
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