Re: [picocontainer-dev] Specify a zero arg constructor?
Konstantin Priblouda <kpriblouda-/[email protected]>
| Newsgroups | gmane.comp.java.picocontainer.devel |
|---|---|
| Message-ID | <[email protected]> |
--- Michael Rimov <[email protected]> wrote: > Hi All, > > I've got an issue with the following code: > > MutablePicoContainer pico = new > DefaultPicoContainer(); > pico.addComponent(ArrayList.class, > ArrayList.class); > pico.addComponent(HashSet.class); > > assertNotNull(pico.getComponent(ArrayList.class)); > //Error! > > The following claims a circular dependency > exception... simple enough.... > because ArrayList can have a ArrayList(Collection) > constructor. > > Great.... now how can we specify the simple: new > ArrayList() no arg > constructor? > > In the past, we could: > > pico.addComponent(ArrayList.class, > ArrayList.class, new Parameter[0]{}); > > But that doesn't appear to be working. (I assume > because of the variable arg > constructors, it becomes impossible to tell if there > was no parameter passed in, > or an empty array) Well, that was area of my refactoring attempts ;) Look at the statics - there was Parameter.EMPTY or ComponentParameter.EMPTY Vararg constructor is pretty different from default - it accepts array of something. regards, ----[ Konstantin Pribluda http://www.pribluda.de ]---------------- JTec quality components: http://www.pribluda.de/projects/ ____________________________________________________________________________________ Be a better friend, newshound, and know-it-all with Yahoo! Mobile. Try it now. http://mobile.yahoo.com/;_ylt=Ahu06i62sR8HDtDypao8Wcj9tAcJ --------------------------------------------------------------------- To unsubscribe from this list please visit: http://xircles.codehaus.org/manage_email