Browse Source

Revise DependencyDescriptor etc to avoid MethodParameter deprecations

See gh-23385
pull/23401/head
Juergen Hoeller 5 years ago
parent
commit
49593f5399
  1. 3
      spring-beans/src/main/java/org/springframework/beans/GenericTypeAwarePropertyDescriptor.java
  2. 8
      spring-beans/src/main/java/org/springframework/beans/factory/config/DependencyDescriptor.java
  3. 2
      spring-beans/src/main/java/org/springframework/beans/factory/support/ConstructorResolver.java

3
spring-beans/src/main/java/org/springframework/beans/GenericTypeAwarePropertyDescriptor.java

@ -102,8 +102,7 @@ final class GenericTypeAwarePropertyDescriptor extends PropertyDescriptor { @@ -102,8 +102,7 @@ final class GenericTypeAwarePropertyDescriptor extends PropertyDescriptor {
this.ambiguousWriteMethods = ambiguousCandidates;
}
}
this.writeMethodParameter = new MethodParameter(this.writeMethod, 0);
GenericTypeResolver.resolveParameterType(this.writeMethodParameter, this.beanClass);
this.writeMethodParameter = new MethodParameter(this.writeMethod, 0).withContainingClass(this.beanClass);
}
if (this.readMethod != null) {

8
spring-beans/src/main/java/org/springframework/beans/factory/config/DependencyDescriptor.java

@ -33,7 +33,6 @@ import org.springframework.beans.BeansException; @@ -33,7 +33,6 @@ import org.springframework.beans.BeansException;
import org.springframework.beans.factory.BeanFactory;
import org.springframework.beans.factory.InjectionPoint;
import org.springframework.beans.factory.NoUniqueBeanDefinitionException;
import org.springframework.core.GenericTypeResolver;
import org.springframework.core.KotlinDetector;
import org.springframework.core.MethodParameter;
import org.springframework.core.ParameterNameDiscoverer;
@ -280,13 +279,12 @@ public class DependencyDescriptor extends InjectionPoint implements Serializable @@ -280,13 +279,12 @@ public class DependencyDescriptor extends InjectionPoint implements Serializable
/**
* Increase this descriptor's nesting level.
* @see MethodParameter#increaseNestingLevel()
*/
public void increaseNestingLevel() {
this.nestingLevel++;
this.resolvableType = null;
if (this.methodParameter != null) {
this.methodParameter.increaseNestingLevel();
this.methodParameter = this.methodParameter.nested();
}
}
@ -300,7 +298,7 @@ public class DependencyDescriptor extends InjectionPoint implements Serializable @@ -300,7 +298,7 @@ public class DependencyDescriptor extends InjectionPoint implements Serializable
this.containingClass = containingClass;
this.resolvableType = null;
if (this.methodParameter != null) {
GenericTypeResolver.resolveParameterType(this.methodParameter, containingClass);
this.methodParameter = this.methodParameter.withContainingClass(containingClass);
}
}
@ -457,7 +455,7 @@ public class DependencyDescriptor extends InjectionPoint implements Serializable @@ -457,7 +455,7 @@ public class DependencyDescriptor extends InjectionPoint implements Serializable
this.declaringClass.getDeclaredConstructor(this.parameterTypes), this.parameterIndex);
}
for (int i = 1; i < this.nestingLevel; i++) {
this.methodParameter.increaseNestingLevel();
this.methodParameter = this.methodParameter.nested();
}
}
}

2
spring-beans/src/main/java/org/springframework/beans/factory/support/ConstructorResolver.java

@ -53,7 +53,6 @@ import org.springframework.beans.factory.config.ConstructorArgumentValues; @@ -53,7 +53,6 @@ import org.springframework.beans.factory.config.ConstructorArgumentValues;
import org.springframework.beans.factory.config.ConstructorArgumentValues.ValueHolder;
import org.springframework.beans.factory.config.DependencyDescriptor;
import org.springframework.core.CollectionFactory;
import org.springframework.core.GenericTypeResolver;
import org.springframework.core.MethodParameter;
import org.springframework.core.NamedThreadLocal;
import org.springframework.core.ParameterNameDiscoverer;
@ -810,7 +809,6 @@ class ConstructorResolver { @@ -810,7 +809,6 @@ class ConstructorResolver {
for (int argIndex = 0; argIndex < argsToResolve.length; argIndex++) {
Object argValue = argsToResolve[argIndex];
MethodParameter methodParam = MethodParameter.forExecutable(executable, argIndex);
GenericTypeResolver.resolveParameterType(methodParam, executable.getDeclaringClass());
if (argValue instanceof AutowiredArgumentMarker) {
argValue = resolveAutowiredArgument(methodParam, beanName, null, converter, fallback);
}

Loading…
Cancel
Save