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

8274163: Use String.equals instead of String.compareTo in jdk.jcmd #5637

Conversation

turbanoff
Copy link
Member

@turbanoff turbanoff commented Sep 22, 2021

In several places, String.compareTo was compared with 0 ( via == 0 or != 0).
Instead of this, we can use String.equals calls. String.equals is faster and shorter.


Progress

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

Issue

  • JDK-8274163: Use String.equals instead of String.compareTo in jdk.jcmd

Reviewers

Reviewing

Using git

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

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

Using Skara CLI tools

Checkout this PR locally:
$ git pr checkout 5637

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

Using diff file

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

@bridgekeeper
Copy link

@bridgekeeper bridgekeeper bot commented Sep 22, 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 openjdk bot added the rfr label Sep 22, 2021
@openjdk
Copy link

@openjdk openjdk bot commented Sep 22, 2021

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

  • serviceability

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

@openjdk openjdk bot added the serviceability label Sep 22, 2021
@mlbridge
Copy link

@mlbridge mlbridge bot commented Sep 22, 2021

Webrevs

Copy link
Contributor

@plummercj plummercj left a comment

Looks good. Make sure you have done the appropriate testing.

@openjdk
Copy link

@openjdk openjdk bot commented Sep 22, 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:

8274163: Use String.equals instead of String.compareTo in jdk.jcmd

Reviewed-by: cjplummer, amenkov, sspitsyn

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 8 new commits pushed to the master branch:

  • 8b833bb: 8274048: IGV: Replace usages of Collections.sort with List.sort call
  • a74c099: 8252842: Extend jmap to support parallel heap dump
  • 2166ed1: 8273894: ConcurrentModificationException raised every time ReferralsCache drops referral
  • 1c6fa11: 8273979: move some os time related functions to os_posix for POSIX platforms
  • 45adc92: 8273578: javax/swing/JMenu/4515762/bug4515762.java fails on macOS 12
  • 0fbbe4c: 8274033: Some tier-4 CDS EpsilonGC tests throw OOM
  • 9d3379b: 8267356: AArch64: Vector API SVE codegen support
  • 6031388: 8273714: jdk/jfr/api/consumer/TestRecordedFrame.java still times out after JDK-8273047

Please see this link for an up-to-date comparison between the source branch of this pull request and the master branch.
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 (@plummercj, @alexmenkov, @sspitsyn) 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 label Sep 22, 2021
Copy link
Contributor

@sspitsyn sspitsyn left a comment

Looks good.
Thanks,
Serguei

@turbanoff
Copy link
Member Author

@turbanoff turbanoff commented Sep 23, 2021

/integrate

@openjdk openjdk bot added the sponsor label Sep 23, 2021
@openjdk
Copy link

@openjdk openjdk bot commented Sep 23, 2021

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

@bridgekeeper
Copy link

@bridgekeeper bridgekeeper bot commented Oct 21, 2021

@turbanoff This pull request has been inactive for more than 4 weeks and will be automatically closed if another 4 weeks passes without any activity. To avoid this, simply add a new comment to the pull request. Feel free to ask for assistance if you need help with progressing this pull request towards integration!

@turbanoff
Copy link
Member Author

@turbanoff turbanoff commented Nov 15, 2021

/open

@openjdk
Copy link

@openjdk openjdk bot commented Nov 15, 2021

@turbanoff This pull request is already open

@sspitsyn
Copy link
Contributor

@sspitsyn sspitsyn commented Nov 16, 2021

/sponsor

@openjdk
Copy link

@openjdk openjdk bot commented Nov 16, 2021

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

  • 0bc2683: 8274190: Use String.equals instead of String.compareTo in jdk.internal.jvmstat
  • a9cb8bd: 8274168: Avoid String.compareTo == 0 to check String equality in java.management
  • 20f3872: 8274261: Use enhanced-for instead of plain 'for' in jdk.jcmd
  • b8d33a2: 8277029: JMM GetDiagnosticXXXInfo APIs should verify output array sizes
  • 1d79cfd: 8276229: Stop allowing implicit updates in G1BlockOffsetTable
  • 7719a74: 8277172: Remove stray comment mentioning instr_size_for_decode_klass_not_null on x64
  • e436200: 8008243: Zero: Implement fast bytecodes
  • bd92674: 8276184: Exclude lambda proxy class from the CDS archive if its caller class is excluded
  • a59c9b2: 8271515: Integration of JEP 417: Vector API (Third Incubator)
  • 9326eb1: 8276095: ciReplay: replay failure due to incomplete ciMethodData information
  • ... and 673 more: https://git.openjdk.java.net/jdk/compare/8821b0004170e18c8e7d6e5bbe8759344ff769b1...master

Your commit was automatically rebased without conflicts.

@openjdk openjdk bot closed this Nov 16, 2021
@openjdk openjdk bot added integrated and removed ready rfr sponsor labels Nov 16, 2021
@openjdk
Copy link

@openjdk openjdk bot commented Nov 16, 2021

@sspitsyn @turbanoff Pushed as commit 9629627.

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

@turbanoff turbanoff deleted the use_String.equals_instead_of_String.compareTo_jdk.jcmd branch Feb 21, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
integrated serviceability
4 participants