Details
-
Type: Improvement
-
Status: Resolved
-
Priority: Major
-
Resolution: Fixed
-
Affects Version/s: None
-
Fix Version/s: 3.0
-
Component/s: PicoContainer (Java)
-
Labels:None
-
Environment:Affects 2.12, which is not available here.
-
Patch Submitted:Yes
-
Number of attachments :
Description
I want to support a legacy lifecycle pattern in our code where we only have one init() method, no stop/dispose methods. Ideally I guess I should be able to use this lifecycle strategy:
new ReflectionLifecycleStrategy(componentMonitor, "init", null, null)
but this fails miserably with NPEs in java.lang.Class.
The attached patch allows this, thus keeping me from having to do
new ReflectionLifecycleStrategy(componentMonitor, "init", "some-really-stupid-method-name-that-won't-exist", "some-really-stupid-method-name-that-won't-exist-either")
I made a test case for Pico-3 code base to prove that the fix did indeed provide the feature Grégory requested. From the looks of it, it should apply as-is for Pico 2.