Skip to content

Support instantiating Kotlin classes with optional parameters - #1482

Closed
sdeleuze wants to merge 1 commit into
spring-projects:masterfrom
sdeleuze:SPR-15673
Closed

sdeleuze wants to merge 1 commit into
spring-projects:masterfrom
sdeleuze:SPR-15673

Conversation

@sdeleuze

Copy link
Copy Markdown
Contributor

This commit updates BeanUtils class in order to add Kotlin optional
parameters with default values support to the immutable data classes
support introduced by SPR-15199.

@jhoeller Could you please review and hopefully merge it with your changes if any?

Issue: SPR-15673

@sdeleuze
sdeleuze requested a review from jhoeller July 19, 2017 15:25

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I guess we'll have to differentiate here: For instantiateClass(Class), we can only deal with the no-arg default constructor (public or non-public) in the regular Java case... not with a non-default unique public constructor that findPrimaryConstructor might return to us.

So maybe we'll do some straight KotlinDelegate.findPrimaryConstructor vs clazz.getDeclaredConstructor() right here in instantiateClass(Class), and only use the public findPrimaryConstructor variant for data binding purposes.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Indeed I am going to change that accordingly to your proposal.

@sdeleuze
sdeleuze force-pushed the SPR-15673 branch 2 times, most recently from 86431a5 to 2e2c2ec Compare July 20, 2017 08:28
This commit updates BeanUtils class in order to add Kotlin optional
parameters with default values support to the immutable data classes
support introduced by SPR-15199.

Issue: SPR-15673
@sdeleuze

Copy link
Copy Markdown
Contributor Author

Merged via fa4d139.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants