Are Predicate
s and Function
s supported in GWT 2.4.0 and Guava GWT 10.0.1? Both interfaces are marked as @GwtCompatible
.
When running the project in debug hosted mode, I receive run-time validation errors at the uses of Predicate
:
[ERROR] [MyProject] - Line XXY: The import javax.annotation.Nullable cannot be resolved
[ERROR] [MyProject] - Line YYY: Nullable cannot be resolved to a type
From other StackOverflow posts, I believe these errors should not require including JSR 305 in the path as of Guava version 09 (including JSR 305 in the path didn't fix the problem, anyway).
I also appear to receive a couple interface mismatch errors:
[ERROR] [MyProject] - Line XXX: The type new Function(){} must implement the inherited abstract method Function.apply(Object)
[ERROR] [MyProject] - Line YYY: The method apply(MyType) of type new Function(){} must override or implement a supertype method
, and similar errors at uses of Predicate
, which I submitted as a bug: http://code.google.com/p/guava-libraries/issues/detail?id=765
Any ideas as to what might be wrong with my setup?
My Project.gwt.xml file contains the following lines:
<inherits name="com.google.common.collect.Collect" />
<inherits name="com.google.common.base.Base" />
My java file includes the following imports:
import com.google.common.base.Function;
import com.google.common.base.Predicate;
I am using Eclipse 3.7.1 and JavaSE-1.6
I just had the same problem and found a solution to this. The problem is that the JSR 305 sourcecode is not part of a GWT module and therefore ignored by GWT. To fix it do the following:
javax/annotation
add a file Annotation.gwt.xml
with the following content:<?xml version="1.0" encoding="UTF-8"?> <module> <source path="" /> </module>
Add the modified jsr305-2.0.0.jar to your GWT project's classpath in eclipse. Though stated elsewhere it is not requiered to add this jar to WEB-INF/lib
Let your project's modules inherit from the newly created GWT module by adding the following line to you modules's .gwt.xml
files:
<inherits name='javax.annotation.Annotation'/>
That's it! Now your eclipse project will compile successfully and development/hosted mode will work too.
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