Details
-
Type: Wish
-
Status: Open
-
Priority: Major
-
Resolution: Unresolved
-
Affects Version/s: 3.0
-
Fix Version/s: 3.0
-
Component/s: None
-
Labels:None
-
Testcase included:yes
-
Number of attachments :
Description
All references to java.lang.Class for use for a key and implementation should be changed to Type so we can differentiate between:
List<String>
and
List<Integer>
as constructor arguments.
Test Case:
/** * Sample class that demonstrates literal collection handling. */ public static class Searcher { private final List<String> searchPath; public Searcher(List<String> searchPath) { this.searchPath = searchPath; } public List<String> getSearchPath() { return searchPath; } } /** * @todo Revisit this for Pico 3. */ @Test public void canInstantiateAutowiredCollectionThatAreDefinedImplicitly() { MutablePicoContainer pico = new DefaultPicoContainer(new Caching()); List<String> searchPath = new ArrayList<String>(); searchPath.add("a"); searchPath.add("b"); List<Integer> conflictingList = new ArrayList<Integer>(); conflictingList.add(1); conflictingList.add(2); pico.addComponent("conflict", conflictingList); pico.addComponent("searchPath",searchPath) .addComponent(Searcher.class); assertNotNull(pico.getComponent(Searcher.class)); assertNotNull(pico.getComponent(Searcher.class).getSearchPath()); }
Issue Links
- relates to
-
PICO-322 Cannot instantiate objects that have an specific collection in their constructor.
Linked to initial discussion of this feature