-
Notifications
You must be signed in to change notification settings - Fork 89
Circular Reference issue with Swift Suspenders #11
Comments
Same problem for me : |
That's actually a different problem not related to what this ticket is about. Without having any source code, I can't be sure, but my guess would be that the specific bug you're running into has been fixed in the 1.5b1 release (and maybe even in the 1.0.1 release). Can you add the SWC from the latest zip distribution to your projects and check if the problem is resolved by that? |
vote for this bug, any work around for this btw? i'm feeling dead here |
Having thought about it for quite some time, I don't think there's any feasible way to fix this. The thing is that circular dependencies are just inherently broken: Both objects need each other to work in a way that the IoC container can't resolve by itself. In theory, a sub-set of cases could in fact be detected and resolved automatically, but I can't come up with a clean and performant implementation of even those. A future version of SwiftSuspenders will support two things that should help to resolve this, though: optional and live injections. With optional injections, the injector doesn't throw if it can't fulfill a dependency, while with live injections, it will update the injectee as soon as the mapped value it expects changes. With these in place, I should be able to not only detect but also resolve cases of mutually recursive dependencies. |
(copied from http://github.com/robotlegs/robotlegs-framework/issues/#issue/1)
There is a circular reference bug if you have singletons that inject eachother.
Trivial example (Flex Builder 3 AS3 project) here: http://www.stevensacks.net/xfer/circbug.zip
And the output:
undefined
at org.swiftsuspenders::Injector/injectInto()[/Users/shaun/Documents/Development/Workspaces/GanymedeFB4/SwiftSuspenders/src/org/swiftsuspenders/Injector.as:120]
at org.swiftsuspenders::Injector/instantiate()[/Users/shaun/Documents/Development/Workspaces/GanymedeFB4/SwiftSuspenders/src/org/swiftsuspenders/Injector.as:134]
at org.swiftsuspenders.injectionresults::InjectSingletonResult/getResponse()[/Users/shaun/Documents/Development/Workspaces/GanymedeFB4/SwiftSuspenders/src/org/swiftsuspenders/injectionresults/InjectSingletonResult.as:59]
at org.swiftsuspenders::InjectionConfig/getResponse()[/Users/shaun/Documents/Development/Workspaces/GanymedeFB4/SwiftSuspenders/src/org/swiftsuspenders/InjectionConfig.as:58]
at org.swiftsuspenders.injectionpoints::PropertyInjectionPoint/applyInjection()[/Users/shaun/Documents/Development/Workspaces/GanymedeFB4/SwiftSuspenders/src/org/swiftsuspenders/injectionpoints/PropertyInjectionPoint.as:47]
at org.swiftsuspenders::Injector/injectInto()[/Users/shaun/Documents/Development/Workspaces/GanymedeFB4/SwiftSuspenders/src/org/swiftsuspenders/Injector.as:120]
at org.swiftsuspenders::Injector/instantiate()[/Users/shaun/Documents/Development/Workspaces/GanymedeFB4/SwiftSuspenders/src/org/swiftsuspenders/Injector.as:134]
at org.swiftsuspenders.injectionresults::InjectSingletonResult/getResponse()[/Users/shaun/Documents/Development/Workspaces/GanymedeFB4/SwiftSuspenders/src/org/swiftsuspenders/injectionresults/InjectSingletonResult.as:59]
at org.swiftsuspenders::InjectionConfig/getResponse()[/Users/shaun/Documents/Development/Workspaces/GanymedeFB4/SwiftSuspenders/src/org/swiftsuspenders/InjectionConfig.as:58]
at org.swiftsuspenders.injectionpoints::PropertyInjectionPoint/applyInjection()[/Users/shaun/Documents/Development/Workspaces/GanymedeFB4/SwiftSuspenders/src/org/swiftsuspenders/injectionpoints/PropertyInjectionPoint.as:47]
at org.swiftsuspenders::Injector/injectInto()[/Users/shaun/Documents/Development/Workspaces/GanymedeFB4/SwiftSuspenders/src/org/swiftsuspenders/Injector.as:120]
at org.swiftsuspenders::Injector/instantiate()[/Users/shaun/Documents/Development/Workspaces/GanymedeFB4/SwiftSuspenders/src/org/swiftsuspenders/Injector.as:134]
at org.swiftsuspenders.injectionresults::InjectSingletonResult/getResponse()[/Users/shaun/Documents/Development/Workspaces/GanymedeFB4/SwiftSuspenders/src/org/swiftsuspenders/injectionresults/InjectSingletonResult.as:59]
at org.swiftsuspenders::InjectionConfig/getResponse()[/Users/shaun/Documents/Development/Workspaces/GanymedeFB4/SwiftSuspenders/src/org/swiftsuspenders/InjectionConfig.as:58]
at org.swiftsuspenders.injectionpoints::PropertyInjectionPoint/applyInjection()[/Users/shaun/Documents/Development/Workspaces/GanymedeFB4/SwiftSuspenders/src/org/swiftsuspenders/injectionpoints/PropertyInjectionPoint.as:47]
at org.swiftsuspenders::Injector/injectInto()[/Users/shaun/Documents/Development/Workspaces/GanymedeFB4/SwiftSuspenders/src/org/swiftsuspenders/Injector.as:120]
at org.swiftsuspenders::Injector/instantiate()[/Users/shaun/Documents/Development/Workspaces/GanymedeFB4/SwiftSuspenders/src/org/swiftsuspenders/Injector.as:134]
at org.swiftsuspenders.injectionresults::InjectSingletonResult/getResponse()[/Users/shaun/Documents/Development/Workspaces/GanymedeFB4/SwiftSuspenders/src/org/swiftsuspenders/injectionresults/InjectSingletonResult.as:59]
at org.swiftsuspenders::InjectionConfig/getResponse()[/Users/shaun/Documents/Development/Workspaces/GanymedeFB4/SwiftSuspenders/src/org/swiftsuspenders/InjectionConfig.as:58]
at org.swiftsuspenders.injectionpoints::PropertyInjectionPoint/applyInjection()[/Users/shaun/Documents/Development/Workspaces/GanymedeFB4/SwiftSuspenders/src/org/swiftsuspenders/injectionpoints/PropertyInjectionPoint.as:47]
at org.swiftsuspenders::Injector/injectInto()[/Users/shaun/Documents/Development/Workspaces/GanymedeFB4/SwiftSuspenders/src/org/swiftsuspenders/Injector.as:120]
at org.swiftsuspenders::Injector/instantiate()[/Users/shaun/Documents/Development/Workspaces/GanymedeFB4/SwiftSuspenders/src/org/swiftsuspenders/Injector.as:134]
at org.swiftsuspenders.injectionresults::InjectSingletonResult/getResponse()[/Users/shaun/Documents/Development/Workspaces/GanymedeFB4/SwiftSuspenders/src/org/swiftsuspenders/injectionresults/InjectSingletonResult.as:59]
at org.swiftsuspenders::InjectionConfig/getResponse()[/Users/shaun/Documents/Development/Workspaces/GanymedeFB4/SwiftSuspenders/src/org/swiftsuspenders/InjectionConfig.as:58]
at org.swiftsuspenders.injectionpoints::PropertyInjectionPoint/applyInjection()[/Users/shaun/Documents/Development/Workspaces/GanymedeFB4/SwiftSuspenders/src/org/swiftsuspenders/injectionpoints/PropertyInjectionPoint.as:47]
at org.swiftsuspenders::Injector/injectInto()[/Users/shaun/Documents/Development/Workspaces/GanymedeFB4/SwiftSuspenders/src/org/swiftsuspenders/Injector.as:120]
at org.swiftsuspenders::Injector/instantiate()[/Users/shaun/Documents/Development/Workspaces/GanymedeFB4/SwiftSuspenders/src/org/swiftsuspenders/Injector.as:134]
at org.swiftsuspenders.injectionresults::InjectSingletonResult/getResponse()[/Users/shaun/Documents/Development/Workspaces/GanymedeFB4/SwiftSuspenders/src/org/swiftsuspenders/injectionresults/InjectSingletonResult.as:59]
at org.swiftsuspenders::InjectionConfig/getResponse()[/Users/shaun/Documents/Development/Workspaces/GanymedeFB4/SwiftSuspenders/src/org/swiftsuspenders/InjectionConfig.as:58]
at org.swiftsuspenders.injectionpoints::PropertyInjectionPoint/applyInjection()[/Users/shaun/Documents/Development/Workspaces/GanymedeFB4/SwiftSuspenders/src/org/swiftsuspenders/injectionpoints/PropertyInjectionPoint.as:47]
at org.swiftsuspenders::Injector/injectInto()[/Users/shaun/Documents/Development/Workspaces/GanymedeFB4/SwiftSuspenders/src/org/swiftsuspenders/Injector.as:120]
at org.swiftsuspenders::Injector/instantiate()[/Users/shaun/Documents/Development/Workspaces/GanymedeFB4/SwiftSuspenders/src/org/swiftsuspenders/Injector.as:134]
at org.swiftsuspenders.injectionresults::InjectSingletonResult/getResponse()[/Users/shaun/Documents/Development/Workspaces/GanymedeFB4/SwiftSuspenders/src/org/swiftsuspenders/injectionresults/InjectSingletonResult.as:59]
at org.swiftsuspenders::InjectionConfig/getResponse()[/Users/shaun/Documents/Development/Workspaces/GanymedeFB4/SwiftSuspenders/src/org/swiftsuspenders/InjectionConfig.as:58]
at org.swiftsuspenders.injectionpoints::PropertyInjectionPoint/applyInjection()[/Users/shaun/Documents/Development/Workspaces/GanymedeFB4/SwiftSuspenders/src/org/swiftsuspenders/injectionpoints/PropertyInjectionPoint.as:47]
at org.swiftsuspenders::Injector/injectInto()[/Users/shaun/Documents/Development/Workspaces/GanymedeFB4/SwiftSuspenders/src/org/swiftsuspenders/Injector.as:120]
at org.swiftsuspenders::Injector/instantiate()[/Users/shaun/Documents/Development/Workspaces/GanymedeFB4/SwiftSuspenders/src/org/swiftsuspenders/Injector.as:134]
at org.swiftsuspenders.injectionresults::InjectSingletonResult/getResponse()[/Users/shaun/Documents/Development/Workspaces/GanymedeFB4/SwiftSuspenders/src/org/swiftsuspenders/injectionresults/InjectSingletonResult.as:59]
at org.swiftsuspenders::InjectionConfig/getResponse()[/Users/shaun/Documents/Development/Workspaces/GanymedeFB4/SwiftSuspenders/src/org/swiftsuspenders/InjectionConfig.as:58]
at org.swiftsuspenders.injectionpoints::PropertyInjectionPoint/applyInjection()[/Users/shaun/Documents/Development/Workspaces/GanymedeFB4/SwiftSuspenders/src/org/swiftsuspenders/injectionpoints/PropertyInjectionPoint.as:47]
at org.swiftsuspenders::Injector/injectInto()[/Users/shaun/Documents/Development/Workspaces/GanymedeFB4/SwiftSuspenders/src/org/swiftsuspenders/Injector.as:120]
at org.swiftsuspenders::Injector/instantiate()[/Users/shaun/Documents/Development/Workspaces/GanymedeFB4/SwiftSuspenders/src/org/swiftsuspenders/Injector.as:134]
at org.swiftsuspenders.injectionresults::InjectSingletonResult/getResponse()[/Users/shaun/Documents/Development/Workspaces/GanymedeFB4/SwiftSuspenders/src/org/swiftsuspenders/injectionresults/InjectSingletonResult.as:59]
at org.swiftsuspenders::InjectionConfig/getResponse()[/Users/shaun/Documents/Development/Workspaces/GanymedeFB4/SwiftSuspenders/src/org/swiftsuspenders/InjectionConfig.as:58]
at org.swiftsuspenders.injectionpoints::PropertyInjectionPoint/applyInjection()[/Users/shaun/Documents/Development/Workspaces/GanymedeFB4/SwiftSuspenders/src/org/swiftsuspenders/injectionpoints/PropertyInjectionPoint.as:47]
at org.swiftsuspenders::Injector/injectInto()[/Users/shaun/Documents/Development/Workspaces/GanymedeFB4/SwiftSuspenders/src/org/swiftsuspenders/Injector.as:120]
at org.swiftsuspenders::Injector/instantiate()[/Users/shaun/Documents/Development/Workspaces/GanymedeFB4/SwiftSuspenders/src/org/swiftsuspenders/Injector.as:134]
at org.swiftsuspenders.injectionresults::InjectSingletonResult/getResponse()[/Users/shaun/Documents/Development/Workspaces/GanymedeFB4/SwiftSuspenders/src/org/swiftsuspenders/injectionresults/InjectSingletonResult.as:59]
at org.swiftsuspenders::InjectionConfig/getResponse()[/Users/shaun/Documents/Development/Workspaces/GanymedeFB4/SwiftSuspenders/src/org/swiftsuspenders/InjectionConfig.as:58]
at org.swiftsuspenders.injectionpoints::PropertyInjectionPoint/applyInjection()[/Users/shaun/Documents/Development/Workspaces/GanymedeFB4/SwiftSuspenders/src/org/swiftsuspenders/injectionpoints/PropertyInjectionPoint.as:47]
at org.swiftsuspenders::Injector/injectInto()[/Users/shaun/Documents/Development/Workspaces/GanymedeFB4/SwiftSuspenders/src/org/swiftsuspenders/Injector.as:120]
at org.swiftsuspenders::Injector/instantiate()[/Users/shaun/Documents/Development/Workspaces/GanymedeFB4/SwiftSuspenders/src/org/swiftsuspenders/Injector.as:134]
at org.swiftsuspenders.injectionresults::InjectSingletonResult/getResponse()[/Users/shaun/Documents/Development/Workspaces/GanymedeFB4/SwiftSuspenders/src/org/swiftsuspenders/injectionresults/InjectSingletonResult.as:59]
at org.swiftsuspenders::InjectionConfig/getResponse()[/Users/shaun/Documents/Development/Workspaces/GanymedeFB4/SwiftSuspenders/src/org/swiftsuspenders/InjectionConfig.as:58]
at org.swiftsuspenders.injectionpoints::PropertyInjectionPoint/applyInjection()[/Users/shaun/Documents/Development/Workspaces/GanymedeFB4/SwiftSuspenders/src/org/swiftsuspenders/injectionpoints/PropertyInjectionPoint.as:47]
at org.swiftsuspenders::Injector/injectInto()[/Users/shaun/Documents/Development/Workspaces/GanymedeFB4/SwiftSuspenders/src/org/swiftsuspenders/Injector.as:120]
at org.swiftsuspenders::Injector/instantiate()[/Users/shaun/Documents/Development/Workspaces/GanymedeFB4/SwiftSuspenders/src/org/swiftsuspenders/Injector.as:134]
at org.swiftsuspenders.injectionresults::InjectSingletonResult/getResponse()[/Users/shaun/Documents/Development/Workspaces/GanymedeFB4/SwiftSuspenders/src/org/swiftsuspenders/injectionresults/InjectSingletonResult.as:59]
at org.swiftsuspenders::InjectionConfig/getResponse()[/Users/shaun/Documents/Development/Workspaces/GanymedeFB4/SwiftSuspenders/src/org/swiftsuspenders/InjectionConfig.as:58]
at org.swiftsuspenders.injectionpoints::PropertyInjectionPoint/applyInjection()[/Users/shaun/Documents/Development/Workspaces/GanymedeFB4/SwiftSuspenders/src/org/swiftsuspenders/injectionpoints/PropertyInjectionPoint.as:47]
at org.swiftsuspenders::Injector/injectInto()[/Users/shaun/Documents/Development/Workspaces/GanymedeFB4/SwiftSuspenders/src/org/swiftsuspenders/Injector.as:120]
at org.swiftsuspenders::Injector/instantiate()[/Users/shaun/Documents/Development/Workspaces/GanymedeFB4/SwiftSuspenders/src/org/swiftsuspenders/Injector.as:134]
at org.swiftsuspenders.injectionresults::InjectSingletonResult/getResponse()[/Users/shaun/Documents/Development/Workspaces/GanymedeFB4/SwiftSuspenders/src/org/swiftsuspenders/injectionresults/InjectSingletonResult.as:59]
at org.swiftsuspenders::InjectionConfig/getResponse()[/Users/shaun/Documents/Development/Workspaces/GanymedeFB4/SwiftSuspenders/src/org/swiftsuspenders/InjectionConfig.as:58]
The text was updated successfully, but these errors were encountered: