Repository navigation
Avoid redundant unboxing & boxing for number adapters - #3175
Merged
eamonnmcmanus merged 1 commit intoNov 16, 2026
Merged
eamonnmcmanus merged 1 commit into
eamonnmcmanus merged 1 commit into
Conversation
E.g. avoid `Integer -> int -> Integer` and instead keep using the existing Integer object.
6 of 9 tasks
eamonnmcmanus
approved these changes
Nov 16, 2026
eamonnmcmanus
left a comment
Member
There was a problem hiding this comment.
Thanks! This looks fine.
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.
Purpose
Follow-up for #2998
Description
E.g. avoid
Integer -> int -> Integerand instead keep using the existingIntegerobject.The behavior remains the same; it still calls
value(Number).I have not measured the performance difference of this, maybe the JVM can optimize this code pattern already well (but only if the code is JIT compiled?) and this change is not needed.
Feel free to close this if you don't think it is useful.
Side note: I have not applied this to the
LongandDoublewhich currently callJsonWriter#value(long)and#value(double). The redundant boxing would only occur if the runtime type there isJsonTreeWriter; forJsonWriterit might (?) be more efficient to directly callvalue(long)andvalue(double)(as done by the current code) instead ofvalue(Number).