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

8274395: Use enhanced-for instead of plain 'for' in jdk.internal.jvmstat #5580

Conversation

turbanoff
Copy link
Member

@turbanoff turbanoff commented Sep 20, 2021

There are few places in code where manual for loop is used with Iterator to iterate over Collection or Array.
Instead of manual for cycles it's preferred to use enhanced-for cycle instead: it's less verbose, makes code easier to read and it's less error-prone.
It doesn't have any performance impact: javac compiler generates similar code when compiling enhanced-for cycle.
Similar cleanups:

  1. JDK-8274016 java.desktop
  2. JDK-8274237 java.base
  3. JDK-8274261 jdk.jcmd
  4. JDK-8274318 java.management

Progress

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

Issue

  • JDK-8274395: Use enhanced-for instead of plain 'for' in jdk.internal.jvmstat

Reviewers

Reviewing

Using git

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

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

Using Skara CLI tools

Checkout this PR locally:
$ git pr checkout 5580

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

Using diff file

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

@bridgekeeper
Copy link

@bridgekeeper bridgekeeper bot commented Sep 20, 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 openjdk bot commented Sep 20, 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 20, 2021
@turbanoff turbanoff changed the title [PATCH] Use enhanced-for instead of plain for in jdk.internal.jvmstat 8274395: Use enhanced-for instead of plain 'for' in jdk.internal.jvmstat Sep 27, 2021
@openjdk openjdk bot added the rfr label Sep 27, 2021
@mlbridge
Copy link

@mlbridge mlbridge bot commented Sep 27, 2021

Webrevs

Copy link
Contributor

@plummercj plummercj left a comment

You need a copyright update in TypeCode.java. Otherwise the changes look good.

@openjdk
Copy link

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

8274395: Use enhanced-for instead of plain 'for' in jdk.internal.jvmstat

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

  • 7e73bca: 8276408: Deprecate Runtime.exec methods with a single string command line argument
  • 75adf54: 8276306: jdk/jshell/CustomInputToolBuilder.java fails intermittently on storage acquisition
  • 7320b77: 8276548: Use range based visitor for Howl-Full cards
  • ea23e73: 8249004: Reduce ThreadsListHandle overhead in relation to direct handshakes
  • c815c5c: 8276209: Some call sites doesn't pass the parameter 'size' to SharedRuntime::dtrace_object_alloc(_base)
  • 71c4b19: 8276562: Fix to JDK-8263155 left out the help text changes
  • cc2cac1: 8274686: java.util.UUID#hashCode() should use Long.hashCode()
  • 0c2d00b: 8275097: Wrong span of the 'default' tag
  • fa754b8: 8276149: jshell throws EOF error when throwing exception inside switch expression
  • 4c14edd: 8274734: the method jdk.jshell.SourceCodeAnalysis documentation not working
  • ... and 8 more: https://git.openjdk.java.net/jdk/compare/2653cfbf0f316183ea23dd234896b44f7dd6eae0...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 (@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 27, 2021
Copy link
Contributor

@sspitsyn sspitsyn left a comment

Looks good.
Thanks,
Serguei

@turbanoff
Copy link
Member Author

@turbanoff turbanoff commented Sep 30, 2021

/integrate

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

@openjdk openjdk bot commented Sep 30, 2021

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

@bridgekeeper
Copy link

@bridgekeeper bridgekeeper bot commented Oct 28, 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 7, 2021

Can someone sponsor the changes please?

…d-for_in_jdk.internal.jvmstat

# Conflicts:
#	src/jdk.internal.jvmstat/share/classes/sun/jvmstat/perfdata/monitor/protocol/local/LocalVmManager.java
@openjdk openjdk bot removed the sponsor label Nov 7, 2021
@plummercj
Copy link
Contributor

@plummercj plummercj commented Nov 8, 2021

/sponsor

@openjdk
Copy link

@openjdk openjdk bot commented Nov 8, 2021

@plummercj The PR has been updated since the change author (@turbanoff) issued the integrate command - the author must perform this command again.

@turbanoff
Copy link
Member Author

@turbanoff turbanoff commented Nov 8, 2021

/integrate

@openjdk openjdk bot added the sponsor label Nov 8, 2021
@openjdk
Copy link

@openjdk openjdk bot commented Nov 8, 2021

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

@plummercj
Copy link
Contributor

@plummercj plummercj commented Nov 9, 2021

/sponsor

@openjdk
Copy link

@openjdk openjdk bot commented Nov 9, 2021

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

  • e35abe3: 8256208: Javadoc's generated overview does not show classes of unnamed package
  • f65db88: 8276841: Add support for Visual Studio 2022
  • c27afb3: 8276863: Remove test/jdk/sun/security/ec/ECDSAJavaVerify.java
  • e198594: 8250678: ModuleDescriptor.Version parsing treats empty segments inconsistently
  • 4bd5bfd: 8276731: Metaspace chunks are uncommitted twice
  • 5c7f77c: 8276850: Remove outdated comment in HeapRegionManager::par_iterate
  • 945f408: 8276098: Do precise BOT updates in G1 evacuation phase
  • 8747882: 8276790: Rename GenericCDSFileMapHeader::_base_archive_path_offset
  • 38e6d5d: 8276677: Malformed Javadoc inline tags in JDK source in javax/net/ssl
  • a7dedb5: 8276772: Refine javax.lang.model docs
  • ... and 21 more: https://git.openjdk.java.net/jdk/compare/2653cfbf0f316183ea23dd234896b44f7dd6eae0...master

Your commit was automatically rebased without conflicts.

@openjdk openjdk bot closed this Nov 9, 2021
@openjdk openjdk bot added the integrated label Nov 9, 2021
@openjdk openjdk bot removed ready rfr sponsor labels Nov 9, 2021
@openjdk
Copy link

@openjdk openjdk bot commented Nov 9, 2021

@plummercj @turbanoff Pushed as commit 93692ea.

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

@turbanoff turbanoff deleted the cleanup_use_enhanced-for_in_jdk.internal.jvmstat 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