在dummys的GWT2.8项目中使用Guava 20.0

在dummys的GWT2.8项目中使用Guava 20.0,gwt,guava,Gwt,Guava,我试图在GWT2.8项目中使用Guava 20.0,但在编译时遇到错误 ... [ERROR] Errors in 'com/google/common/base/Function.java' [ERROR] Line 64: CanIgnoreReturnValue cannot be resolved to a type [ERROR] Line 18: The import com.google.errorprone cannot be reso

我试图在GWT2.8项目中使用Guava 20.0,但在编译时遇到错误

 ...
     [ERROR] Errors in 'com/google/common/base/Function.java'
        [ERROR] Line 64: CanIgnoreReturnValue cannot be resolved to a type
        [ERROR] Line 18: The import com.google.errorprone cannot be resolved
     [ERROR] Errors in 'com/google/common/base/Supplier.java'
 ...
以及我在网上找到的解决方案

我有点不清楚。 之前为了让番石榴发挥作用,我补充道

<inherits name="com.google.common.collect.Collect" />.
到我的项目的gwt.xml

我假设这已经改变了,我需要再增加两个? 或者我也需要下载单独的*.jar吗? (我需要像番石榴gwt那样使用gwt版本的罐子吗?)

如果我缺少一些关于使用guava的更改的文档,我很抱歉,但是我在guava网站上找到的只是需要使用GWT2.8的参考资料,我已经在使用GWT2.8了

因此,欢迎就当前(2016年11月)在新GWT中使用新番石榴的方法提出任何建议。 谢谢

注释我只使用Eclipse,没有Maven或Gradle等。 我的项目也只是客户端,没有服务器

更新

下面是如何设置我的类路径

从中,您需要jsr305(版本1.3.9,从中)、易出错注释(2.0.12)和j2objc注释(1.1)

您可以从


另请参见“确定”,按照此处的建议操作;

如果我创建两个内容相同的gwt.xml文件,它确实可以工作

<module>
<inherits name="com.google.gwt.core.Core" />
<source path=""/>
<source path="concurrent"/>
<super-source path="super" />
</module>
并添加

 <inherits name="com.google.errorprone.annotations.Annotations" />
 <inherits name="com.google.j2objc.annotations.Annotations" />

因为这个原因,我不认为这个问题真的回答了,更多的是这只是一个当前的解决方案。< / P>谢谢,我下载了所有3个罐子,虽然它们似乎不能用GWT。我看不到任何*.gwt.xml文件,因此inherits语句失败。它们只包含注释,因此我认为您实际上不需要gwt模块甚至源代码。我得查一下,谢谢。如果我将jar放在类路径上(通过eclipses接口),但不将它们添加到继承中,我会得到原始错误。因此,显然,这里还需要采取其他措施。哦,如果这有区别的话;这是我试图编译的时候。仍然没有运气。也许我只是搞错了什么。我附上了一张我的类路径设置的图片。仔细想想,jars和-source.jars在版本上有一些不同。(例如,maven存储库似乎没有1.3.9s版本的源jar)。这重要吗?我应该为两者都使用较新的版本吗?
 <inherits name="com.google.errorprone.annotations.Annotations" />
 <inherits name="com.google.j2objc.annotations.Annotations" />
Resolving com.google.common.collect.AbstractMapBasedMultiset
  Found type 'com.google.common.collect.AbstractMapBasedMultiset'
     Found type 'com.google.common.collect.AbstractMultiset'
        Resolving method add
           [WARN] Ignoring unresolvable annotation type com.google.errorprone.annotations.CanIgnoreReturnValue
        Resolving method add
           [WARN] Ignoring unresolvable annotation type com.google.errorprone.annotations.CanIgnoreReturnValue
        Resolving method remove
           [WARN] Ignoring unresolvable annotation type com.google.errorprone.annotations.CanIgnoreReturnValue
        Resolving method remove
        ...
        ...(many pages of this and identical errors in other classes)