Comment #9 on issue 220 by [email protected]: Formalize semantics of circular-dependency proxies
http://code.google.com/p/google-guice/issues/detail?id=220

Would it not be possible to break injection into two phases, as Bob points out in comment#4?

Comment#3 states: "Injecting constructors and members in a different stage might be a good way to solve the technical issue with circular dependencies, but I do think it would break a lot of apps. In my Factory days I used to return instances that were fully configured, setters included. Not having these values when constructing other objects could be annoying."

This is not a correct assessment, as I understand it: If some object A /depends/ on both constructor AND setters having been run on object B when A gets B (when A is being constructed or some setter run), then Guice will break that app as it is now: This because the dependencies that B have gotten /might/ have been proxies that aren't "filled" yet (or it might not, you just never know).

It should be pretty simple to construct a graph of which objects should be constructed in which order (first the ones w/o anything in the constructor, then the ones only taking from this pool, then ..). If it is not possible to do this construction w/o proxies, then fail. Then afterwards, do the setting.

--
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.

Reply via email to