bineanzhou / google-guice

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

Instances and providers must be bound in dependency order #178

Open GoogleCodeExporter opened 9 years ago

GoogleCodeExporter commented 9 years ago
Instances and providers bound with
LinkedBindingBuilder<T>.toInstance(T)/toProvider(Provider<? extends T>)
must be bound in dependency order.

Because BinderImpl.createInjector injects the members of these instances
and providers in binding order, if an earlier-bound instance/provider A
depends transitively on a later-bound instance/provider B, B may be used
before it has been injected, which may cause a NullPointerException or
other exception.

Is it possible for the binder to determine a dependency graph and then
automatically order the instances/providers whose members it injects? If
not, this dependency-order constraint should be documented.

This is related to, but different from, issue 166.

I've attached a failing test.

Original issue reported on code.google.com by net...@gmail.com on 4 Feb 2008 at 5:56

Attachments:

GoogleCodeExporter commented 9 years ago
Also similar to issue 174 - that bug applies at Injector creation time.

Original comment by limpbizkit on 4 Feb 2008 at 7:05

GoogleCodeExporter commented 9 years ago

Original comment by limpbizkit on 5 Jun 2008 at 7:57