views:

498

answers:

2

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

+5  A: 

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

Hilbrand
Thanks, I'll try it as soon as I get home.
Jeeyoung Kim
+2  A: 

Hilbrand's answer didn't quite work (it gave me bunch of errors when Google collection classes were loaded), and I found another solution.

  1. Check out google collection - http://google-collections.googlecode.com/svn/trunk/
  2. Run the ant target "jargwt"
  3. Add the built jar file "google-collect-gwt-snapshot.jar" to your application's classpath.
  4. Add in your GWT application's module.

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.

Jeeyoung Kim