Using the Google Shared Collection in GWT

This is a simple problem, but I have problems with it ...

I am trying to use the general Google Objects.equal() collectible method in the GWT client code, but I keep getting the error

20: 12: 10.001 [ERROR] [gwt_regex] Line 39: no source code for type com.google.common.base.Objects; did you forget to inherit the required module?

I tried Google for the answer, but could not find the answer to this question - everyone said: "The Google collection should work with the box with GWT."

+7
java guava gwt
source share
4 answers

The answer to Hilbrand didn’t quite work (it gave me a bunch of errors when loading Google classes) and I found another solution.

The reason the Hilbrand solution didn't work was because the Google collection contains a lot of gwt-incompatible java files, and the module file Collect.gwt.xml selects ALL the java file in the Google Collection.

+2
source share

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 special gwt files. The former are located in the zip file from the project page, the latter are available in the gwt folder in the project collection: http://code.google.com/p/google-collections/source/browse/#svn/trunk/gwt

+6
source share

To solve your mistake (there is no source code for type com.google.common.base.Objects), you just need to enable the GWT base module:

 <inherits name="com.google.common.base.Base" /> 

If you want to use classes related to collections, you need to enable the Collect GWT module:

 <inherits name="com.google.common.collect.Collect" /> 

PS: verified using GUAVA GWT 17.0

+3
source share

I had the same problem, my problems were resolved below.

I found "guava-15.0.jar" in the build path, then added another file "guava-gwt-15.0.jar" to create the path

0
source share

All Articles