Java 8 getParameterCount() instead of getParameterTypes().length
Issue: SPR-13188
This commit is contained in:
@@ -396,7 +396,7 @@ public class CommonAnnotationBeanPostProcessor extends InitDestroyAnnotationBean
|
||||
if (Modifier.isStatic(method.getModifiers())) {
|
||||
throw new IllegalStateException("@WebServiceRef annotation is not supported on static methods");
|
||||
}
|
||||
if (method.getParameterTypes().length != 1) {
|
||||
if (method.getParameterCount() != 1) {
|
||||
throw new IllegalStateException("@WebServiceRef annotation requires a single-arg method: " + method);
|
||||
}
|
||||
PropertyDescriptor pd = BeanUtils.findPropertyForMethod(bridgedMethod, clazz);
|
||||
@@ -406,7 +406,7 @@ public class CommonAnnotationBeanPostProcessor extends InitDestroyAnnotationBean
|
||||
if (Modifier.isStatic(method.getModifiers())) {
|
||||
throw new IllegalStateException("@EJB annotation is not supported on static methods");
|
||||
}
|
||||
if (method.getParameterTypes().length != 1) {
|
||||
if (method.getParameterCount() != 1) {
|
||||
throw new IllegalStateException("@EJB annotation requires a single-arg method: " + method);
|
||||
}
|
||||
PropertyDescriptor pd = BeanUtils.findPropertyForMethod(bridgedMethod, clazz);
|
||||
|
||||
@@ -284,7 +284,7 @@ class ConfigurationClassEnhancer {
|
||||
@Override
|
||||
public boolean isMatch(Method candidateMethod) {
|
||||
return (candidateMethod.getName().equals("setBeanFactory") &&
|
||||
candidateMethod.getParameterTypes().length == 1 &&
|
||||
candidateMethod.getParameterCount() == 1 &&
|
||||
BeanFactory.class == candidateMethod.getParameterTypes()[0] &&
|
||||
BeanFactoryAware.class.isAssignableFrom(candidateMethod.getDeclaringClass()));
|
||||
}
|
||||
|
||||
@@ -161,7 +161,7 @@ public class ApplicationListenerMethodAdapter implements GenericApplicationListe
|
||||
if (declaredEventType == null) {
|
||||
return null;
|
||||
}
|
||||
if (this.method.getParameterTypes().length == 0) {
|
||||
if (this.method.getParameterCount() == 0) {
|
||||
return new Object[0];
|
||||
}
|
||||
if (!ApplicationEvent.class.isAssignableFrom(declaredEventType.getRawClass())
|
||||
@@ -347,7 +347,7 @@ public class ApplicationListenerMethodAdapter implements GenericApplicationListe
|
||||
}
|
||||
|
||||
private List<ResolvableType> resolveDeclaredEventTypes() {
|
||||
int count = this.method.getParameterTypes().length;
|
||||
int count = this.method.getParameterCount();
|
||||
if (count > 1) {
|
||||
throw new IllegalStateException(
|
||||
"Maximum one parameter is allowed for event listener method: " + this.method);
|
||||
|
||||
@@ -293,7 +293,7 @@ public class ScheduledAnnotationBeanPostProcessor implements DestructionAwareBea
|
||||
|
||||
protected void processScheduled(Scheduled scheduled, Method method, Object bean) {
|
||||
try {
|
||||
Assert.isTrue(method.getParameterTypes().length == 0,
|
||||
Assert.isTrue(method.getParameterCount() == 0,
|
||||
"Only no-arg methods may be annotated with @Scheduled");
|
||||
|
||||
Method invocableMethod = AopUtils.selectInvocableMethod(method, bean.getClass());
|
||||
|
||||
@@ -231,7 +231,7 @@ class TraceAfterReturningAdvice implements AfterReturningAdvice {
|
||||
new StaticMethodMatcherPointcut() {
|
||||
@Override
|
||||
public boolean matches(Method method, Class<?> targetClass) {
|
||||
return method.getParameterTypes().length == 1 &&
|
||||
return method.getParameterCount() == 1 &&
|
||||
method.getParameterTypes()[0].equals(Integer.class);
|
||||
}
|
||||
},
|
||||
|
||||
@@ -1217,7 +1217,7 @@ public abstract class AbstractAopProxyTests {
|
||||
pc.addAdvisor(new StaticMethodMatcherPointcutAdvisor(overLoadVoids) {
|
||||
@Override
|
||||
public boolean matches(Method m, Class<?> targetClass) {
|
||||
return m.getName().equals("overload") && m.getParameterTypes().length == 0;
|
||||
return m.getName().equals("overload") && m.getParameterCount() == 0;
|
||||
}
|
||||
});
|
||||
|
||||
@@ -1225,7 +1225,7 @@ public abstract class AbstractAopProxyTests {
|
||||
pc.addAdvisor(new StaticMethodMatcherPointcutAdvisor(overLoadInts) {
|
||||
@Override
|
||||
public boolean matches(Method m, Class<?> targetClass) {
|
||||
return m.getName().equals("overload") && m.getParameterTypes().length == 1 &&
|
||||
return m.getName().equals("overload") && m.getParameterCount() == 1 &&
|
||||
m.getParameterTypes()[0].equals(int.class);
|
||||
}
|
||||
});
|
||||
@@ -1314,7 +1314,7 @@ public abstract class AbstractAopProxyTests {
|
||||
Advisor matchesNoArgs = new StaticMethodMatcherPointcutAdvisor(cba) {
|
||||
@Override
|
||||
public boolean matches(Method m, Class<?> targetClass) {
|
||||
return m.getParameterTypes().length == 0;
|
||||
return m.getParameterCount() == 0;
|
||||
}
|
||||
};
|
||||
TestBean target = new TestBean();
|
||||
@@ -1395,7 +1395,7 @@ public abstract class AbstractAopProxyTests {
|
||||
Advisor matchesNoArgs = new StaticMethodMatcherPointcutAdvisor(cca) {
|
||||
@Override
|
||||
public boolean matches(Method m, Class<?> targetClass) {
|
||||
return m.getParameterTypes().length == 0 || "exceptional".equals(m.getName());
|
||||
return m.getParameterCount() == 0 || "exceptional".equals(m.getName());
|
||||
}
|
||||
};
|
||||
TestBean target = new TestBean();
|
||||
@@ -1694,7 +1694,7 @@ public abstract class AbstractAopProxyTests {
|
||||
@Override
|
||||
public boolean matches(Method m, Class<?> targetClass) {
|
||||
return m.getName().startsWith("set") &&
|
||||
m.getParameterTypes().length == 1 &&
|
||||
m.getParameterCount() == 1 &&
|
||||
m.getParameterTypes()[0].equals(String.class);
|
||||
}
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user