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:
Mark Paluch
2023-11-29 15:51:27 +01:00
parent 8db69931e4
commit 78267402bf
2 changed files with 25 additions and 0 deletions

View File

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