title: Using Generics with GWT-RPC isn't working as expected
body: <p>Rather than creating a hundred different GWT-RPC service and serviceAsync classes, I'm trying to create a single service using generics. Here's the interface:</p>
  <pre><code>@RemoteServiceRelativePath(&quot;dispatch&quot;)
  public interface CommandService extends RemoteService
  {
      public &lt;T&gt; Result&lt;T&gt; execute(Command command, T target);
  }
  </code></pre>
  <p>Here <code>Command</code> is an enum of all the different commands that I can issue, such as <code>Login, Register, ChangePassword</code>', etc. On the server-side, I have a <code>HashMap</code> of <code>Command</code> as the key, and an <code>Executor</code> class as the value. For each <code>Command</code> I have a corresponding <code>Executor</code>. That <code>Executor</code> is executed, and its return value is returned on the server-side.</p>
  <p>The problem occurs when I try to create <code>CommandServiceAsync</code> on the client, and attempt to execute it. Here's my code for that:</p>
  <pre><code>public enum Command
  {
      LOGIN,
      REGISTER,
      CHANGE_PW;
  
      public &lt;T&gt; void execute(T target, final ResultReceiver&lt;T&gt; receiver)
      {
          CommandServiceAsync command = GWT.create(CommandService.class );
          command.execute(this, target, new AsyncCallback&lt;Result&lt;T&gt; &gt;()
          {
              @Override
              public void onFailure(Throwable caught)
              {
                  MyProgram.handleFailure(caught);
              }
  
              @Override
              public void onSuccess(Result&lt;T&gt; result)
              {
                  receiver.receive( result );;
              }
          });
      }
  }
  </code></pre>
  <p>Here, <code>Command.execute</code> is the method which actually calls the service. Here's how I'm calling it to execute the <code>LOGIN</code> command:</p>
  <pre><code>LoginForm form = new LoginForm();
  Command.LOGIN.execute(form, new ResultReceiver&lt;LoginForm&gt;()
  {
      @Override
      public void receive(Result&lt;LoginForm&gt; result)
      {
          Console.debug(&quot;Received result&quot;);
          //result.getTarget() will return an instance of LoginForm
          Console.debug(&quot;user: &quot; + result.getTarget().getUser() );
          Console.debug(&quot;pw: &quot; + result.getTarget().getUser() );
      }
  });
  </code></pre>
  <p>The problem is happening on the following line in <code>Command.execute</code>:</p>
  <pre><code>CommandServiceAsync command = GWT.create(CommandService.class );
  </code></pre>
  <p>Here, I get the following errors:</p>
  <blockquote>
  <p>ERROR: Deferred binding failed for 'com.xxx.CommandService'; expect
  subsequent failures</p>
  <p>ERROR: Uncaught exception escaped
  com.google.gwt.event.shared.UmbrellaException: Exception caught:
  Deferred binding failed for 'com.xxx.CommandService' (did you forget
  to inherit a required module?)</p>
  <p>Caused by:
  com.google.gwt.core.ext.UnableToCompleteException: (see previous log
  entries)</p>
  </blockquote>
  <p>How can I accomplish what I'm trying to do?</p>