Re: [picocontainer-dev] Ambiguity resolution?

Konstantin Priblouda <kpriblouda-/[email protected]>
Newsgroups gmane.comp.java.picocontainer.devel
Message-ID <[email protected]>
--- Jörg Schaible <[email protected]> wrote:

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

This is a test FOR trunk (kind of additional test to 
demonstrate unclear behavour) - just copypaste it
to DPCT

> It is common
> practice to generate a child container with
> "overlaoded" components. If you
> want a collection of Integers this is something
> completely different.

Yes, but in this case child integer is not masking
parent - it got different key. So IMHO this shall
produce ambiguity. 

regards,

----[ Konstantin Pribluda http://www.pribluda.de ]----------------
JTec quality components: http://www.pribluda.de/projects/


      ____________________________________________________________________________________
Never miss a thing.  Make Yahoo your home page. 
http://www.yahoo.com/r/hs

---------------------------------------------------------------------
To unsubscribe from this list please visit:

    http://xircles.codehaus.org/manage_email
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.