Re: [picocontainer-dev] Ambiguity resolution?
Jörg Schaible <[email protected]>
| Newsgroups | gmane.comp.java.picocontainer.devel |
|---|---|
| Message-ID | <[email protected]> |
Konstantin Priblouda wrote:
> Hi all,
>
> I'm bit of confused in ambiguity resolution.
> Well, if components ( integers ) are on the
> same level there is ambiguity. But not if they
> are on different levels. IMHO, NeedsTwo shall not be
> resolved in this case - "bar" does not mask "foo", and
> will be returned too if asked for collection of
> integers.
>
> Here is testcase ( in DPCT ):
>
>
> public void testThatAmbiguityIsResolvedProperly()
> {
> MutablePicoContainer parent =
> createPicoContainer(null);
> MutablePicoContainer child =
> createPicoContainer(parent);
>
> parent.addComponent("foo",new Integer(239));
> child.addComponent("bar",new Integer(555));
> child.addComponent(NeedsTwo.class);
> assertEquals(new
> Integer(555),child.getComponent(Integer.class));
>
>
assertEquals("bar",child.getComponentAdapter(Integer.class,null).getComponentKey());
>
> assertNotNull(child.getComponent(NeedsTwo.class));
> }
>
>
> WDYT?
??? I don't find that test in trunk, but this must be resolved. It is common
practice to generate a child container with "overlaoded" components. If you
want a collection of Integers this is something completely different.
- Jörg
---------------------------------------------------------------------
To unsubscribe from this list please visit:
http://xircles.codehaus.org/manage_email