History | Log In     View a printable version of the current page.  
Issue Details (XML | Word | Printable)

Key: PICO-201
Type: Bug Bug
Status: Closed Closed
Resolution: Fixed
Priority: Major Major
Assignee: Joerg Schaible
Reporter: Scott Farquhar
Votes: 0
Watchers: 0
Operations

If you were logged in you would be able to see more operations.
PicoContainer

PicoContainer finds the greediest constructor, even if it is protected or private

Created: 29/Jul/04 10:15 PM   Updated: 19/Aug/04 10:02 AM
Component/s: PicoContainer (Java)
Affects Version/s: 1.0
Fix Version/s: 1.1

Time Tracking:
Not Specified

Issue Links:
Duplicate
 


 Description  « Hide
Currently we have a class that has protected constructors (used mostly for testing purposes), however, Pico tries to instantiate that object using those constructors, instead of the less greedy (but still public) other constructors.

A work around it to register it with params to indicate to use the noarg constructor:

internalContainer.registerComponentImplementation(
UpgradeManager.class,
UpgradeManagerImpl.class,
Collections.EMPTY_LIST);

The problem appears to be that ConstructorInjectionComponentAdapter.getGreediestSatisifableConstructor() can return a constructor which then barfs in InstantiatingComponentAdapter.newInstance().

I think that this could be solved by making allowNonPublicClasses protected in InstantiatingComponentAdapter ?

On another note - is Satisifable the correct spelling?



 All   Comments   Work Log   Change History      Sort Order: Ascending order - Click to sort in descending order
Joerg Schaible - 30/Jul/04 03:05 AM
Hi Scott,

I fixed it in your proposed way setting "allowNonPublicClasses" to protected and using it in CICA.

Regards,
Jörg


Joerg Schaible - 19/Aug/04 10:02 AM
Already fixed.