Details
-
Type: Bug
-
Status: Closed
-
Priority: Major
-
Resolution: Fixed
-
Affects Version/s: 1.0-beta-5
-
Fix Version/s: 1.0-beta-4
-
Component/s: PicoContainer (Java)
-
Labels:None
-
Number of attachments :
Description
Since the getComponentInstance() from mplementationHidingComponentAdapter verifies if a proxy was already created and returns it, a TransiendComponentAdapter will not be able to create a new component instance.
uploading a patch for the test case
Activity
Paulo Silveira
made changes -
Field | Original Value | New Value |
---|---|---|
Attachment | patch.txt [ 11041 ] |
Aslak Hellesøy
made changes -
Assignee | Aslak Hellesoy [ rinkrank ] |
Aslak Hellesøy
made changes -
Fix Version/s | 1.0 [ 10145 ] |
Aslak Hellesøy
made changes -
Resolution | Fixed [ 1 ] | |
Status | Open [ 1 ] | Closed [ 6 ] |
Aslak Hellesøy
made changes -
Resolution | Fixed [ 1 ] | |
Status | Closed [ 6 ] | Reopened [ 4 ] |
Aslak Hellesøy
made changes -
Fix Version/s | 1.0 [ 10145 ] | |
Fix Version/s | 1.0-beta-4 [ 10412 ] | |
Resolution | Fixed [ 1 ] | |
Status | Reopened [ 4 ] | Closed [ 6 ] |
The simple test is
public void testBigamy()
{ DefaultPicoContainer pico = new DefaultPicoContainer(new ImplementationHidingComponentAdapterFactory( new TransientComponentAdapterFactory())); pico.registerComponentImplementation(Woman.class, Wife.class); Woman firstWife = (Woman) pico.getComponentInstance(Woman.class); Woman secondWife = (Woman) pico.getComponentInstance(Woman.class); assertNotSame(firstWife, secondWife); }And it should give to us different proxy instances, since the delegateAdapter is a Transient one.
Moreover, I think that this code should throw an exception, since I did not registered a component to act as the Man. How can pico instantiate a Wife? The proxy lazy instatiates a Wife, then the NoSatisfiableConstructorsException is only thrown after the first call!