google-code-export / google-guice

Automatically exported from code.google.com/p/google-guice
Apache License 2.0
2 stars 1 forks source link

Exception when overriding a binding to an instance #410

Open GoogleCodeExporter opened 9 years ago

GoogleCodeExporter commented 9 years ago
Looks like a problem in the rewritten ModuleWriter in the snapshot release.

1) No implementation for
com.google.inject.testing.guiceberry.controllable.ProvisionInterceptor
was bound.
 while locating
com.google.inject.Provider<com.google.inject.testing.guiceberry.controllable.Pro
visionIntercepto
r>
   for parameter 0 at
com.google.inject.testing.guiceberry.controllable.InterceptingBindingsBuilder$In
terceptingProvid
er.initialize(InterceptingBindingsBuilder.java:212)
 at 
com.google.inject.testing.guiceberry.controllable.InterceptingBindingsBuilder$In
terceptingProvid
er.initialize(InterceptingBindingsBuilder.java:212)
 at 
com.google.inject.testing.guiceberry.controllable.InterceptingBindingsBuilder$Mo
duleRewriter.vis
it(InterceptingBindingsBuilder.java:184)

2) No implementation for
com.google.launch.lce.domain.attribute.AttributeManager was bound.
 while locating com.google.launch.lce.domain.attribute.AttributeManager
   for parameter 3 at
com.google.launch.lce.ProtoLaunchAttributeManager.<init>(ProtoLaunchAttributeMan
ager.java:6
6)
 at com.google.launch.lce.LaunchCalModule.configure(LaunchCalModule.java:144)

3) No implementation for java.io.InputStream annotated with
@com.google.launch.lce.ProtoLaunchAttributeManager$AttributesConfigFilename()
was bound.
 while locating java.io.InputStream annotated with
@com.google.launch.lce.ProtoLaunchAttributeManager$AttributesConfigFilename()
   for parameter 0 at
com.google.launch.lce.ProtoLaunchAttributeManager.<init>(ProtoLaunchAttributeMan
ager.java:6
6)
 at com.google.launch.lce.LaunchCalModule.configure(LaunchCalModule.java:144)

4) An exception was caught and reported. Message: null
 at com.google.inject.internal.InjectorShell$Builder.build(InjectorShell.java:127)

4 errors
       at com.google.inject.internal.Errors.throwCreationExceptionIfErrorsExist(Errors.java:376)
       at com.google.inject.internal.InjectorBuilder.initializeStatically(InjectorBuilder.java:153)
       at com.google.inject.internal.InjectorBuilder.build(InjectorBuilder.java:106)
       at com.google.inject.Guice.createInjector(Guice.java:93)
       at com.google.inject.Guice.createInjector(Guice.java:70)
       at com.google.launch.lce.LCEServer.go(LCEServer.java:232)
       at 
com.google.launch.lce.testing.LaunchCalServerStarter.startServer(LaunchCalServer
Starter.java:10
9)
       at 
com.google.launch.lce.testing.InMemoryMegastoreLaunchCalGuiceBerryEnv$GbeMain.ru
n(InMem
oryMegastoreLaunchCalGuiceBerryEnv.java:77)
       at 
com.google.inject.testing.guiceberry.junit3.GuiceBerryJunit3.callGbeMainIfBound(
GuiceBerryJunit
3.java:420)
       at 
com.google.inject.testing.guiceberry.junit3.GuiceBerryJunit3.foundGbeForTheFirst
Time(GuiceBerr
yJunit3.java:392)
       at 
com.google.inject.testing.guiceberry.junit3.GuiceBerryJunit3.getInjector(GuiceBe
rryJunit3.java:27
1)
       at 
com.google.inject.testing.guiceberry.junit3.GuiceBerryJunit3.doSetUp(GuiceBerryJ
unit3.java:250)
       at 
com.google.inject.testing.guiceberry.junit3.GuiceBerryJunit3.goSetUp(GuiceBerryJ
unit3.java:169)
       at 
com.google.inject.testing.guiceberry.junit3.GuiceBerryJunit3.setUp(GuiceBerryJun
it3.java:154)
       at com.google.launch.lce.StartAServerTest.setUp(StartAServerTest.java:34)
       at 
com.google.common.testing.junit3.TearDownTestCase.runBare(TearDownTestCase.java:
105)
       at junit.framework.TestResult$1.protect(TestResult.java:106)
       at junit.framework.TestResult.runProtected(TestResult.java:124)
       at junit.framework.TestResult.run(TestResult.java:109)
       at junit.framework.TestCase.run(TestCase.java:118)
       at junit.framework.TestSuite.runTest(TestSuite.java:208)
       at junit.framework.TestSuite.run(TestSuite.java:203)
       at 
org.eclipse.jdt.internal.junit.runner.junit3.JUnit3TestReference.run(JUnit3TestR
eference.java:130)
       at org.eclipse.jdt.internal.junit.runner.TestExecution.run(TestExecution.java:38)
       at 
org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner
.java:467)
       at 
org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner
.java:683)
       at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.run(RemoteTestRunner.java:390)
       at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.main(RemoteTestRunner.java:197)
Caused by: java.lang.NullPointerException
       at 
com.google.inject.testing.guiceberry.controllable.ModuleWriter$2.visitEagerSingl
eton(ModuleWrit
er.java:96)
       at 
com.google.inject.testing.guiceberry.controllable.ModuleWriter$2.visitEagerSingl
eton(ModuleWrit
er.java:94)
       at com.google.inject.internal.Scoping$4.acceptVisitor(Scoping.java:97)
       at com.google.inject.internal.BindingImpl.acceptScopingVisitor(BindingImpl.java:96)
       at 
com.google.inject.testing.guiceberry.controllable.ModuleWriter.applyScoping(Modu
leWriter.java:9
4)
       at 
com.google.inject.testing.guiceberry.controllable.InterceptingBindingsBuilder$Mo
duleRewriter.vis
it(InterceptingBindingsBuilder.java:191)
       at 
com.google.inject.testing.guiceberry.controllable.InterceptingBindingsBuilder$Mo
duleRewriter.vis
it(InterceptingBindingsBuilder.java:159)
       at com.google.inject.internal.BindingImpl.acceptVisitor(BindingImpl.java:92)
       at 
com.google.inject.testing.guiceberry.controllable.ModuleWriter.writeAll(ModuleWr
iter.java:54)
       at 
com.google.inject.testing.guiceberry.controllable.InterceptingBindingsBuilder$2.
configure(Interce
ptingBindingsBuilder.java:143)
       at com.google.inject.spi.Elements$RecordingBinder.install(Elements.java:223)
       at com.google.inject.spi.Elements.getElements(Elements.java:101)
       at com.google.inject.internal.InjectorShell$Builder.build(InjectorShell.java:127)
       at com.google.inject.internal.InjectorBuilder.build(InjectorBuilder.java:103)
       ... 25 more

Original issue reported on code.google.com by limpbizkit on 10 Aug 2009 at 6:48

GoogleCodeExporter commented 9 years ago
Can't reproduce, and OverrideModuleTest has a lot of toInstance bindings being 
overridden.  It looks like this stack trace is showing an NPE inside a custom 
ModuleWriter class, not in Guice's.

Original comment by sberlin on 22 Oct 2010 at 12:53