Java 8 getParameterCount() instead of getParameterTypes().length

Issue: SPR-13188
This commit is contained in:
Juergen Hoeller
2016-07-07 01:04:24 +02:00
parent 39e3f2ebf6
commit a1f5fb53db
38 changed files with 68 additions and 68 deletions

View File

@@ -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())) {

View File

@@ -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));
}
});

View File

@@ -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()) {

View File

@@ -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;