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

Solve ordering issue of record constructor parameters #169

Conversation

Giovds
Copy link

@Giovds Giovds commented Oct 18, 2024

Closes #167

@Giovds Giovds force-pushed the issue-167-solve-ordering-problem-of-record-constructor-params branch from 38e022f to eb422c6 Compare October 18, 2024 11:25
@Giovds Giovds force-pushed the issue-167-solve-ordering-problem-of-record-constructor-params branch from eb422c6 to 16c9ff0 Compare October 18, 2024 14:13
@Giovds Giovds marked this pull request as ready for review October 18, 2024 14:13
@cowtowncoder
Copy link
Member

Ok thank you @Giovds ! I'll need to go over this with more thought, but on first look it looks good!

One thing I'll need before merging -- if not already done earlier -- is to get a CLA. It needs to be sent just once before first contribution and is good for any later contributions.
It's this doc:

https://github.com/FasterXML/jackson/blob/master/contributor-agreement.pdf

and the usual ways is to print, fill & sign, scan/photo, email to cla at fasterxml dot com.
Once I have it, I can proceed with merging (pending final code review etc).

Looking forward to merging this in!

@Giovds
Copy link
Author

Giovds commented Oct 19, 2024

I've sent the email 👍

@cowtowncoder
Copy link
Member

CLA received, hoping to review this soon.

final Parameter[] parameters = constructors._recordCtor.getParameters();
for (int i = 0; i < parameters.length; i++) {
Parameter parameter = parameters[i];
if (!parameter.getName().isEmpty()) {
Copy link
Member

Choose a reason for hiding this comment

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

Why such check? Does this happen? Isn't it an error condition?

And specifically if this happens wouldn't it just lead to an NPE when looking up the index?

Copy link
Author

@Giovds Giovds Oct 21, 2024

Choose a reason for hiding this comment

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

Actually, I think this is an irrelevant check, as you can not create a (record) instance variable without a name... It would lead to a NPE in the look-up part. I'd say just remove the check, as you can not test this as you'd get a compile error? WDYT?

Copy link
Member

Choose a reason for hiding this comment

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

Yes, sounds good. But as per my note above, might be this part of code can be removed altogether.

@cowtowncoder
Copy link
Member

Ok; I decided to go with #170 instead. Thank you for your help @Giovds reporting the issue & showing a possible fix. I'll re-visit changes for 2.19 as well.

@Giovds
Copy link
Author

Giovds commented Oct 22, 2024

Happy to see it fixed. Hopefully it was of any help 👍

@cowtowncoder
Copy link
Member

@Giovds It definitely was -- thank you for helping here.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Deserialization of record fails on constructor parameter ordering
2 participants