Fixed ReflectiveMethodResolver to avoid potential UnsupportedOperationException on sort

Issue: SPR-10392
This commit is contained in:
Juergen Hoeller 2013-03-19 10:57:23 +01:00
parent 283b3ee44b
commit aeef000c46
1 changed files with 9 additions and 7 deletions

View File

@ -103,6 +103,7 @@ public class ReflectiveMethodResolver implements MethodResolver {
} }
// Sort methods into a sensible order // Sort methods into a sensible order
if (methods.size() > 1) {
Collections.sort(methods, new Comparator<Method>() { Collections.sort(methods, new Comparator<Method>() {
public int compare(Method m1, Method m2) { public int compare(Method m1, Method m2) {
int m1pl = m1.getParameterTypes().length; int m1pl = m1.getParameterTypes().length;
@ -110,6 +111,7 @@ public class ReflectiveMethodResolver implements MethodResolver {
return (new Integer(m1pl)).compareTo(m2pl); return (new Integer(m1pl)).compareTo(m2pl);
} }
}); });
}
// Resolve any bridge methods // Resolve any bridge methods
for (int i = 0; i < methods.size(); i++) { for (int i = 0; i < methods.size(); i++) {