spring-projects / spring-framework

Spring Framework
https://spring.io/projects/spring-framework
Apache License 2.0
56.2k stars 37.97k forks source link

Support for parameter name introspection on Kotlin inline classes [SPR-17466] #21998

Closed spring-projects-issues closed 9 months ago

spring-projects-issues commented 5 years ago

reckter opened SPR-17466 and commented

In org.springframework.core.KotlinReflectionParameterDiscoverer::get ParameterNames() spring tries to get names of parameters, by getting the kotlin function and calling getParameters() on it.

If you use the new inline class feature (since kotlin 1.3) in data classes, spring data mongo can not build the mapper, because the function mentioned above, returns null.

The cause for this is, that kotlin create a syntetic constructer as the default constructor, that unboxes the inline classes. Because of that, the ReflectJvmMapping.getKotlinFunction returns null, as the function is not a kotlin function, but a created one.

The getParameterNames function should support syntetic functions, if somehow possible, so we can use inline classes fully in the spring framework.

 


Affects: 5.1.2

Issue Links:

spring-projects-issues commented 5 years ago

Juergen Hoeller commented

Sébastien Deleuze, if there is a chance to bring this forward to 5.1.x (without a full upgrade to Kotlin 1.3 on our end), feel free to go for it...

sdeleuze commented 5 years ago

@reckter Inline classes are experimental in 1.3, so I am not sure we should do anything in 5.2, and I am wondering if that should not be raised on Kotlin side. Any thoughts?

sdeleuze commented 9 months ago

Spring Data now provides dedicated related support and Spring Framework 6.1 also improved value Kotlin value classe support, so as I am not sure this old issue is valid anymore, I close it.