Java 尝试将番石榴Fluentiable与GWT一起使用时出错

Java 尝试将番石榴Fluentiable与GWT一起使用时出错,java,gwt,guava,Java,Gwt,Guava,我尝试将Guava 12.0的Fluentiable与GWT 2.0.3结合使用,如下所示: import com.google.common.collect.FluentIterable; class FooPresenter { // snip private List<NullSafeCheckBox> asCheckboxes() { return FluentIterable.from(getDisplay().getMetricInputs()

我尝试将Guava 12.0的Fluentiable与GWT 2.0.3结合使用,如下所示:

import com.google.common.collect.FluentIterable;

class FooPresenter {
   // snip

   private List<NullSafeCheckBox> asCheckboxes() {
      return FluentIterable.from(getDisplay().getMetricInputs())
         .transform(new Function<HasValueChangeHandlers<Boolean>, NullSafeCheckBox>() {
            @Override
            public NullSafeCheckBox apply(@Nullable HasValueChangeHandlers<Boolean> checkbox) {
               return (NullSafeCheckBox) checkbox;
            }
         })
         .toImmutableList();
   }
}
我的pom.xml如下所示:

  <dependency>
      <groupId>com.google.guava</groupId>
      <artifactId>guava</artifactId>
      <version>12.0</version>
  </dependency>
  <dependency>
      <groupId>com.google.guava</groupId>
      <artifactId>guava-gwt</artifactId>
      <version>12.0</version>
  </dependency>
<!-- Guava -->
<inherits name="com.google.common.collect.Collect"/>
您可以尝试将项目添加为依赖项。正如他们在维基上所说的

这个库正在合并到GWT本身中! 目前它在GWT中继上


它可能在即将推出的v2.5中提供。

仅供参考,在我看来,java.math应该在GWT的当前版本中提供,尽管可能不在2.0.3中。参见,例如,可能是可用的第一个版本

我不知道结合gwt java math会有什么结果;可能Guava本身需要声明对其模块的依赖才能工作


我们确实需要更好地确定和宣传番石榴需要哪种版本的GWT,包括对番石榴进行GWT测试(不仅仅是内部版本),以验证这一点。

谢谢!这至少让我犯了下一个错误。:)请参阅我原始问题的更新。我认为您必须删除非gwt guava依赖项。它可能会限制可用番石榴类的数量,但要确保它们是GWT化的。比如说,在GuavaJava和GuavaGWT之间进行选择,同时使用这两种语言可能会让classloader感到困惑,这表明您在POM中需要两种guava-DEP,而事实上,当我省略了非gwt guava时,它对我不起作用。
<!-- Guava -->
<inherits name="com.google.common.collect.Collect"/>
  <!-- Guava -->
  <inherits name="com.google.common.collect.Collect"/>
  <inherits name="com.googlecode.gwt.math.Math" />
DEBUG: Validating newly compiled units
  WARN: Warnings in 'jar:file:/home/josh/.m2/repository/videoplaza-third-party/gwt-incubator/20100204-r1747/gwt-incubator-20100204-r1747.jar!/com/google/gwt/widgetideas/client/impl/GlassPanelImpl.java'
    WARN: Line 30: Referencing deprecated class 'com.google.gwt.user.client.impl.DocumentRootImpl'
    WARN: Line 38: Referencing deprecated class 'com.google.gwt.user.client.impl.DocumentRootImpl'
  ERROR: Errors in 'jar:file:/home/josh/.m2/repository/com/google/guava/guava-gwt/12.0/guava-gwt-12.0.jar!/com/google/common/primitives/UnsignedLong.java'
    ERROR: Line 77: The method bitLength() is undefined for the type BigInteger
    ERROR: Line 79: The method longValue() is undefined for the type BigInteger
    ERROR: Line 200: The method valueOf(long) is undefined for the type BigInteger
    ERROR: Line 202: The method setBit(int) is undefined for the type BigInteger