semeiskii / google-gin

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

NPE in BindingsProcessor.createImplicitBinding #143

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
This is a duplicate of issue 119.

Version: Gin 1.0

Repro steps:

1. Create a Ginjector with a @GinModules tag

@GinModules(MyModule.class)
public interface Injector extends Ginjector
{}

2. If the source of "MyModule.class" is not available to GWT, the generator 
will throw the following exception:

java.lang.NullPointerException
        at com.google.gwt.inject.rebind.BindingsProcessor.createImplicitBinding(BindingsProcessor.java:433)
        at com.google.gwt.inject.rebind.BindingsProcessor.access$900(BindingsProcessor.java:92)
        at com.google.gwt.inject.rebind.BindingsProcessor$GuiceBindingVisitor.addImplicitBinding(BindingsProcessor.java:886)
        at com.google.gwt.inject.rebind.BindingsProcessor$GuiceBindingVisitor.visit(BindingsProcessor.java:876)
        at com.google.gwt.inject.rebind.BindingsProcessor$GuiceBindingVisitor.visit(BindingsProcessor.java:807)
        at com.google.inject.internal.UntargettedBindingImpl.acceptTargetVisitor(UntargettedBindingImpl.java:41)
        at com.google.gwt.inject.rebind.BindingsProcessor$GuiceElementVisitor.visit(BindingsProcessor.java:736)
        at com.google.gwt.inject.rebind.BindingsProcessor$GuiceElementVisitor.visit(BindingsProcessor.java:729)
        at com.google.inject.internal.BindingImpl.acceptVisitor(BindingImpl.java:93)
        at com.google.gwt.inject.rebind.BindingsProcessor.createBindingsForModules(BindingsProcessor.java:351)
        at com.google.gwt.inject.rebind.BindingsProcessor.process(BindingsProcessor.java:216)
        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.dev.javac.StandardGeneratorContext.runGenerator(StandardGeneratorContext.java:427)
        at com.google.gwt.dev.cfg.RuleGenerateWith.realize(RuleGenerateWith.java:39)
        at com.google.gwt.dev.shell.StandardRebindOracle$Rebinder.tryRebind(StandardRebindOracle.java:115)
        at com.google.gwt.dev.shell.StandardRebindOracle$Rebinder.rebind(StandardRebindOracle.java:58)
        at com.google.gwt.dev.shell.StandardRebindOracle.rebind(StandardRebindOracle.java:161)
        at com.google.gwt.dev.shell.StandardRebindOracle.rebind(StandardRebindOracle.java:150)
        at com.google.gwt.dev.Precompile$DistillerRebindPermutationOracle.getAllPossibleRebindAnswers(Precompile.java:345)
        at com.google.gwt.dev.jdt.WebModeCompilerFrontEnd.doFindAdditionalTypesUsingRebinds(WebModeCompilerFrontEnd.java:106)
        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:175)
        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:145)
        at com.google.gwt.dev.jdt.AbstractCompiler.compile(AbstractCompiler.java:632)
        at com.google.gwt.dev.jdt.BasicWebModeCompiler.getCompilationUnitDeclarations(BasicWebModeCompiler.java:124)
        at com.google.gwt.dev.jdt.WebModeCompilerFrontEnd.getCompilationUnitDeclarations(WebModeCompilerFrontEnd.java:54)
        at com.google.gwt.dev.jjs.JavaToJavaScriptCompiler.precompile(JavaToJavaScriptCompiler.java:484)
        at com.google.gwt.dev.jjs.JavaScriptCompiler.precompile(JavaScriptCompiler.java:32)
        at com.google.gwt.dev.Precompile.precompile(Precompile.java:545)
        at com.google.gwt.dev.Precompile.precompile(Precompile.java:466)
        at com.google.gwt.dev.Compiler.run(Compiler.java:205)
        at com.google.gwt.dev.Compiler.run(Compiler.java:177)
        at com.google.gwt.dev.Compiler$1.run(Compiler.java:149)
        at com.google.gwt.dev.CompileTaskRunner.doRun(CompileTaskRunner.java:87)
        at com.google.gwt.dev.CompileTaskRunner.runWithAppropriateLogger(CompileTaskRunner.java:81)
        at com.google.gwt.dev.Compiler.main(Compiler.java:156)

Original issue reported on code.google.com by cowwoc...@gmail.com on 24 Feb 2011 at 4:20

GoogleCodeExporter commented 9 years ago
I see. This makes sense: Gin (used to) require sources and compiled classes for 
(almost) all input types. This is clearly documented in the example build files 
I believe.

Note that in trunk (beyond Gin 1.5) this problem has been fixed, Gin now is 
much more flexible regarding the source/bytecode availability of its input 
types. There are however still some bugs and backwards-incompatibilities in 
this new version that we're working on which is why it's not ready for prime 
time. I will mark this bug as fixed though since it doesn't exist in trunk 
anymore.

Original comment by aragos on 24 Feb 2011 at 8:20