fix(serialization): use full JavaType in decodeFromJSONElement to preserve generics#2116
Merged
Andrey Bragin (EugeneTheDev) merged 3 commits intoJun 8, 2026
Conversation
Anastasiia Zarechneva (zarechneva-a)
requested review from
Andrey Bragin (EugeneTheDev) and
Briliantov Vadim (Ololoshechkin)
June 8, 2026 09:18
Andrey Bragin (EugeneTheDev)
approved these changes
Jun 8, 2026
Andrey Bragin (EugeneTheDev)
left a comment
Collaborator
There was a problem hiding this comment.
Nice fix, thank you. Can you please run ktlintFormat to fix formatting issues?
Contributor
Author
Andrey Bragin (@EugeneTheDev) thank you for the quick reply! Done 👍 |
Andrey Bragin (EugeneTheDev)
merged commit Jun 8, 2026
58a8168
into
JetBrains:develop
22 checks passed
Kaloyan Karaivanov (karloti)
pushed a commit
to karloti/koog
that referenced
this pull request
Jun 13, 2026
…serve generics (JetBrains#2116) `JacksonSerializer.decodeFromJSONElement` was passing `javaType.rawClass` to `objectMapper.treeToValue`, discarding generic type parameters. This causes parameterized types (e.g. `List<Person>`) to deserialize elements as `Map` instead of the expected type. The fix passes the full `JavaType` to `treeToValue`, consistent with how `decodeFromString` already works. This also removes the now-unnecessary `@Suppress("UNCHECKED_CAST")` and explicit `as T` cast. closes JetBrains#2115
Andrey Bragin (EugeneTheDev)
pushed a commit
that referenced
this pull request
Jun 15, 2026
…serve generics (#2116) `JacksonSerializer.decodeFromJSONElement` was passing `javaType.rawClass` to `objectMapper.treeToValue`, discarding generic type parameters. This causes parameterized types (e.g. `List<Person>`) to deserialize elements as `Map` instead of the expected type. The fix passes the full `JavaType` to `treeToValue`, consistent with how `decodeFromString` already works. This also removes the now-unnecessary `@Suppress("UNCHECKED_CAST")` and explicit `as T` cast. closes #2115 (cherry picked from commit 58a8168)
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.
JacksonSerializer.decodeFromJSONElementwas passingjavaType.rawClasstoobjectMapper.treeToValue, discarding generic type parameters. This causes parameterized types (e.g.List<Person>) to deserialize elements asMapinstead of the expected type.The fix passes the full
JavaTypetotreeToValue, consistent with howdecodeFromStringalready works. This also removes the now-unnecessary@Suppress("UNCHECKED_CAST")and explicitas Tcast.closes #2115