如何扩展非客户端GWT类

如何扩展非客户端GWT类,gwt,binding,deferred,Gwt,Binding,Deferred,在我的项目中,我尝试扩展没有通过客户端模块继承的GWT类。 例如,我想创建com.google.gwt.resources.ext.ResourceGenerator的一个简单实现 public class SimpleResourceGenerator implements ResourceGenerator 并使用而不是ClientBundle的默认@ResourceGeneratorType-BundleResourceGenerator @ResourceGeneratorType(S

在我的项目中,我尝试扩展没有通过客户端模块继承的GWT类。 例如,我想创建com.google.gwt.resources.ext.ResourceGenerator的一个简单实现

public class SimpleResourceGenerator implements ResourceGenerator
并使用而不是ClientBundle的默认@ResourceGeneratorType-BundleResourceGenerator

@ResourceGeneratorType(SimpleResourceGenerator.class)
    public interface Resources extends ClientBundle {
但是没有成功

如果我将SimpleResourceGenerator类放在“client”包下,GWT编译器会说:

         [ERROR] Line 11: No source code is available for type com.google.gwt.resources.ext.ResourceGenerator; did you forget to inherit a required module?
         [ERROR] Line 13: No source code is available for type com.google.gwt.core.ext.TreeLogger; did you forget to inherit a required module?
         [ERROR] Line 13: No source code is available for type com.google.gwt.resources.ext.ResourceContext; did you forget to inherit a required module?
         [ERROR] Line 13: No source code is available for type com.google.gwt.core.ext.typeinfo.JMethod; did you forget to inherit a required module?
         [ERROR] Line 14: No source code is available for type com.google.gwt.core.ext.UnableToCompleteException; did you forget to inherit a required module?
         [ERROR] Line 19: No source code is available for type com.google.gwt.resources.ext.ClientBundleFields; did you forget to inherit a required module?
         [ERROR] Line 36: No source code is available for type com.google.gwt.resources.ext.ClientBundleRequirements; did you forget to inherit a required module?
若我将所有gwt用户和gwt开发人员源链接到项目,那个么我还有其他未解决的依赖项

Loading inherited module 'com.google.gwt.user.User'
   Loading inherited module 'com.google.gwt.animation.Animation'
      Loading inherited module 'com.google.gwt.core.Core'
         Loading inherited module 'com.google.gwt.core.CrossSiteIframeLinker'
            [ERROR] Unable to load class 'com.google.gwt.core.linker.DirectInstallLinker'
java.lang.ClassNotFoundException: com.google.gwt.core.linker.DirectInstallLinker
我无法理解GWT编译器以及它在编译时如何解析类型。为什么它找到了一些GWT类而找不到其他类

我看到的唯一方法是编译SimpleResourceGenerator的模块重写

   <generate-with
    class="com.google.gwt.resources.rebind.context.StaticClientBundleGenerator">

    <!-- We have to specify on which types to execute the Generator -->
    <when-type-assignable
      class="com.google.gwt.resources.client.ClientBundle" />
   </generate-with>

从继承的com.google.gwt.resources.resources.gwt.xml和自己的生成器

  <generate-with
    class="com.example.gwt.SimpleBundleGenerator">
      <when-type-assignable
        class="com.google.gwt.resources.client.ClientBundle" />
  </generate-with>

并扩展com.google.gwt.resources.rebind.context.AbstractClientBundleGenerator

但这对我来说似乎有点太复杂了。
有没有比通过生成器和代码替换延迟绑定更简单的方法来扩展GWT类?

生成器不应该包含在“客户机”包中,但它生成的java源应该包含在其中


“客户端”包用于gwt编译,以查找将应用程序编译为javascript时应使用的java源文件,并使用生成器在编译时生成javasource文件。

生成器不应包含在“客户端”包中,但应包含它生成的java源文件


“客户端”包用于gwt编译,以查找将应用程序编译为javascript时应使用的java源文件,并使用生成器在编译时生成javasource文件。

应该比这更简单。您是否尝试过继承该模块?是的,模块继承了com.google.gwt.Resources.client包中的Resources.gwt.xml,但ResourceGenerator位于com.google.gwt.Resources.ext包中。应该比这更简单。您是否尝试过继承该模块?是的,模块继承com.google.gwt.Resources.client包中的Resources.gwt.xml,但ResourceGenerator位于com.google.gwt.Resources.ext包中。