Revise DependencyDescriptor etc to avoid MethodParameter deprecations

See gh-23385
This commit is contained in:
Juergen Hoeller
2019-08-01 14:25:33 +02:00
parent b67dbe66ef
commit 49593f5399
3 changed files with 4 additions and 9 deletions

View File

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

View File

@@ -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
/**
* 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
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
this.declaringClass.getDeclaredConstructor(this.parameterTypes), this.parameterIndex);
}
for (int i = 1; i < this.nestingLevel; i++) {
this.methodParameter.increaseNestingLevel();
this.methodParameter = this.methodParameter.nested();
}
}
}

View File

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