Is it possible to create an annotation (or some other way) to force the GWT compiler to not compile a method? I have a class that I also use on app-engine (in a shared folder) and one method in it requires a server side only function which causes GWT to not compile. I would like GWT to just ignore the method (while appengine does not).
I figured either an annotation, or a pre-compile script that erases the method prior to compilation. Both methods would work for me, it would be best if I could still compile through the eclipse IDE.
Anyone else thought of this or tried it?
Not until now. Very recently such annotation was added @com.google.gwt.core.shared.GwtIncompatible("Description why...")
. It is applicable on classes or methods.
But the patched code was not released yet! Official status is FixedNotReleased
. And i can personally confirm, it is not in current GWT 2.5.1 version. I am hopeful for upcoming 2.5.2.
See:
http://code.google.com/p/google-web-toolkit/source/browse/trunk/user/src/com/google/gwt/core/shared/GwtIncompatible.java?spec=svn11570&r=11570
http://code.google.com/p/google-web-toolkit/issues/detail?id=3769
https://gwt-review.googlesource.com/#/c/2320/
Note, there is already similar annotation com.google.gwt.thirdparty.guava.common.annotations.GwtIncompatible
in gwt-dev.jar
, however
it does not work, compiler still wants to compile my incompatible method in shared class.
Prior to GWT version 2.6, there is no annotation to make the GWT compiler ignore a method. There is a requests for it in the GWT issue tracker, and apparently it is scheduled for the 2.6 release.
One workaround approach is to have the "offending" method in a class of its own and ignore that class in your .gwt.xml
file:
<source path="gwtclient">
<exclude name="AppEngineOnlyClass.java" />
...
</source>
...
Hope that helps a bit.
Cheers,
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With