NanoContainer
  1. NanoContainer
  2. NANO-191

DefaultNanoContainer(PicoContainer) and DefaultNanoContainer(MutablePicoContainer) are problematic with scripts.

    Details

    • Type: Bug Bug
    • Status: Open Open
    • Priority: Major Major
    • Resolution: Unresolved
    • Affects Version/s: None
    • Fix Version/s: None
    • Component/s: None
    • Labels:
      None
    • Testcase included:
      yes
    • Number of attachments :
      0

      Description

      I just spent some time getting the Jython test cases back online and found an interesting problem:

      DefaultNanoContainer(PicoContainer) and DefaultNanoContainer(MutablePicoContainer) have very different behaviors (The former indicates a parent container, the latter, a delegate container)

      The problem is that since scripts are liberal on their type matching, executing:

      new DefaultNanoContainer(parent) in nearly any script will NOT result in a proper parent->child hierarchy. (DefaultNanoContainer(MutablePicoContainer) ends up being called)

      Obvsiouly, using: new NanoBuilder(parent).withCaching().withLifecycle(), etc will circumvent this problem, but since Nano was built for scripts, it seems like its a bit of a problem.

      Test Case:

      public void testContainerCanBeBuiltWithParent()

      { Reader script = new StringReader("" + "pico = DefaultNanoContainer(parent)\n"); PicoContainer parent = new DefaultPicoContainer(); PicoContainer pico = buildContainer(new JythonContainerBuilder(script, getClass().getClassLoader()), parent, "SOME_SCOPE"); //If run, an exception will be thrown. }

      The failure is that start() gets called twice and an IllegalStateException is thrown within PicoContainer.

        Activity

        There are no entries against this issue.

          People

          • Assignee:
            Unassigned
            Reporter:
            Michael Rimov
          • Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

            Dates

            • Created:
              Updated: