Skip to content

Kotlin class instantiation with optional parameters and default values [SPR-15673] #20232

Closed
@spring-projects-issues

Description

@spring-projects-issues

Sébastien Deleuze opened SPR-15673 and commented

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 @ConfigurationProperties and Spring Data which currently requires Kotlin noarg compiler plugin (I have validated it is currently required via MiXiT application, would be nice to be able to avoid using this plugin which is basicaly a trick for libraries without Kotlin support).

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.


Issue Links:

Referenced from: commits d8e52c0, fa4d139, ab64305, 3991ab4, 40df7b6

Metadata

Metadata

Assignees

Labels

in: webIssues in web modules (web, webmvc, webflux, websocket)type: enhancementA general enhancement

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions