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

Add failing test for #4742 #4757

Merged
merged 5 commits into from
Oct 24, 2024
Merged

Conversation

JooHyukKim
Copy link
Member

@JooHyukKim JooHyukKim commented Oct 20, 2024

Like I mentioned in #4742, not for merge, just to get idea.

Added failing test instead

@@ -645,7 +645,7 @@ public void resolve(DeserializationContext ctxt) throws JsonMappingException
}

// And now that we know CreatorProperty instances are also resolved can finally create the creator:
if (creatorProps != null) {
if (creatorProps != null && creatorProps.length > 0) {
Copy link
Member Author

Choose a reason for hiding this comment

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

So the idea is... it should not have create() method as PropertyBasedCreator, but instead make it default creator for Builder case.

Copy link
Member

Choose a reason for hiding this comment

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

I do not follow the logic here. Why should we skip the case of 0-arguments Creator? (this would only apply to factory method, I think, with constructor we get separate "default constructor" case). It also does not seem to apply just to the Builder case (no checks to indicate that).

Comment on lines 138 to 140
if (_defaultCreator == null) {
_defaultCreator = withArgsCreator;
}
Copy link
Member Author

Choose a reason for hiding this comment

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

Same idea here. create() method should become the defaultCreator for Builder case. Idk how zero-arg create() method became withArgsCreator probably null-checking but not checking length?

Copy link
Member

Choose a reason for hiding this comment

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

I also do not quite understand intended logic here: _defaultCtor is specifically expected to be 0-args Constructor; here no checking is done.
If such logic for defaulting was needed, it should be probably done by caller, not this method.

@JooHyukKim JooHyukKim marked this pull request as draft October 20, 2024 02:38
@cowtowncoder
Copy link
Member

Ok I must admit I do not understand the idea. There are also a few unit test failures...

@JooHyukKim
Copy link
Member Author

JooHyukKim commented Oct 21, 2024

It seems like this PR is quite explained incorrectly. I will convert this PR just adding test case.

Your comments seem to already sort of reflect what I was trying to say 😅 like Builder's factory method should be default creator or skipping creating properties creator.

PS: Changed to just adding a test case.

@JooHyukKim JooHyukKim marked this pull request as ready for review October 21, 2024 02:01
@JooHyukKim JooHyukKim changed the title [POC] EXPLAIN possible fix for #4742 Add failing test for #4742 Oct 21, 2024
@@ -0,0 +1,130 @@
package com.fasterxml.jackson.databind.deser.creators;
Copy link
Member

Choose a reason for hiding this comment

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

I think this should go under tofix, right?

Copy link
Member Author

Choose a reason for hiding this comment

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

Yes, thanks!

@cowtowncoder cowtowncoder merged commit 1fd3e48 into FasterXML:2.18 Oct 24, 2024
8 of 9 checks passed
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