NanoContainer
  1. NanoContainer
  2. NANO-118

AspectablePicoContainer's handling of .makeChildContainer() wrong

    Details

    • Type: Bug Bug
    • Status: Closed Closed
    • Priority: Major Major
    • Resolution: Fixed
    • Affects Version/s: 1.0-beta-3
    • Fix Version/s: 1.0-RC2
    • Component/s: core
    • Labels:
      None
    • Environment:
      OS: Linux 2.6.8-24.11-default
      Java: 1.4.2_06 (Sun)
    • Number of attachments :
      0

      Description

      I've a PicoContainer instance of the type AspectablePicoContainer (just call it parentContainer here) of which I'd like to spawn a child container of the same type using .makeChildContainer().

      The javadocs of PicoContainer.makeChildContainer() reads: "Make a child container, using the same implementation of MutablePicoContainer as the parent." so I think the spawned child-container should be of the parent-container's type. But unfortunately the created child container is just a regular DefaultPicoContainer by its type.

      Just use the following code to check

      AspectablePicoContainer parentContainer = ..... // get from somewhere
      MutablePicoContainer childContainer = parentContainer.makeChildContainer();
      parentContainer.addChildContainer(childContainer);
      System.out.println((parentContainer instanceof AspectablePicoContainer)); //
      = true
      System.out.println((childContainer instanceof AspectablePicoContainer)); // =
      false

        Issue Links

          Activity

          Jörg Schaible made changes -
          Field Original Value New Value
          Link This issue is related to NANO-137 [ NANO-137 ]
          Hide
          Jörg Schaible added a comment -

          Although for a different container ...

          Show
          Jörg Schaible added a comment - Although for a different container ...
          Mauro Talevi made changes -
          Environment OS: Linux 2.6.8-24.11-default
          Java: 1.4.2_06 (Sun)
          OS: Linux 2.6.8-24.11-default
          Java: 1.4.2_06 (Sun)
          Fix Version/s 1.0-RC2 [ 11851 ]
          Description I've a PicoContainer instance of the type AspectablePicoContainer (just call it parentContainer here) of which I'd like to spawn a child container of the same type using .makeChildContainer().

          The javadocs of PicoContainer.makeChildContainer() reads: "Make a child container, using the same implementation of MutablePicoContainer as the parent." so I think the spawned child-container should be of the parent-container's type. But unfortunately the created child container is just a regular DefaultPicoContainer by its type.

          Just use the following code to check

                  AspectablePicoContainer parentContainer = ..... // get from somewhere
                  MutablePicoContainer childContainer = parentContainer.makeChildContainer();
                  parentContainer.addChildContainer(childContainer);
                  System.out.println((parentContainer instanceof AspectablePicoContainer));  //
          = true
                  System.out.println((childContainer instanceof AspectablePicoContainer)); // =
          false
          I've a PicoContainer instance of the type AspectablePicoContainer (just call it parentContainer here) of which I'd like to spawn a child container of the same type using .makeChildContainer().

          The javadocs of PicoContainer.makeChildContainer() reads: "Make a child container, using the same implementation of MutablePicoContainer as the parent." so I think the spawned child-container should be of the parent-container's type. But unfortunately the created child container is just a regular DefaultPicoContainer by its type.

          Just use the following code to check

                  AspectablePicoContainer parentContainer = ..... // get from somewhere
                  MutablePicoContainer childContainer = parentContainer.makeChildContainer();
                  parentContainer.addChildContainer(childContainer);
                  System.out.println((parentContainer instanceof AspectablePicoContainer)); //
          = true
                  System.out.println((childContainer instanceof AspectablePicoContainer)); // =
          false
          Hide
          Mauro Talevi added a comment -

          The problem is due to the inherent nature of the way aspectable containers are made mixing aspects via a proxy.
          MutablePicoContainer#makeChildContainer() will always return a MutableChildContainer.
          To make child containers that are aspectable I've added makeChildContainer() methods in the
          AspectablePicoContainerFactory which take a parent AspectablePicoContainer and make a child
          AspectablePicoContainer using the Mutable#makeChildContainer() of the parent.

          Show
          Mauro Talevi added a comment - The problem is due to the inherent nature of the way aspectable containers are made mixing aspects via a proxy. MutablePicoContainer#makeChildContainer() will always return a MutableChildContainer. To make child containers that are aspectable I've added makeChildContainer() methods in the AspectablePicoContainerFactory which take a parent AspectablePicoContainer and make a child AspectablePicoContainer using the Mutable#makeChildContainer() of the parent.
          Mauro Talevi made changes -
          Resolution Fixed [ 1 ]
          Status Open [ 1 ] Closed [ 6 ]

            People

            • Assignee:
              Unassigned
              Reporter:
              Christian Schneider
            • Votes:
              0 Vote for this issue
              Watchers:
              1 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved: