You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
when upgrading my project from Spring Boot 3.1.x to 3.2.0 (and thus from Spring Beans 6.0.x / Spring Data Commons 3.1.x), I get an exception during runtime when the KotlinBeanInfoFactory tries to return the bean info for a Kotlin enum type. The following code can be used for reproducing the problem:
enum class SomeEnum(val someProperty: String) {
VALUE_1("someValue1"),
VALUE_2("someValue2")
}
@Test
fun determinesEnumProperties() {
val pds = org.springframework.beans.BeanUtils.getPropertyDescriptors(SomeEnum::class.java)
assertThat(pds).extracting("name").contains("someProperty")
}
This produces the following exception:
kotlin.reflect.jvm.internal.KotlinReflectionInternalError: No accessor found for property val entries: kotlin.enums.EnumEntries<org.springframework.data.util.KotlinBeanInfoFactoryUnitTests.SomeEnum>
at kotlin.reflect.jvm.internal.KPropertyImplKt.computeCallerForAccessor(KPropertyImpl.kt:314)
at kotlin.reflect.jvm.internal.KPropertyImplKt.access$computeCallerForAccessor(KPropertyImpl.kt:1)
at kotlin.reflect.jvm.internal.KPropertyImpl$Getter$caller$2.invoke(KPropertyImpl.kt:180)
at kotlin.reflect.jvm.internal.KPropertyImpl$Getter$caller$2.invoke(KPropertyImpl.kt:179)
at kotlin.SafePublicationLazyImpl.getValue(LazyJVM.kt:107)
at kotlin.reflect.jvm.internal.KPropertyImpl$Getter.getCaller(KPropertyImpl.kt:179)
at kotlin.reflect.jvm.ReflectJvmMapping.getJavaMethod(ReflectJvmMapping.kt:64)
at kotlin.reflect.jvm.ReflectJvmMapping.getJavaGetter(ReflectJvmMapping.kt:49)
at org.springframework.data.util.KotlinBeanInfoFactory.getBeanInfo(KotlinBeanInfoFactory.java:67)
at org.springframework.beans.CachedIntrospectionResults.getBeanInfo(CachedIntrospectionResults.java:222)
at org.springframework.beans.CachedIntrospectionResults.<init>(CachedIntrospectionResults.java:248)
at org.springframework.beans.CachedIntrospectionResults.forClass(CachedIntrospectionResults.java:157)
at org.springframework.beans.BeanUtils.getPropertyDescriptors(BeanUtils.java:490)
In the above test, I'm not sure which other properties should be asserted (in addition to someProperty). Checking with previous behavior in Spring Beans 6.0.x (from which BeanUtils is coming from) / Spring Data Commons 3.1.x, the following properties had previously been detected for the SomeEnum class: class, declaringClass, entries, someProperty, name, ordinal.
The text was updated successfully, but these errors were encountered:
It makes sense for us to backoff for enums. We do not want to determine properties for enums as we treat enums as values. class, declaringClass, entries and other properties are determined by the simple bean info factory.
Hi @mp911de thanks for the quick fix of the problem. I gave 3.2.1-SNAPSHOT a try in my application. It was successful, so I would consider it fixed for now.
Hi,
when upgrading my project from Spring Boot 3.1.x to 3.2.0 (and thus from Spring Beans 6.0.x / Spring Data Commons 3.1.x), I get an exception during runtime when the
KotlinBeanInfoFactory
tries to return the bean info for a Kotlin enum type. The following code can be used for reproducing the problem:This produces the following exception:
This problem is potentially similar to #2964
In the above test, I'm not sure which other properties should be asserted (in addition to
someProperty
). Checking with previous behavior in Spring Beans 6.0.x (from whichBeanUtils
is coming from) / Spring Data Commons 3.1.x, the following properties had previously been detected for theSomeEnum
class:class
,declaringClass
,entries
,someProperty
,name
,ordinal
.The text was updated successfully, but these errors were encountered: