PicoContainer
  1. PicoContainer
  2. PICO-212

ImplementationHidingPC does not respect CAF

    Details

    • Type: Bug Bug
    • Status: Closed Closed
    • Priority: Major Major
    • Resolution: Fixed
    • Affects Version/s: 1.1
    • Fix Version/s: 1.2
    • Component/s: PicoContainer (Java)
    • Labels:
      None
    • Number of attachments :
      0

      Description

      The ImplementationHidingPC does not respect the special functionality of the used ComponentAdapterFactory, since it is caching its components in certain cases, that even might break the functionality (e.g. ThreadLocalCAF).

      Test case:

      public void testUsageOfADifferentComponentAdapterFactory()

      { MutablePicoContainer parent = new DefaultPicoContainer(); ImplementationHidingPicoContainer pico = new ImplementationHidingPicoContainer(new ConstructorInjectionComponentAdapterFactory(), parent); pico.registerComponentImplementation(List.class, ArrayList.class); List list1 = (List) pico.getComponentInstanceOfType(List.class); List list2 = (List) pico.getComponentInstanceOfType(List.class); assertNotNull(list1); assertNotNull(list2); assertFalse(list1 == list2); }

        Activity

        Jörg Schaible made changes -
        Field Original Value New Value
        Assignee Paul Hammant [ paul ]
        Hide
        Jörg Schaible added a comment -

        Paul, you know, why you've added the special code ...

        Show
        Jörg Schaible added a comment - Paul, you know, why you've added the special code ...
        Hide
        Paul Hammant added a comment -

        I didn;t add it persoanlly. It was refactored to its current position.

        I'll take this and fix as per intent.

        However, the reason I /got/ /involved/ /with/ PicoContainer et al was to see a simple modern-day CDI version of Phoenix that was embeddable. Phoenix had impl hiding built in. And component caching.

        Pico delivers new things in that it is very usable for object instantiation (with aspects of dependency resolution), not just component management in the server sense that I am questing for.

        Show
        Paul Hammant added a comment - I didn;t add it persoanlly. It was refactored to its current position. I'll take this and fix as per intent. However, the reason I /got/ /involved/ /with/ PicoContainer et al was to see a simple modern-day CDI version of Phoenix that was embeddable. Phoenix had impl hiding built in. And component caching. Pico delivers new things in that it is very usable for object instantiation (with aspects of dependency resolution), not just component management in the server sense that I am questing for.
        Jörg Schaible made changes -
        Fix Version/s 1.2 [ 11330 ]
        Environment
        Jörg Schaible made changes -
        Assignee Paul Hammant [ paul ] Joerg Schaible [ joehni ]
        Hide
        Jörg Schaible added a comment -

        IMHO it is not valid for a DelegatingPC to have its own CAF at all. The components have been registered with a special intent and possibly even with a special CA. This must be respected. The current design will break ThreadLocalCA, EJBClientCA, PoolingCA, HotSwappingCA, ...

        Show
        Jörg Schaible added a comment - IMHO it is not valid for a DelegatingPC to have its own CAF at all. The components have been registered with a special intent and possibly even with a special CA. This must be respected. The current design will break ThreadLocalCA, EJBClientCA, PoolingCA, HotSwappingCA, ...
        Hide
        peter royal added a comment -

        I see that this test has already been put in IHPCTestCase, and it passes.

        Joerg, do you believe that the IHPC cxtor's that do not take a CAF are invalid?

        Show
        peter royal added a comment - I see that this test has already been put in IHPCTestCase, and it passes. Joerg, do you believe that the IHPC cxtor's that do not take a CAF are invalid?
        Hide
        Jörg Schaible added a comment -

        After discussion, we may inherit directly from DPC instead of using delegates.

        Show
        Jörg Schaible added a comment - After discussion, we may inherit directly from DPC instead of using delegates.
        Hide
        Paul Hammant added a comment -

        I think this is OK now. As in the two instances are not the same.

        It still does a delegation rather than inheritance, tho, but the code has been simplified and a bug eliminated.

        Show
        Paul Hammant added a comment - I think this is OK now. As in the two instances are not the same. It still does a delegation rather than inheritance, tho, but the code has been simplified and a bug eliminated.
        Hide
        Mauro Talevi added a comment -

        Since the bug has been fixed can we then postpone refactor to future release 1.3 or 2.0?

        Show
        Mauro Talevi added a comment - Since the bug has been fixed can we then postpone refactor to future release 1.3 or 2.0?
        Hide
        Paul Hammant added a comment -

        All done bar inheritance over composition See PICO-256

        Show
        Paul Hammant added a comment - All done bar inheritance over composition See PICO-256
        Paul Hammant made changes -
        Status Open [ 1 ] Closed [ 6 ]
        Resolution Fixed [ 1 ]

          People

          • Assignee:
            Jörg Schaible
            Reporter:
            Jörg Schaible
          • Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

            Dates

            • Created:
              Updated:
              Resolved: