-
-
Notifications
You must be signed in to change notification settings - Fork 1.4k
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
Nulls.AS_EMPTY
doesn't work for collections containing values without default constructor (like Records)
#3084
Comments
Any news on this? I recently just ran into the same issue |
@krzyk maybe should be using Otherwise, can you please provide an example for JavaBeans (i.e. not Records) that actually works with |
@yihtserns You are correct: content nulls are only for But the exception is strange at any rate: it should not be a problem to create empty |
@cowtowncoder seems like it is complaining that
...although the error message does sound misleading. Same behaviour can be observed when using an equivalent non-Records class:
The issue goes away by adding a no-arg constructor to
|
Ah. Ok, so the issue here is specifically that due to setting that would use "As.EMPTY" for elements of That is sort of valid reason to fail, potentially, if (but only if?) we ever needed to have empty I think there's an older issue mentioning the same problem wrt (overly) eager construction of handler to provide "empty" instance. But there is also then the question of deferring failure to a later point -- is that always desireable? For now it'd make sense to change configuration to use |
Nulls.AS_EMPTY
doesn't work for collections containing values without default constructor (like Records)
Describe the bug
When deserializating an empty JSON object
{}
into a record that contains a list of another record results in:Version information
2.12.2
To Reproduce
The above fails with:
Expected behavior
I would expect the deserialization give me an empty list.
The text was updated successfully, but these errors were encountered: