Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix sealed subclass picking #338

Merged
merged 5 commits into from Aug 15, 2022
Merged

Fix sealed subclass picking #338

merged 5 commits into from Aug 15, 2022

Conversation

monosoul
Copy link
Contributor

@monosoul monosoul commented Aug 15, 2022

As a follow-up to #331 fix, this changes the sealed subclass picking logic,

If there are subclasses having more mandatory constructor arguments than the number of configuration properties provided, then such subclasses will be ignored at all.

If there are 2 classes having the same number of arguments in constructor: one with optional and one with mandatory, the one with mandatory will be preferred.

If there are 2 classes having the same number of mandatory arguments in the constructor, the one having higher total number of arguments will be preferred.

Only consider sealed subclasses that have no more than expected number of constructor args
then prefer the class having higher total constructor arguments number
@sksamuel sksamuel merged commit 6836c1c into sksamuel:master Aug 15, 2022
@sksamuel
Copy link
Owner

awesome 👍🏼

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.

None yet

2 participants