[picocontainer-dev] Bug or feature?
Konstantin Priblouda <kpriblouda-/[email protected]>
| Newsgroups | gmane.comp.java.picocontainer.devel |
|---|---|
| Message-ID | <[email protected]> |
Hi all,
while refactoring I discovered 2 potential bugs in
trunk
( parent / child resolution, resolution by type )
So questions are:
- Shall class-typed key prevent resolution by that
type? ( currently it does , but this is discutable )
- Shall key in child prevent resolution of params in
parent container ( for me it's clear bug )
To demonstrate just copy/paste following into
DPTTestCase:
--------------%<--------------------
/**
* while resolving component by type, only
components
* of those type shall be retuned.
*
*/
public void testThatByTypeResolutionIsHonored() {
MutablePicoContainer container =
createPicoContainer(null);
container.addComponent(Map.class,MyStartable.class);
container.addComponent("glumBlam",HashMap.class);
assertSame(container.getComponent("glumBlam"),container.getComponent(Map.class));
}
/**
* no key in child container shall affect param
* resolution in parent
*/
public void
testChildKeyDoesNotAffectParentResolution() {
MutablePicoContainer parent =
createPicoContainer(null);
MutablePicoContainer child =
createPicoContainer(parent);
parent.addComponent(ComponentA.class);
parent.addComponent(ComponentB.class);
parent.addComponent(ComponentC.class);
child.addAdapter(new
InstanceAdapter<String>(ComponentC.class,new
String("scheisse....")));
assertNotNull(child.getComponent(ComponentA.class));
}
-----------------------%<--------------------
WDYT?
regards,
----[ Konstantin Pribluda http://www.pribluda.de ]----------------
JTec quality components: http://www.pribluda.de/projects/
____________________________________________________________________________________
Be a better pen pal.
Text or chat with friends inside Yahoo! Mail. See how. http://overview.mail.yahoo.com/
---------------------------------------------------------------------
To unsubscribe from this list please visit:
http://xircles.codehaus.org/manage_email