AppUtils: handle generic collection types for toJsonLiteral#2898
Open
Luna712 wants to merge 3 commits into
Open
AppUtils: handle generic collection types for toJsonLiteral#2898Luna712 wants to merge 3 commits into
Luna712 wants to merge 3 commits into
Conversation
fire-light42
reviewed
Jun 8, 2026
| } | ||
| } | ||
| // Handle generic collection/map types where type params are erased at runtime | ||
| // and no serializer can be found via reflection alone |
Collaborator
There was a problem hiding this comment.
Please write test cases for this type of behavior, it looks very easy to break things here.
Contributor
Author
There was a problem hiding this comment.
Not 100% sure what to write for tests here. I have another method for this to recursively convert things to a JsonElement, more reliable maybe but a least a tiny bit less performant. The issue is that for things like setKey, the type ends up getting erased, which means we have a few other options also, make setKey always use reified for serialized classes, or pass the type directly. I am not 100% sure on the best path here.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This is primarily for set key which calls toJsonLiteral, to avoid having to manually change every set key to determine proper serializers manually. This might have some edge cases where it doesn't fully work but under most circumstances it should.