Fixed detection of setter in case of getter with covariant return type narrowing
Issue: SPR-10995
(cherry picked from commit 045f78e)
This commit is contained in:
@@ -69,8 +69,11 @@ class GenericTypeAwarePropertyDescriptor extends PropertyDescriptor {
|
||||
// Fallback: Original JavaBeans introspection might not have found matching setter
|
||||
// method due to lack of bridge method resolution, in case of the getter using a
|
||||
// covariant return type whereas the setter is defined for the concrete property type.
|
||||
writeMethodToUse = ClassUtils.getMethodIfAvailable(this.beanClass,
|
||||
"set" + StringUtils.capitalize(getName()), readMethodToUse.getReturnType());
|
||||
Method candidate = ClassUtils.getMethodIfAvailable(
|
||||
this.beanClass, "set" + StringUtils.capitalize(getName()), (Class<?>[]) null);
|
||||
if (candidate != null && candidate.getParameterTypes().length == 1) {
|
||||
writeMethodToUse = candidate;
|
||||
}
|
||||
}
|
||||
this.readMethod = readMethodToUse;
|
||||
this.writeMethod = writeMethodToUse;
|
||||
|
||||
Reference in New Issue
Block a user