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