Update of /cvsroot/springnet/Spring.Net/src/Spring/Spring.Core/Util
In directory sc8-pr-cvs8.sourceforge.net:/tmp/cvs-serv27343/src/Spring/Spring.Core/Util
Modified Files:
ReflectionUtils.cs
Log Message:
ReflectionUtils.getMostSpecificMethod() throws exception when handling Generic methods with the same parameter signature and different generic types
[SPRNET-722]
Index: ReflectionUtils.cs
===================================================================
RCS file: /cvsroot/springnet/Spring.Net/src/Spring/Spring.Core/Util/ReflectionUtils.cs,v
retrieving revision 1.49
retrieving revision 1.50
diff -C2 -d -r1.49 -r1.50
*** ReflectionUtils.cs 27 Aug 2007 13:57:18 -0000 1.49
--- ReflectionUtils.cs 20 Sep 2007 12:31:01 -0000 1.50
***************
*** 190,243 ****
/// <summary>
- /// Finds that method on the supplied <paramref name="type"/> that most
- /// closely matches the supplied <paramref name="method"/>.
- /// if there is one.
- /// </summary>
- /// <remarks>
- /// <p>
- /// For example, the supplied <paramref name="method"/> may be
- /// <c>IFoo.Bar()</c> (i.e. the <c>Bar()</c> method from the
- /// <c>IFoo</c> interface), and the supplied <paramref name="type"/>
- /// may be the <c>DefaultFoo</c> class that just so happens to declare
- /// a <c>Bar()</c> method. This method will return the
- /// <c>DefaultFoo.Bar()</c> method because this method most closely
- /// matches the name and parameters of the supplied
- /// <paramref name="method"/>. This is useful because it enables
- /// attributes on that method to be found.
- /// </p>
- /// </remarks>
- /// <param name="method">
- /// The method to be invoked, which may come from an interface.
- /// </param>
- /// <param name="type">
- /// The target <see cref="System.Type"/> for the current invocation.
- /// May be <see langword="null"/> or may not even implement the method.
- /// </param>
- /// <returns>
- /// The more specific method, or the original method if the
- /// <paramref name="type"/> doesn't specialize it or implement
- /// it, or is <see langword="null"/>.
- /// </returns>
- /// <exception cref="System.ArgumentNullException">
- /// If <paramref name="method"/> is <see langword="null"/>.
- /// </exception>
- public static MethodInfo GetMostSpecificMethod(MethodInfo method, Type type)
- {
- AssertUtils.ArgumentNotNull(method, "method");
- if (type != null)
- {
- MethodInfo original = method;
- method = type.GetMethod(method.Name, GetParameterTypes(method.GetParameters()));
- if (method == null)
- {
- // perhaps the target class doesn't implement this method...
- // that's fine, just use the original method
- method = original;
- }
- }
- return method;
- }
-
- /// <summary>
/// From a given list of methods, selects the method having an exact match on the given <paramref name="argValues"/>' types.
/// </summary>
--- 190,193 ----
|