PicoContainer
  1. PicoContainer
  2. PICO-77

CachingComponentAdapterFactory does not produce CachingComponentAdapter

    Details

    • Type: Bug Bug
    • Status: Closed Closed
    • Priority: Critical Critical
    • 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 :
      3

      Description

      CachingComponentAdapterFactory does not override DelegatingComponentAdapterFactory.createComponentAdapter method.

      Because of this, the adapters produced by the factory are not CachingComponentAdapter instances, but whatever the underlying factory
      produces.

      This can be solved by overriding the aforementioned method to return
      new CachingComponentAdapter(getDelegate().createComponentAdapter(...))

      Note that DelegatingComponentAdapterFactory declares the factory delegate variable as private. A protected accessor method is necessary so that the derived factories may access it.

      1. CachingComponentAdapterFactory.diff
        2 kB
        Rafal Krzewski
      2. CachingComponentAdapterFactory2.diff
        1 kB
        Rafal Krzewski
      3. CachingComponentAdapterFactoryTest.diff
        2 kB
        Rafal Krzewski

        Activity

        Hide
        Rafal Krzewski added a comment -

        A new testcase that exhibits the bug.

        Show
        Rafal Krzewski added a comment - A new testcase that exhibits the bug.
        Rafal Krzewski made changes -
        Field Original Value New Value
        Attachment CachingComponentAdapterFactoryTest.diff [ 11105 ]
        Hide
        Rafal Krzewski added a comment -

        A patch for CachingComponentAdapterFactory and DecoratingComponentAdapterFactory that fixes the bug.

        Show
        Rafal Krzewski added a comment - A patch for CachingComponentAdapterFactory and DecoratingComponentAdapterFactory that fixes the bug.
        Rafal Krzewski made changes -
        Hide
        Rafal Krzewski added a comment -

        Looking at SynchronizedComponentAdapterFactory I realized that my fix
        was overly intrusive: super.createComponentAdapter() should be called
        in the derived instead of exposing the delegate from the parent.

        This patch REPLACES CachingComponentAdapterFactory.diff

        Show
        Rafal Krzewski added a comment - Looking at SynchronizedComponentAdapterFactory I realized that my fix was overly intrusive: super.createComponentAdapter() should be called in the derived instead of exposing the delegate from the parent. This patch REPLACES CachingComponentAdapterFactory.diff
        Rafal Krzewski made changes -
        Aslak Hellesøy made changes -
        Assignee Aslak Hellesoy [ rinkrank ]
        Aslak Hellesøy made changes -
        Fix Version/s 1.0 [ 10145 ]
        Hide
        Paul Hammant added a comment -

        Thanks Rafal!

        Show
        Paul Hammant added a comment - Thanks Rafal!
        Paul Hammant made changes -
        Status Open [ 1 ] Closed [ 6 ]
        Resolution Fixed [ 1 ]
        Hide
        Rafal Krzewski added a comment -

        I've noticed that the test case has not been commited.

        Show
        Rafal Krzewski added a comment - I've noticed that the test case has not been commited.
        Aslak Hellesøy made changes -
        Resolution Fixed [ 1 ]
        Status Closed [ 6 ] Reopened [ 4 ]
        Aslak Hellesøy made changes -
        Resolution Fixed [ 1 ]
        Fix Version/s 1.0-beta-4 [ 10412 ]
        Fix Version/s 1.0 [ 10145 ]
        Status Reopened [ 4 ] Closed [ 6 ]

          People

          • Assignee:
            Aslak Hellesøy
            Reporter:
            Rafal Krzewski
          • Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

            Dates

            • Created:
              Updated:
              Resolved: