Skip to content

Reinstantiate checks for kotlin-reflect #35511

@odrotbohm

Description

@odrotbohm

BeanUtils.instantiateClass(Constructor, Object…) is not checking for the presence of Kotlin Reflect before calling KotlinDelegate.instantiateClass(…) anymore. In case of the kotlin-reflect missing from the classpath, this will lead to the following exception:

java.lang.NoClassDefFoundError: kotlin/reflect/jvm/ReflectJvmMapping
    at org.springframework.beans.BeanUtils$KotlinDelegate.instantiateClass(BeanUtils.java:909)

While it might not be common for the reflection artifact to be missing if folks are using Kotlin, one might run into this if they use a library depending on kotlin-stdlib only. Currently, one has to add kotlin-reflect to avoid the exception. It would be cool if the code path was just skipped if the artifact is missing.

Metadata

Metadata

Assignees

Labels

theme: kotlinAn issue related to Kotlin supporttype: regressionA bug that is also a regression

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions