This is a simple problem, but I'm having problems with it...
I'm trying to use Google common collection's Objects.equal()
method in a GWT client code, but I'm keep getting the error
20:12:10.001 [ERROR] [gwt_regex] Line 39: No source code is available for type com.google.common.base.Objects; did you forget to inherit a required module?
Tried to Google for the answer, but couldn't find any answer regarding this - everyone just said "Google collection should work off the box with GWT".
You need to inherit the module file:
<inherits name='com.google.common.Collect.gwt.xml' />
and add the source files of both collections and additional gwt specific files. The first are in the zip file from the project page, the latter are available in the gwt folder in collections project trunk: http://code.google.com/p/google-collections/source/browse/#svn/trunk/gwt
To solve your error (No source code is available for type com.google.common.base.Objects), you just need to include Base GWT module :
<inherits name="com.google.common.base.Base" />
If you want to use classes related to collections, you need to include Collect GWT module :
<inherits name="com.google.common.collect.Collect" />
PS : tested with GUAVA GWT 17.0
Hilbrand's answer didn't quite work (it gave me bunch of errors when Google collection classes were loaded), and I found another solution.
The reason Hilbrand's solution didn't work was because Google collection contains alot of gwt-incompaitable java files, and the Collect.gwt.xml module file selects ALL java file under Google Collection.
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