You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
this structure will fail to deserialize on Android with no Creators, like default constructor, exist): cannot deserialize from Object value (no delegate- or property-based Creator.
I've researched this further and it seems like this is, in fact, an Android bug, and not a Jackson bug. If generic types are used (anywhere) in a class declaration, then Android's libcore parses the type descriptors in a way that arrays are always instances of GenericArrayType and other types are always ParameterizedTypes. I'm almost certain this must be breaking some Java specification, and even if not, it is incredibly ugly. (for comedic effect, see here regarding how this behavior is worked around so that methods like "getGenericComponentType" work properly) (and for additional comedic effect, the average pay at Google is about $120K a year)
Since I reckon there's no point in trying to make Google fix this mess themselves (it has apparently been causing issues at least as early as 2018), I would rather propose to work around it in Jackson since it does break deserialization of quite a lot of realistic scenarios. I have made a fix for myself already and I can PR it if wanted, I would just need to rebase it to whatever point Jackson is currently at (it is currently based on where it was as of #248).
The text was updated successfully, but these errors were encountered:
cowtowncoder
changed the title
android-record: Constructor is not recognized when a record uses both arrays and generic types
Constructor is not recognized when a record uses both arrays and generic types
Sep 4, 2024
Given a record that contains both an array member and a generic type member, such as:
this structure will fail to deserialize on Android with
no Creators, like default constructor, exist): cannot deserialize from Object value (no delegate- or property-based Creator
.I've researched this further and it seems like this is, in fact, an Android bug, and not a Jackson bug. If generic types are used (anywhere) in a class declaration, then Android's libcore parses the type descriptors in a way that arrays are always instances of GenericArrayType and other types are always ParameterizedTypes. I'm almost certain this must be breaking some Java specification, and even if not, it is incredibly ugly. (for comedic effect, see here regarding how this behavior is worked around so that methods like "getGenericComponentType" work properly) (and for additional comedic effect, the average pay at Google is about $120K a year)
Since I reckon there's no point in trying to make Google fix this mess themselves (it has apparently been causing issues at least as early as 2018), I would rather propose to work around it in Jackson since it does break deserialization of quite a lot of realistic scenarios. I have made a fix for myself already and I can PR it if wanted, I would just need to rebase it to whatever point Jackson is currently at (it is currently based on where it was as of #248).
The text was updated successfully, but these errors were encountered: