GWT和ReflectionStringBuilder.toString()

GWT和ReflectionStringBuilder.toString(),gwt,tostring,Gwt,Tostring,我对GWT编译器有问题。将下一个方法添加到实体类时: @Override public String toString() { return ReflectionToStringBuilder.toString(this, ToStringStyle.SHORT_PREFIX_STYLE); } 编译器给了我下一个错误: ERROR: Deferred binding failed for 'com.mvp4g.client.Mvp4gModule'; expect subsequent

我对GWT编译器有问题。将下一个方法添加到实体类时:

@Override
public String toString() {
   return ReflectionToStringBuilder.toString(this, ToStringStyle.SHORT_PREFIX_STYLE);
}
编译器给了我下一个错误:

ERROR: Deferred binding failed for 'com.mvp4g.client.Mvp4gModule'; expect subsequent failures
ERROR: Unable to load module entry point class plaut.wimc.avl.admin.client.Admin (see associated exception for details)
java.lang.RuntimeException: Deferred binding failed for 'com.mvp4g.client.Mvp4gModule' (did you forget to inherit a required module?)

当我移除它时,一切正常。我不明白为什么给我这样的错误。roo中也使用了这个
toString
方法,没有这样的错误。

看起来问题出在ReflectionStringBuilder上。它是GWT模块吗?如果是,则需要在项目的*.gwt.xml中添加一个继承模块,客户端使用的所有Java代码都需要能够编译为JavaScript
ReflectionStringBuilder
使用JavaScript中不可用的反射,因此此方法不能在客户端代码中使用


此编译错误是指所有Java代码都必须由GWT copmiler通过GWT模块文件中的
path
参数访问,并且必须以源代码格式提供。在这种情况下,不存在GWT模块文件,因此出现错误,因为编译器无法找到
ReflectionStringBuilder
方法的源代码。尽管您可以为此特定案例创建这样一个文件并添加源代码,但它不起作用,因为反射不起作用。

不,它不是GWT模块,它的apache工件:org.apache.common:commons-lang3@user1289877请阅读(第一段,特别是最后一句),我认为您还不能在GWT中使用commons lang。有一个gwt-commons-lang()项目。但我看不到里面有任何活动。另外,在Google groups中有一个旧的post(),它说您不能在GWT项目中为客户端使用commons lang。好的,我理解,但在roo生成的项目中这是怎么可能的呢?您认为aspectJ编译器会翻译这些函数吗?在roo中,这个类是否只用于服务器端代码?那就行了。