Java 8 getParameterCount() instead of getParameterTypes().length
Issue: SPR-13188
This commit is contained in:
@@ -96,9 +96,9 @@ public class FunctionReference extends SpelNodeImpl {
|
||||
this.method = null;
|
||||
Object[] functionArgs = getArguments(state);
|
||||
|
||||
if (!method.isVarArgs() && method.getParameterTypes().length != functionArgs.length) {
|
||||
if (!method.isVarArgs() && method.getParameterCount() != functionArgs.length) {
|
||||
throw new SpelEvaluationException(SpelMessage.INCORRECT_NUMBER_OF_ARGUMENTS_TO_FUNCTION,
|
||||
functionArgs.length, method.getParameterTypes().length);
|
||||
functionArgs.length, method.getParameterCount());
|
||||
}
|
||||
// Only static methods can be called in this way
|
||||
if (!Modifier.isStatic(method.getModifiers())) {
|
||||
|
||||
@@ -61,8 +61,8 @@ public class ReflectiveConstructorResolver implements ConstructorResolver {
|
||||
Arrays.sort(ctors, new Comparator<Constructor<?>>() {
|
||||
@Override
|
||||
public int compare(Constructor<?> c1, Constructor<?> c2) {
|
||||
int c1pl = c1.getParameterTypes().length;
|
||||
int c2pl = c2.getParameterTypes().length;
|
||||
int c1pl = c1.getParameterCount();
|
||||
int c2pl = c2.getParameterCount();
|
||||
return (c1pl < c2pl ? -1 : (c1pl > c2pl ? 1 : 0));
|
||||
}
|
||||
});
|
||||
|
||||
@@ -123,8 +123,8 @@ public class ReflectiveMethodResolver implements MethodResolver {
|
||||
Collections.sort(methods, new Comparator<Method>() {
|
||||
@Override
|
||||
public int compare(Method m1, Method m2) {
|
||||
int m1pl = m1.getParameterTypes().length;
|
||||
int m2pl = m2.getParameterTypes().length;
|
||||
int m1pl = m1.getParameterCount();
|
||||
int m2pl = m2.getParameterCount();
|
||||
// varargs methods go last
|
||||
if (m1pl == m2pl) {
|
||||
if (!m1.isVarArgs() && m2.isVarArgs()) {
|
||||
|
||||
@@ -374,7 +374,7 @@ public class ReflectivePropertyAccessor implements PropertyAccessor {
|
||||
for (String methodSuffix : methodSuffixes) {
|
||||
for (Method method : methods) {
|
||||
if (method.getName().equals(prefix + methodSuffix) &&
|
||||
method.getParameterTypes().length == numberOfParams &&
|
||||
method.getParameterCount() == numberOfParams &&
|
||||
(!mustBeStatic || Modifier.isStatic(method.getModifiers())) &&
|
||||
(requiredReturnTypes.isEmpty() || requiredReturnTypes.contains(method.getReturnType()))) {
|
||||
return method;
|
||||
|
||||
Reference in New Issue
Block a user