spring-projects / spring-boot

Spring Boot
https://spring.io/projects/spring-boot
Apache License 2.0
74.95k stars 40.65k forks source link

Detect primary constructor to generate metadata for Kotlin immutable types #16293

Open snicoll opened 5 years ago

snicoll commented 5 years ago

Configuration keys metadata for immutable Kotlin types are likely not to be generated as a single constructor in Kotlin may lead to several constructor on the Java side.

We should detect the primary constructor, if any and, for that, we need to access the metadata available only in binary format for now.

A couple of libraries could help with that:

sdeleuze commented 5 years ago

Notice that unlike what is mentioned in the documentation, kotlinx-metadata-jvm is available from Maven Central without requiring addition repository configuration.

As discussed with @snicoll, I think the ideal solution would be a version of kotlinx-metadata-jvm without a dependency on kotlin-stdlib (using Proguard maybe) that we could shade in spring-boot-configuration-processor.