guava
guava copied to clipboard
Docs: "How to use Guava for GWT"
- Look for
@GwtCompatible
annotations on the types you want to use. - The GWT module for a package is usually
com.google.common.foo.Foo
(perhaps always, but there could be exceptions with classes in subpackages?). To see all modules, you can search for something likeguava-gwt/src/com/gwt.xml
. - Depend on the
guava-gwt
artifact. (We used to say this on the release pages but don't anymore -- which is fine, but we should say it somewhere.) - We require GWT version <whatever the current version we require is at the time we write this doc>. Looks like it's intended to be 2.8.0 at this moment, though we're testing with 2.8.2 [update: 2.9.0 as of this writing], so that's probably safer.
- (Bazel) If your GWT target depends on
guava
and attaches theguava
source jar, Bazel will hand the entire Guava source jar to GWT, and it will blow up[*]. You'll need to not attach the source jar :( We might file a bug about this. - General advice about how we've optimized some things for GWT but not others.
- other ideas?
[*]
Tracing compile failure path for type 'com.google.common.base.internal.Finalizer' ... [ERROR] Line 173: PhantomReference cannot be resolved to a type ...
Hi All,
I am using GWT 2.9.0 and guava-gwt-29.0-jr.jar and using below classes from guava,
com.google.common.collect.ComparisonChain com.google.common.collect.Ordering
At the time of gwt compilation, we are facing below issue,
[ERROR] Line 373: ComparisonChain cannot be resolved
[java] [ERROR] Line 8: The import com.google.common cannot be resolved
[java] [ERROR] Line 374: Ordering cannot be resolved
[java] [ERROR] Line 7: The import com.google.common cannot be resolved
Any way we can resolve this ?
Hi, I found this ticket after taking a look why our build broke (we are forced to use 2.8.2) when upgrading guava (patch version) due to https://github.com/google/guava/commit/99a4d3afe044f7bd55f2394ee61756bd6c0adc13. Shouldn't this be at least mentioned in the changelogs?