在 GWT 应用程序中包含 Guava GWT

Including Guava GWT in GWT app

我正在尝试将 guava 添加到我的 GWT 2.6.1 应用程序中。我包括了 guava-19.0.jar 和 guava-gwt-19.0.jar。

我加了 <继承名称="com.google.common.collect.Collect" /><br> <inherits name="com.google.common.base.Base" /> 到我的 "MyApp.gwt.xml" 文件。当我通过 Super Dev 模式进入 运行 应用程序时,出现此错误,我不知道该怎么做。

Compile with -strict or with -logLevel set to TRACE or DEBUG to see all errors.
   [ERROR] Errors in 'jar:file:/C:/Projects/my_proj/code/my_gwt_app/main_app/libs/guava/guava-gwt-19.0.jar!/com/google/common/collect/super/com/google/common/collect/RegularImmutableAsList.java'
      [ERROR] Line 20: The import com.google.j2objc cannot be resolved
      [ERROR] Line 31: Weak cannot be resolved to a type
[ERROR] Compiler returned false

我有一个使用番石榴的 class,并且有以下导入:

import com.google.common.base.Predicate;
import com.google.common.collect.Iterables;
import com.google.common.collect.Lists;

我没有理解 "super" folder/package 参考的内容。我看到一个 com.google.common.collect.super.com.google.common.collect 包,但我不确定如何在我的 gwt.xml 文件中引用它。

查看guava-gwt的POM,会发现它有自己的依赖,包括j2objc。

<dependency>
    <groupId>com.google.j2objc</groupId>
    <artifactId>j2objc-annotations</artifactId>
    <optional>false</optional>
</dependency>