Details
-
Type: Improvement
-
Status: Closed
-
Priority: Major
-
Resolution: Fixed
-
Affects Version/s: None
-
Fix Version/s: 1.2
-
Component/s: None
-
Labels:None
-
Number of attachments :
Description
The dependency resolution should never take into account a (cyclic) self dependency. Parameter already suppots this, but not the Pico interface itself. The xxxOfType methods have an additional parameter to exclude self.
public void testUnambiguousSelfDependency()
{ MutablePicoContainer pico = createPicoContainer(null); pico.registerComponentImplementation(SimpleTouchable.class); pico.registerComponentImplementation(DecoratedTouchable.class); Touchable t = (Touchable) pico.getComponentInstance(DecoratedTouchable.class); assertNotNull(t); }Activity
Konstantin Pribluda
made changes -
Field | Original Value | New Value |
---|---|---|
Assignee | Konstantin Pribluda [ ko5tik ] |
Konstantin Pribluda
made changes -
Fix Version/s | 1.2 [ 11330 ] | |
Status | Open [ 1 ] | Closed [ 6 ] |
Resolution | Fixed [ 1 ] |
Similar case for Aslak:
When pico tries to instantiate ArrayList, it will attempt to use the constructor that takes a java.util.Collection. Since both the ArrayList and LinkedList are Collection, it will fail with AmbiguousComponentResolutionException.
Pico should be smart enough to figure out that it shouldn't consider a component as a candidate parameter for its own instantiation.
public void TODOtestComponentsWithCommonSupertypeWhichIsAConstructorArgumentCanBeLookedUpByConcreteType()
{ MutablePicoContainer pico = createPicoContainer(null); pico.registerComponentImplementation(LinkedList.class); pico.registerComponentImplementation(ArrayList.class); assertEquals(ArrayList.class, pico.getComponentInstanceOfType(ArrayList.class).getClass()); }