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());
|
||||
|
||||
Reference in New Issue
Block a user