-
Notifications
You must be signed in to change notification settings - Fork 38.8k
Enhance toString method in SockJsFrame #35510
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Closed
Closed
Changes from 12 commits
Commits
Show all changes
13 commits
Select commit
Hold shift + click to select a range
fb8ae80
Enhance toString method in SockJsFrame for better content representation
polyglot-k ef243d4
Refactor SockJsFrame by removing unused imports
polyglot-k 0265b90
Add static methods for SockJsFrame creation and remove duplicates
polyglot-k 55a6b27
Fix formatting issues in SockJsFrame by organizing imports
polyglot-k b8ccc8d
Refactor toString method in SockJsFrame for improved readability and …
polyglot-k 318bda4
lint
polyglot-k c5facc7
Enhance SockJsFrame toString method for clarity and add truncated suffix
polyglot-k 5dd868b
Add truncation to toString method in SockJsFrame for content exceedin…
polyglot-k c59bcbc
Remove unnecessary author comment from toString method in SockJsFrame
polyglot-k b32958e
Fix formatting in SockJsFrame toString method for StringBuilder initi…
polyglot-k c784f0a
Fix formatting in SockJsFrame toString method for variable initializa…
polyglot-k c4e97d1
Rename truncatedSuffix to TRUNCATED_SUFFIX for consistency and clarity
polyglot-k 2e26f11
Refactor toString method in SockJsFrame for improved content preview …
polyglot-k File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
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
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.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why not use the String Builder for this part as well? This PR is trying to optimize for memory allocation after all.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thank you for the review.
Regarding the other
toString()methods, they also useStringBuilder, so I thought there’s no need for the unnecessary String objects to become GC targets in the JVM. Of course, I agree that the original code is more readable.My perspective is that the readability of this part isn’t particularly high, and concatenating immutable Strings in this way is generally considered an anti-pattern, so I opted to use a mutable
StringBuilder.I will revise the
returnpart as you suggested.@bclozel