Status: Accepted
Owner: ----
CC: sberlin, limpbizkit
New issue 568 by drew.mclaughlin: Target of LinkedBinding Treated as JIT
When Scoped
http://code.google.com/p/google-guice/issues/detail?id=568
It's not possible to create an Injector using
InjectorBuilder.requireExplicitBindings() if there are any scoped
LinkedBindings that have a scoped target (implicitly via annotation).
Failing test attached.
The problem is due to the fact that the underling InternalFactory
(FactoryProxy) is wrapped in a ProviderToInternalFactoryAdapter (convert
InternalFactory->Provider), then in a InternalFactoryToProviderAdapter
(convert Provider->InternalFactory). This is necessary because the Scope
instance requires a Provider. The key to the bug is that the 'boolean
linked' parameter from InternalFactory.get(...) is not passed through
these conversions to call to the InternalFactory that does the real work.
In the test attached this is ConstructorBindingImpl.get(...), and the
failure comes on line 195 when the class asserts that we're dealing with a
linked binding when JIT bindings are disabled.
This can also be reproduced by simply installing a ServletModule:
new InjectorBuilder()
.addModules(new ServletModule())
.requireExplicitBindings()
.build();
Yields the following error:1) Explicit bindings are required and
com.google.inject.servlet.ManagedFilterPipeline is not explicitly bound.
at
com.google.inject.servlet.ManagedFilterPipeline.class(ManagedFilterPipeline.java:57)
while locating com.google.inject.servlet.ManagedFilterPipeline
at
com.google.inject.servlet.InternalServletModule.configure(InternalServletModule.java:36)
while locating com.google.inject.servlet.FilterPipeline
for parameter 0 at
com.google.inject.servlet.GuiceFilter.setPipeline(GuiceFilter.java:92)
Attachments:
LinkednessLostWhenTargetIsScopedTest.java 643 bytes
--
You received this message because you are subscribed to the Google Groups
"google-guice-dev" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to
[email protected].
For more options, visit this group at
http://groups.google.com/group/google-guice-dev?hl=en.