Omit asymmetric Kotlin properties.
We now skip adding asymmetric Kotlin properties if the getter returns a different type than the setter (e.g. due to value boxing). Closes #2993
This commit is contained in:
@@ -68,6 +68,13 @@ public class KotlinBeanInfoFactory implements BeanInfoFactory, Ordered {
|
||||
Method getter = ReflectJvmMapping.getJavaGetter(property);
|
||||
Method setter = property instanceof KMutableProperty<?> kmp ? ReflectJvmMapping.getJavaSetter(kmp) : null;
|
||||
|
||||
if (getter != null && setter != null && setter.getParameterCount() == 1) {
|
||||
if (!getter.getReturnType().equals(setter.getParameters()[0].getType())) {
|
||||
// filter asymmetric getters/setters from being considered a Java Beans property
|
||||
continue;
|
||||
}
|
||||
}
|
||||
|
||||
pds.add(new PropertyDescriptor(property.getName(), getter, setter));
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user