title: NullPointerException while GWT building with Gin
body: <p>My Gin module contains the following:</p>
  
  <pre><code>  @Override
    protected void configure() {
      bind(HistoryWrapper.class).to(HistoryWrapperImpl.class);
      ...
    }
  </code></pre>
  
  <p>The types in question are:</p>
  
  <pre><code>public interface HistoryWrapper {
  
    void newItem(String token);
  
  }
  
  public class HistoryWrapperImpl implements HistoryWrapper {
  
    @Override
    public void newItem(String token) {}
  
  }
  </code></pre>
  
  <p>When I try to GWT compile, I get the following error:</p>
  
  <pre><code>Compiling module com.foo.FooGame
     Validating newly compiled units
        Ignored 9 units with compilation errors in first pass.
  Compile with -strict or with -logLevel set to TRACE or DEBUG to see all errors.
     Scanning for additional dependencies: file: FooGameHtml.java
        Computing all possible rebind results for 'com.foo.html.client.gin.BarGinjector'
           Rebinding com.foo.html.client.gin.BarGinjector
              Invoking generator com.google.gwt.inject.rebind.GinjectorGenerator
                 [ERROR] Generator 'com.google.gwt.inject.rebind.GinjectorGenerator' threw an exception while rebinding 'com.foo.html.client.gin.BarGinjector'
  java.lang.NullPointerException
      at com.google.gwt.inject.rebind.BindingsProcessor.createImplicitBinding(BindingsProcessor.java:498)
      at com.google.gwt.inject.rebind.BindingsProcessor.access$900(BindingsProcessor.java:99)
      at com.google.gwt.inject.rebind.BindingsProcessor$GuiceBindingVisitor.addImplicitBinding(BindingsProcessor.java:982)
      at com.google.gwt.inject.rebind.BindingsProcessor$GuiceBindingVisitor.visit(BindingsProcessor.java:972)
      at com.google.gwt.inject.rebind.BindingsProcessor$GuiceBindingVisitor.visit(BindingsProcessor.java:898)
      at com.google.inject.internal.UntargettedBindingImpl.acceptTargetVisitor(UntargettedBindingImpl.java:40)
      at com.google.gwt.inject.rebind.BindingsProcessor$GuiceElementVisitor.visit(BindingsProcessor.java:827)
      at com.google.gwt.inject.rebind.BindingsProcessor$GuiceElementVisitor.visit(BindingsProcessor.java:820)
      at com.google.inject.internal.BindingImpl.acceptVisitor(BindingImpl.java:92)
      at com.google.gwt.inject.rebind.BindingsProcessor.createBindingsForModules(BindingsProcessor.java:409)
      at com.google.gwt.inject.rebind.BindingsProcessor.process(BindingsProcessor.java:238)
      at com.google.gwt.inject.rebind.GinjectorGeneratorImpl.generate(GinjectorGeneratorImpl.java:76)
      at com.google.gwt.inject.rebind.GinjectorGenerator.generate(GinjectorGenerator.java:47)
      at com.google.gwt.core.ext.GeneratorExtWrapper.generate(GeneratorExtWrapper.java:48)
      at com.google.gwt.core.ext.GeneratorExtWrapper.generateIncrementally(GeneratorExtWrapper.java:60)
      at com.google.gwt.dev.javac.StandardGeneratorContext.runGeneratorIncrementally(StandardGeneratorContext.java:647)
      at com.google.gwt.dev.cfg.RuleGenerateWith.realize(RuleGenerateWith.java:41)
      at com.google.gwt.dev.shell.StandardRebindOracle$Rebinder.rebind(StandardRebindOracle.java:78)
      at com.google.gwt.dev.shell.StandardRebindOracle.rebind(StandardRebindOracle.java:268)
      at com.google.gwt.dev.shell.StandardRebindOracle.rebind(StandardRebindOracle.java:257)
      at com.google.gwt.dev.DistillerRebindPermutationOracle.getAllPossibleRebindAnswers(DistillerRebindPermutationOracle.java:91)
      at com.google.gwt.dev.jdt.WebModeCompilerFrontEnd.doFindAdditionalTypesUsingRebinds(WebModeCompilerFrontEnd.java:96)
      at com.google.gwt.dev.jdt.AbstractCompiler$Sandbox$CompilerImpl.process(AbstractCompiler.java:254)
      at org.eclipse.jdt.internal.compiler.Compiler.compile(Compiler.java:444)
      at com.google.gwt.dev.jdt.AbstractCompiler$Sandbox$CompilerImpl.compile(AbstractCompiler.java:173)
      at com.google.gwt.dev.jdt.AbstractCompiler$Sandbox$CompilerImpl.compile(AbstractCompiler.java:288)
      at com.google.gwt.dev.jdt.AbstractCompiler$Sandbox$CompilerImpl.access$400(AbstractCompiler.java:139)
      at com.google.gwt.dev.jdt.AbstractCompiler.compile(AbstractCompiler.java:588)
      at com.google.gwt.dev.jdt.BasicWebModeCompiler.getCompilationUnitDeclarations(BasicWebModeCompiler.java:97)
      at com.google.gwt.dev.jdt.WebModeCompilerFrontEnd.getCompilationUnitDeclarations(WebModeCompilerFrontEnd.java:52)
      at com.google.gwt.dev.jjs.JavaToJavaScriptCompiler.precompile(JavaToJavaScriptCompiler.java:569)
      at com.google.gwt.dev.jjs.JavaScriptCompiler.precompile(JavaScriptCompiler.java:33)
      at com.google.gwt.dev.Precompile.precompile(Precompile.java:284)
      at com.google.gwt.dev.Precompile.precompile(Precompile.java:233)
      at com.google.gwt.dev.Precompile.precompile(Precompile.java:145)
      at com.google.gwt.dev.Compiler.run(Compiler.java:232)
      at com.google.gwt.dev.Compiler.run(Compiler.java:198)
      at com.google.gwt.dev.Compiler$1.run(Compiler.java:170)
      at com.google.gwt.dev.CompileTaskRunner.doRun(CompileTaskRunner.java:88)
      at com.google.gwt.dev.CompileTaskRunner.runWithAppropriateLogger(CompileTaskRunner.java:82)
      at com.google.gwt.dev.Compiler.main(Compiler.java:177)
     [ERROR] Errors in 'src/com/foo/html/client/FooGameHtml.java'
        [ERROR] Line 34:  Failed to resolve 'com.foo.html.client.gin.BarGinjector' via deferred binding
     Scanning for additional dependencies: jar:file:/C:/path/to/eclipse-java-indigo-win32-x86_64%20(1)/eclipse/plugins/com.google.gwt.eclipse.sdkbundle_2.4.0.v201201120043-rel-r37/gwt-2.4.0/gwt-user.jar!/com/google/gwt/core/client/impl/AsyncFragmentLoader.java
        [WARN] For the following type(s), generated source was never committed (did you forget to call commit()?)
           [WARN] com.foo.html.client.gin.BarGinjectorImpl
  </code></pre>
  
  <p>What am I doing wrong here? Commenting out the <code>bind(HistoryWrapper.class)</code> line makes the issue go away, although obviously I need a binding for that type.</p>
  
  <p>I got a similar error when I tried to use a <code>@Provides</code> method.</p>
  
  <p><strong>Update:</strong> Now I'm getting a different NPE, but I'm not sure why:</p>
  
  <pre><code>java.lang.NullPointerException
      at com.google.gwt.inject.rebind.util.KeyUtil.javaToGwtMethod(KeyUtil.java:222)
      at com.google.gwt.inject.rebind.binding.ProviderMethodBinding.setProviderMethod(ProviderMethodBinding.java:60)
      at com.google.gwt.inject.rebind.BindingsProcessor$GuiceBindingVisitor.visit(BindingsProcessor.java:926)
      at com.google.gwt.inject.rebind.BindingsProcessor$GuiceBindingVisitor.visit(BindingsProcessor.java:898)
      at com.google.inject.internal.ProviderInstanceBindingImpl.acceptTargetVisitor(ProviderInstanceBindingImpl.java:52)
      at com.google.gwt.inject.rebind.BindingsProcessor$GuiceElementVisitor.visit(BindingsProcessor.java:827)
      at com.google.gwt.inject.rebind.BindingsProcessor$GuiceElementVisitor.visit(BindingsProcessor.java:820)
      at com.google.inject.internal.BindingImpl.acceptVisitor(BindingImpl.java:92)
  </code></pre>