From fbbac69edbc3c1ac06deda6fcdf5efeffe4dfb0b Mon Sep 17 00:00:00 2001 From: markpollack Date: Fri, 1 Aug 2008 05:13:41 +0000 Subject: [PATCH] SPRNET-986 - Constructor autowiring for array types not working Notes: This was a simple fix (see DefaultListableObjectFactory.ResolveDependency) but took the opportunity to sync more with Java 2.5.3 implementation for parsing object definitions and autowiring algorithm. There maybe some extraneous commits due to spurious changes in line feed/CR while viewing some files. --- .../Objects/Factory/Support/ConstructorResolver.cs | 1 + .../Objects/Factory/Xml/XmlObjectFactoryTests.cs | 7 ++++++- 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/src/Spring/Spring.Core/Objects/Factory/Support/ConstructorResolver.cs b/src/Spring/Spring.Core/Objects/Factory/Support/ConstructorResolver.cs index 30c25c6c..a2d570f5 100644 --- a/src/Spring/Spring.Core/Objects/Factory/Support/ConstructorResolver.cs +++ b/src/Spring/Spring.Core/Objects/Factory/Support/ConstructorResolver.cs @@ -308,6 +308,7 @@ namespace Spring.Objects.Factory.Support // try all matching methods to see if they match the constructor arguments... foreach(MethodInfo factoryMethod in factoryMethods) { + Type[] paramTypes = new Type[] { }; #endif if (arguments == null || arguments.Length == 0) { diff --git a/test/Spring/Spring.Core.Tests/Objects/Factory/Xml/XmlObjectFactoryTests.cs b/test/Spring/Spring.Core.Tests/Objects/Factory/Xml/XmlObjectFactoryTests.cs index 99aedc10..9ff51a3f 100644 --- a/test/Spring/Spring.Core.Tests/Objects/Factory/Xml/XmlObjectFactoryTests.cs +++ b/test/Spring/Spring.Core.Tests/Objects/Factory/Xml/XmlObjectFactoryTests.cs @@ -1111,9 +1111,14 @@ namespace Spring.Objects.Factory.Xml ITestObject kerry = (ITestObject) xof.GetObject("spouse"); ITestObject kerry2 = (ITestObject)xof.GetObject("spouse2"); ArrayCtorDependencyObject rod7 = (ArrayCtorDependencyObject) xof.GetObject("rod7"); +#if NET_1_0 || NET_1_1 + // Lack of OrderedDictionary means we can't predict the ordering of the autowiring. + Assert.IsNotNull(rod7.Spouse1); + Assert.IsNotNull(rod7.Spouse2); +#else Assert.AreEqual(kerry, rod7.Spouse1); Assert.AreEqual(kerry2, rod7.Spouse2); - +#endif } public void AutowireWithParent()