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

8274016: Replace 'for' cycles with iterator with enhanced-for in java.desktop #5578

Conversation

turbanoff
Copy link
Member

@turbanoff turbanoff commented Sep 19, 2021

There are few places in code where manual for loop is used with Iterator to iterate over Collection.
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: java compiler generates similar code when compiling enhanced-for cycle.
This is continuation of JDK-8258006


Progress

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

Issue

  • JDK-8274016: Replace 'for' cycles with iterator with enhanced-for in java.desktop

Reviewers

Reviewing

Using git

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

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

Using Skara CLI tools

Checkout this PR locally:
$ git pr checkout 5578

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

Using diff file

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

@bridgekeeper
Copy link

@bridgekeeper bridgekeeper bot commented Sep 19, 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.

@shipilev
Copy link
Contributor

@shipilev shipilev commented Sep 20, 2021

Once again, you have access to JIRA, so you can submit the RFEs for all these PRs yourself :)

@openjdk
Copy link

@openjdk openjdk bot commented Sep 20, 2021

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

  • client

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 client label Sep 20, 2021
@turbanoff turbanoff changed the title [PATCH] Replace 'for' cycles with iterator with enhanced-for in java.desktop 8274016: Replace 'for' cycles with iterator with enhanced-for in java.desktop Sep 20, 2021
@openjdk openjdk bot added the rfr label Sep 20, 2021
@mlbridge
Copy link

@mlbridge mlbridge bot commented Sep 20, 2021

Webrevs

….desktop

cleanup toArray conversion in SimpleRenderedImage
….desktop

drop useless comment
cleanup unused imports
mrserb
mrserb approved these changes Sep 25, 2021
@openjdk
Copy link

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

8274016: Replace 'for' cycles with iterator with enhanced-for in java.desktop

Reviewed-by: serb

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

  • 0865120: 8274345: make build-test-lib is broken
  • 75404ea: 8267636: Bump minimum boot jdk to JDK 17
  • 14100d5: 8274170: Add hooks for custom makefiles to augment jtreg test execution
  • daaa47e: 8274311: Make build.tools.jigsaw.GenGraphs more configurable
  • 2cffe4c: 8274326: [macos] Ensure initialisation of sun/lwawt/macosx/CAccessibility in JavaComponentAccessibility.m
  • 172900d: 8274255: Update javac messages to use "enum class" rather than "enum type"
  • b0983df: 8274074: SIGFPE with C2 compiled code with -XX:+StressGCM
  • 7436a77: 8274317: Unnecessary reentrant synchronized block in java.awt.Cursor
  • 7426fd4: 8274325: C4819 warning at vm_version_x86.cpp on Windows after JDK-8234160
  • e3aff8f: 8274289: jdk/jfr/api/consumer/TestRecordedFrameType.java failed with "RuntimeException: assertNotEquals: expected Interpreted to not equal Interpreted"
  • ... and 108 more: https://git.openjdk.java.net/jdk/compare/7c9868c0b3c9bd3d305e71f91596190813cdccce...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 (@mrserb) 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 25, 2021
@turbanoff
Copy link
Member Author

@turbanoff turbanoff commented Sep 27, 2021

/integrate

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

@openjdk openjdk bot commented Sep 27, 2021

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

@mrserb
Copy link
Member

@mrserb mrserb commented Sep 28, 2021

/sponsor

@openjdk
Copy link

@openjdk openjdk bot commented Sep 28, 2021

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

  • d8a278f: 8274396: Suppress more warnings on non-serializable non-transient instance fields in client libs
  • e49e5b5: 8273972: Multi-core choke point in CMM engine (LCMSTransform.doTransform)
  • 2072bc7: 8274391: Suppress more warnings on non-serializable non-transient instance fields in java.util.concurrent
  • 6a477bd: 8274415: Suppress warnings on non-serializable non-transient instance fields in java.xml
  • 67e52a3: 8273634: [TEST_BUG] Improve javax/swing/text/ParagraphView/6364882/bug6364882.java
  • b7425b6: 8239502: [TEST_BUG] Test javax/swing/text/FlowView/6318524/bug6318524.java never fails
  • c57a6c6: 8274265: Suspicious string concatenation in logTestUtils.inline.hpp
  • 6f4cefb: 8274394: Use Optional.isEmpty instead of !Optional.isPresent in jdk.jlink
  • 94f5e80: 8274276: Cache normalizedBase URL in URLClassPath.FileLoader
  • b36881f: 8274383: JNI call of getAccessibleSelection on a wrong thread
  • ... and 130 more: https://git.openjdk.java.net/jdk/compare/7c9868c0b3c9bd3d305e71f91596190813cdccce...master

Your commit was automatically rebased without conflicts.

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

@openjdk openjdk bot commented Sep 28, 2021

@mrserb @turbanoff Pushed as commit 1a29b1e.

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

@turbanoff turbanoff deleted the replace_for_cycle_with_iterator_with_enhanced-for_java.desktop branch Oct 4, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
client integrated
3 participants