fix(serialization): Support primitive array serialization#4968
Merged
fix(serialization): Support primitive array serialization#4968
Conversation
🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
Comment on lines
+91
to
+101
| longs.add(l); | ||
| } | ||
| serializeCollection(writer, logger, longs); | ||
| } else if (object instanceof float[]) { | ||
| final List<Float> floats = new ArrayList<>(((float[]) object).length); | ||
| for (float f : ((float[]) object)) { | ||
| floats.add(f); | ||
| } | ||
| serializeCollection(writer, logger, floats); | ||
| } else if (object instanceof double[]) { | ||
| final List<Double> doubles = new ArrayList<>(((double[]) object).length); |
This comment was marked as outdated.
This comment was marked as outdated.
Sorry, something went wrong.
Member
There was a problem hiding this comment.
I think it's a good point, but we may also address it later in a different PR
Contributor
Performance metrics 🚀
|
| Revision | Plain | With Sentry | Diff |
|---|---|---|---|
| 5b66efd | 308.67 ms | 363.85 ms | 55.18 ms |
| fc5ccaf | 322.49 ms | 405.25 ms | 82.76 ms |
| 6405ec5 | 310.88 ms | 354.56 ms | 43.69 ms |
| d364ace | 382.77 ms | 443.21 ms | 60.44 ms |
| bbc35bb | 298.53 ms | 372.17 ms | 73.64 ms |
| 3d205d0 | 352.15 ms | 432.53 ms | 80.38 ms |
| 539ca63 | 313.51 ms | 355.43 ms | 41.92 ms |
| dba088c | 365.46 ms | 366.31 ms | 0.85 ms |
| fc5ccaf | 270.49 ms | 363.90 ms | 93.41 ms |
| fcec2f2 | 328.91 ms | 387.75 ms | 58.84 ms |
App size
| Revision | Plain | With Sentry | Diff |
|---|---|---|---|
| 5b66efd | 1.58 MiB | 2.13 MiB | 559.07 KiB |
| fc5ccaf | 1.58 MiB | 2.13 MiB | 557.54 KiB |
| 6405ec5 | 1.58 MiB | 2.12 MiB | 552.23 KiB |
| d364ace | 1.58 MiB | 2.11 MiB | 539.75 KiB |
| bbc35bb | 1.58 MiB | 2.12 MiB | 553.01 KiB |
| 3d205d0 | 1.58 MiB | 2.10 MiB | 532.97 KiB |
| 539ca63 | 1.58 MiB | 2.12 MiB | 551.41 KiB |
| dba088c | 1.58 MiB | 2.13 MiB | 558.99 KiB |
| fc5ccaf | 1.58 MiB | 2.13 MiB | 557.54 KiB |
| fcec2f2 | 1.58 MiB | 2.12 MiB | 551.50 KiB |
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.
📜 Description
Adds support for serializing primitive arrays (boolean[], byte[], short[], char[], int[], long[], float[], double[]) in
JsonObjectSerializer. Previously, only Object arrays were handled correctly and primitive arrays caused a class cast exception.💡 Motivation and Context
Fixes #4964
💚 How did you test it?
Added comprehensive unit tests for all 8 primitive array types (boolean[], byte[], short[], char[], int[], long[], float[], double[]) to verify correct serialization behavior.
📝 Checklist
sendDefaultPIIis enabled.🔮 Next steps