-
Notifications
You must be signed in to change notification settings - Fork 33
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
Deserialization of record fails on constructor parameter ordering #167
Comments
Ok sounds like a flaw -- thank you for reporting this. |
cc @TomaszGaweda looks like there's some work left to do with Record deserialization. |
I think I know how to fix this. I'd be happy to provide a PR later this week, if that is ok. |
That would be great!
…On Sun, Oct 13, 2024 at 12:22 AM Giovanni van der Schelde < ***@***.***> wrote:
I think I know how to fix this. I'd be happy to provide a PR later this
week, if that is ok.
—
Reply to this email directly, view it on GitHub
<#167 (comment)>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/AAANOGLVQPCSGL35I3WSP3LZ3INS5AVCNFSM6AAAAABPNFWLYKVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDIMBYHA2TSMJSHA>
.
You are receiving this because you commented.Message ID:
***@***.***>
|
@cowtowncoder @TomaszGaweda I think the approach I propose in the PR should solve the issue. If there are any concerns please let me know. I'm a bit hesitant on whether or not |
I was testing if I could use record deserialization in my project and I found that it fails to match the correct parameter in the record constructor. I seems to follow alphabetic order. I'm not sure if this can differ in other JDK implementations. I'm using
azul-21
.The
ValueReaderLocator#_resolveBeanForDeser()
gets the parameters from the record, which seem to be returned in alphabetic order. This ordering will then be used when iterating over that list and thus using the incorrect constructor index when creating theBeanPropertyReader
here. If all types match it will continue to parse and will return incorrect values. Those are eventually read in theBeanReader
based on this indexing as shown in the test provided. If they don't match it results in a type mismatch exception.I have added a test below to reproduce the issue, but you can recreate it with the
Cow
examples as well by renaming the fields.The text was updated successfully, but these errors were encountered: