Details
-
Type:
Bug
-
Status:
Closed
-
Priority:
Major
-
Resolution: Fixed
-
Affects Version/s: 1.0
-
Fix Version/s: 1.1
-
Component/s: PicoContainer (Java)
-
Labels:None
-
Number of attachments :
Description
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?
Issue Links
- is duplicated by
-
PICO-205 greedy non-public constructors are prefered over public constructors leading to IllegalAccessExceptions [patch]
-
Activity

Field | Original Value | New Value |
---|---|---|
Assignee | Joerg Schaible [ joehni ] |

Fix Version/s | 1.1 [ 10307 ] | |
Status | Open [ 1 ] | Closed [ 6 ] |
Resolution | Fixed [ 1 ] |

Hi Scott,
I fixed it in your proposed way setting "allowNonPublicClasses" to protected and using it in CICA.
Regards,
Jörg