bineanzhou / google-guice

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

Scope is ignored depending on binding order #182

Open GoogleCodeExporter opened 9 years ago

GoogleCodeExporter commented 9 years ago
I added a simplistic example:
If a class A aggregates some instances B that depend on C,
C is treated as unscoped (though it was scoped) when C is bound later than 
A.

Not a circular dependency (#15); maybe related to (#166).

Bye,
Oliver

Original issue reported on code.google.com by oliver.b...@googlemail.com on 18 Feb 2008 at 9:28

Attachments:

GoogleCodeExporter commented 9 years ago
refinement: in example above C is actually treated as unbound.

Original comment by oliver.b...@googlemail.com on 18 Feb 2008 at 9:42

GoogleCodeExporter commented 9 years ago
Found a possible answer/solution to the problem:
In the example above when binding for A and B is built that for C has not been 
created.
In the current version of InjectorImpl then the Scope of B is used for 
constructing 
a jit-binding. This is probably a bug. Instead, (probably) it should try to 
resolve 
the scope of Key<C> - and only on fail use noscope.

Added a diff file.

Bye,
oliver

Original comment by oliver.b...@googlemail.com on 19 Feb 2008 at 12:58

Attachments:

GoogleCodeExporter commented 9 years ago
Dupe of 166 which has since been fixed.

Original comment by limpbizkit on 14 May 2008 at 3:33