Details
-
Type: Bug
-
Status: Open
-
Priority: Major
-
Resolution: Unresolved
-
Affects Version/s: None
-
Fix Version/s: None
-
Component/s: None
-
Labels:None
-
Testcase included:yes
-
Number of attachments :
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.