Join GitHub today
GitHub is home to over 40 million developers working together to host and review code, manage projects, and build software together.Sign up
Kotlin class instantiation with optional parameters and default values [SPR-15673] #20232
Following the work done on #19763, it seems we don't support currently Kotlin classes with default parameters since the bytecode generated contains 2 constructors.
This comment from Jayson Minard provide useful guidance. We could maybe take inspiration of https://github.com/FasterXML/jackson-module-kotlin/ that implements similar support.
This feature should if possible be reusable from Spring Boot for its support for
Juergen Hoeller I am going to try to write Kotlin tests that demonstrate the issue and try to find the right Kotlin API to use for that, I may need your guidance for the steps after that.
Sébastien Deleuze commented
For the record, Jayson Minard provided these hints to help us based on his experience on the Jackson Kotlin module:
Moritz Schulze commented
I would like to add that after the upgrade to Spring Boot 2.0.0 M3 this actually broke some Kotlin compability for me.
I had a
With M3 I get
So I had to change to
(which of cause is not that big of a hassle - I didn't use the constructor anywhere manually anyway).