Skip to content
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

8274879: Replace uses of StringBuffer with StringBuilder within java.base classes #5432

Conversation

turbanoff
Copy link
Member

@turbanoff turbanoff commented Sep 9, 2021

StringBuffer is a legacy synchronized class. There are more modern alternatives which perform better:

  1. Plain String concatenation should be preferred
  2. StringBuilder is a direct replacement to StringBuffer which generally have better performance

In JDK-8264029 I migrated only usages which were automatically detected by IDEA. It turns out there are more usages which can be migrated.


Progress

  • Change must not contain extraneous whitespace
  • Commit message must refer to an issue
  • Change must be properly reviewed

Issue

  • JDK-8274879: Replace uses of StringBuffer with StringBuilder within java.base classes

Reviewers

Reviewing

Using git

Checkout this PR locally:
$ git fetch https://git.openjdk.java.net/jdk pull/5432/head:pull/5432
$ git checkout pull/5432

Update a local copy of the PR:
$ git checkout pull/5432
$ git pull https://git.openjdk.java.net/jdk pull/5432/head

Using Skara CLI tools

Checkout this PR locally:
$ git pr checkout 5432

View PR using the GUI difftool:
$ git pr show -t 5432

Using diff file

Download this PR as a diff file:
https://git.openjdk.java.net/jdk/pull/5432.diff

@bridgekeeper
Copy link

bridgekeeper bot commented Sep 9, 2021

👋 Welcome back turbanoff! A progress list of the required criteria for merging this PR into master will be added to the body of your pull request. There are additional pull request commands available for use with this pull request.

@openjdk
Copy link

openjdk bot commented Sep 9, 2021

@turbanoff The following labels will be automatically applied to this pull request:

  • core-libs
  • i18n
  • net
  • security

When this pull request is ready to be reviewed, an "RFR" email will be sent to the corresponding mailing lists. If you would like to change these labels, use the /label pull request command.

@openjdk openjdk bot added security security-dev@openjdk.org core-libs core-libs-dev@openjdk.org net net-dev@openjdk.org i18n i18n-dev@openjdk.org labels Sep 9, 2021
StringBuffer is a legacy synchronized class. There are more modern alternatives which perform better:
1. Plain String concatenation should be preferred
2. StringBuilder is a direct replacement to StringBuffer which generally have better performance
@turbanoff turbanoff force-pushed the cleanup_usages_of_StringBuffer_in_java_modules branch from 80dfad7 to 8f05ed5 Compare October 6, 2021 18:51
@turbanoff turbanoff changed the title [PATCH] Cleanup usages of StringBuffer in java modules [PATCH] Cleanup usages of StringBuffer in java.base module Oct 7, 2021
@turbanoff turbanoff changed the title [PATCH] Cleanup usages of StringBuffer in java.base module 8274879: Replace uses of StringBuffer with StringBuilder within java.base classes Oct 7, 2021
@openjdk openjdk bot added the rfr Pull request is ready for review label Oct 7, 2021
@mlbridge
Copy link

mlbridge bot commented Oct 7, 2021

Webrevs

…base classes

revert changes in spec to avoid CSR
@openjdk
Copy link

openjdk bot commented Oct 12, 2021

@turbanoff This change now passes all automated pre-integration checks.

ℹ️ This project also has non-automated pre-integration requirements. Please see the file CONTRIBUTING.md for details.

After integration, the commit message for the final commit will be:

8274879: Replace uses of StringBuffer with StringBuilder within java.base classes

Reviewed-by: naoto

You can use pull request commands such as /summary, /contributor and /issue to adjust it as needed.

At the time when this comment was updated there had been 252 new commits pushed to the master branch:

  • 9f75d5c: 8259948: Aarch64: Add cast nodes for Aarch64 Neon backend
  • d98b7c2: 8202926: Test java/awt/Focus/WindowUpdateFocusabilityTest/WindowUpdateFocusabilityTest.html fails
  • b0d1e4f: 8273585: String.charAt performance degrades due to JDK-8268698
  • 7addcd7: 8276034: ProblemList gtest dll_address_to_function_and_library_name on macosx-x64
  • 2448b3f: 8275874: [JVMCI] only support aligned reads in c2v_readFieldValue
  • f1f5e26: 8275872: Sync J2DBench run and analyze Makefile targets with build.xml
  • 19f76c2: 8275079: Remove unnecessary conversion to String in java.net.http
  • e5cd269: 8274944: AppCDS dump causes SEGV in VM thread while adjusting lambda proxy class info
  • 82f4aac: 8259609: C2: optimize long range checks in long counted loops
  • 574f890: 8275720: CommonComponentAccessibility.createWithParent isWrapped causes mem leak
  • ... and 242 more: https://git.openjdk.java.net/jdk/compare/9945f7a0744db2470bcfa856e8f831b6a6eb2de8...master

As there are no conflicts, your changes will automatically be rebased on top of these commits when integrating. If you prefer to avoid this automatic rebasing, please check the documentation for the /integrate command for further details.

As you do not have Committer status in this project an existing Committer must agree to sponsor your change. Possible candidates are the reviewers of this PR (@naotoj) but any other Committer may sponsor as well.

➡️ To flag this PR as ready for integration with the above commit message, type /integrate in a new comment. (Afterwards, your sponsor types /sponsor in a new comment to perform the integration).

@openjdk openjdk bot added the ready Pull request is ready to be integrated label Oct 12, 2021
@turbanoff
Copy link
Member Author

/integrate

@openjdk openjdk bot added the sponsor Pull request is ready to be sponsored label Oct 27, 2021
@openjdk
Copy link

openjdk bot commented Oct 27, 2021

@turbanoff
Your change (at version c8d68c2) is now ready to be sponsored by a Committer.

@naotoj
Copy link
Member

naotoj commented Oct 27, 2021

/sponsor

@openjdk
Copy link

openjdk bot commented Oct 27, 2021

Going to push as commit 9a3e954.
Since your change was applied there have been 263 commits pushed to the master branch:

  • e6fa5fa: 8276063: ProblemList gtest dll_address_to_function_and_library_name on macosx-generic
  • 809488b: 8276046: codestrings.validate_vm gtest fails on ppc64, s390
  • 93be099: 4718400: Many quantities are held as signed that should be unsigned
  • 168081e: 8270490: Charset.forName() taking fallback default value
  • a292733: 8275975: Remove dead code in ciInstanceKlass
  • 4060602: 8275800: Redefinition leaks MethodData::_extra_data_lock
  • 485d658: 8275851: Deproblemlist open/test/jdk/javax/swing/JComponent/6683775/bug6683775.java
  • b3f45f8: 8275689: [TESTBUG] Use color tolerance only for XRender in BlitRotateClippedArea test
  • 6c05cc9: 8275863: Use encodeASCII for ASCII-compatible DoubleByte encodings
  • 2f979ec: 8213120: java/awt/TextArea/AutoScrollOnSelectAndAppend/AutoScrollOnSelectAndAppend.java fails on mac10.13
  • ... and 253 more: https://git.openjdk.java.net/jdk/compare/9945f7a0744db2470bcfa856e8f831b6a6eb2de8...master

Your commit was automatically rebased without conflicts.

@openjdk openjdk bot closed this Oct 27, 2021
@openjdk openjdk bot added integrated Pull request has been integrated and removed ready Pull request is ready to be integrated rfr Pull request is ready for review sponsor Pull request is ready to be sponsored labels Oct 27, 2021
@openjdk
Copy link

openjdk bot commented Oct 27, 2021

@naotoj @turbanoff Pushed as commit 9a3e954.

💡 You may see a message that your pull request was closed with unmerged commits. This can be safely ignored.

@turbanoff turbanoff deleted the cleanup_usages_of_StringBuffer_in_java_modules branch February 21, 2022 12:35
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
core-libs core-libs-dev@openjdk.org i18n i18n-dev@openjdk.org integrated Pull request has been integrated net net-dev@openjdk.org security security-dev@openjdk.org
2 participants