yukihane / google-gin

Automatically exported from code.google.com/p/google-gin
Apache License 2.0
0 stars 0 forks source link

Error message for missing source #171

Open GoogleCodeExporter opened 8 years ago

GoogleCodeExporter commented 8 years ago
I'm defining a module with:
  @Provides
  @Singleton
  UserService provideUserService() {
    return UserServiceFactory.getUserService();
  }

and when I compile with GWT I get this NPE:

[ERROR] Generator 'com.google.gwt.inject.rebind.GinjectorGenerator' threw an 
exception while rebinding 'org.gaming.shared.gin.WidgetGinjector'
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)
    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)

Original issue reported on code.google.com by Yoav.Zibin@gmail.com on 17 Jan 2012 at 11:52

GoogleCodeExporter commented 8 years ago
I tried a work around:

  protected void configure() {
    bind(UserService.class).toProvider(UserServiceProvider.class);
  }

  private static class UserServiceProvider implements Provider<UserService> {
    @Override
    public UserService get() {
      return UserServiceFactory.getUserService();
    }    
  }

but that caused another NPE elsewhere:

Compiling module org.gaming.GamingPlatform
   Scanning for additional dependencies: file:/C:/Users/yzibin/workspace/gaming-platform2/src/org/gaming/client/GamingPlatform.java
      Computing all possible rebind results for 'org.gaming.shared.gin.WidgetGinjector'
         Rebinding org.gaming.shared.gin.WidgetGinjector
            Invoking generator com.google.gwt.inject.rebind.GinjectorGenerator
               [ERROR] Generator 'com.google.gwt.inject.rebind.GinjectorGenerator' threw an exception while rebinding 'org.gaming.shared.gin.WidgetGinjector'
java.lang.NullPointerException
    at com.google.gwt.inject.rebind.BindingsProcessor.createImplicitBinding(BindingsProcessor.java:498)
    at com.google.gwt.inject.rebind.BindingsProcessor.createImplicitBindingForUnresolved(BindingsProcessor.java:290)
    at com.google.gwt.inject.rebind.BindingsProcessor.createImplicitBindingsForUnresolved(BindingsProcessor.java:278)
    at com.google.gwt.inject.rebind.BindingsProcessor.process(BindingsProcessor.java:240)
    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 'file:/C:/Users/yzibin/workspace/gaming-platform2/src/org/gaming/client/GamingPlatform.java'
      [ERROR] Line 101:  Failed to resolve 'org.gaming.shared.gin.WidgetGinjector' via deferred binding
   Scanning for additional dependencies: jar:file:/C:/x/Programs/eclipse3.6-Helios/plugins/com.google.gwt.eclipse.sdkbundle_2.4.0.relr36v201110112027/gwt-2.4.0/gwt-user.jar!/com/google/gwt/core/client/impl/SchedulerImpl.java
      [WARN] For the following type(s), generated source was never committed (did you forget to call commit()?)
         [WARN] org.gaming.shared.gin.WidgetGinjectorImpl
   [ERROR] Cannot proceed due to previous errors

Original comment by Yoav.Zibin@gmail.com on 17 Jan 2012 at 11:57

GoogleCodeExporter commented 8 years ago
Ok, I'm stupid :)
Trying to use GIN (instead of GUICE) for server-side injection of UserService.
Still, a better error message would be great.

Original comment by Yoav.Zibin@gmail.com on 18 Jan 2012 at 12:00

GoogleCodeExporter commented 8 years ago

Original comment by aragos on 21 Jan 2012 at 2:09