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

8297682: Use Collections.emptyIterator where applicable #11025

Closed

Conversation

turbanoff
Copy link
Member

@turbanoff turbanoff commented Nov 7, 2022

Instead of Collections.emptyList().iterator() we can use Collections.emptyIterator() method.
Actual implementation of java.util.Collections.EmptyList#iterator does exactly this - just calls emptyIterator method.


Progress

  • Change must be properly reviewed (1 review required, with at least 1 Reviewer)
  • Change must not contain extraneous whitespace
  • Commit message must refer to an issue

Issue

  • JDK-8297682: Use Collections.emptyIterator where applicable

Reviewers

Reviewing

Using git

Checkout this PR locally:
$ git fetch https://git.openjdk.org/jdk pull/11025/head:pull/11025
$ git checkout pull/11025

Update a local copy of the PR:
$ git checkout pull/11025
$ git pull https://git.openjdk.org/jdk pull/11025/head

Using Skara CLI tools

Checkout this PR locally:
$ git pr checkout 11025

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

Using diff file

Download this PR as a diff file:
https://git.openjdk.org/jdk/pull/11025.diff

@bridgekeeper
Copy link

bridgekeeper bot commented Nov 7, 2022

👋 Welcome back aturbanov! 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 Nov 7, 2022

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

  • compiler
  • nio

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 nio nio-dev@openjdk.org compiler compiler-dev@openjdk.org labels Nov 7, 2022
Copy link
Contributor

@stsypanov stsypanov left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@turbanoff turbanoff changed the title [PATCH] Use Collections.emptyIterator where applicable 8297682: Use Collections.emptyIterator where applicable Nov 27, 2022
@openjdk openjdk bot added the rfr Pull request is ready for review label Nov 27, 2022
@mlbridge
Copy link

mlbridge bot commented Nov 27, 2022

Webrevs

Copy link
Contributor

@AlanBateman AlanBateman left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The change to UnixFileSystem::getRootDirectories looks okay.

@openjdk
Copy link

openjdk bot commented Nov 27, 2022

@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:

8297682: Use Collections.emptyIterator where applicable

Reviewed-by: stsypanov, alanb, jpai

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

  • 619b68c: 8294540: Remove Opaque2Node: it is broken and triggers assert
  • 82561de: 8296384: [TESTBUG] sun/security/provider/SecureRandom/AbstractDrbg/SpecTest.java intermittently timeout
  • 61b7093: 8297872: Non-local G1MonotonicArenaFreePool::_freelist_pool has non-trivial ctor/dtor
  • 3b3bbe5: 8296907: VMError: add optional callstacks, siginfo for secondary errors
  • a573923: 8297264: C2: Cast node is not processed again in CCP and keeps a wrong too narrow type which is later replaced by top
  • b49fd92: 8298055: AArch64: fastdebug build fails after JDK-8247645
  • 914ef07: 8297609: Add application/wasm MIME type for wasm file extension
  • a71d91b: 8298067: Persistent test failures after 8296012
  • 87572d4: 8298068: ProblemList tests failing due to JDK-8297235
  • 0edb5d0: 8297683: Use enhanced-for cycle instead of Enumeration in java.security.jgss
  • ... and 414 more: https://git.openjdk.org/jdk/compare/3baad069a65a0ac138a6aaabf451758672d12fbc...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.

➡️ To integrate this PR with the above commit message to the master branch, type /integrate in a new comment.

@openjdk openjdk bot added the ready Pull request is ready to be integrated label Nov 27, 2022
@@ -189,8 +189,7 @@ public Iterator<Path> iterator() {
sm.checkRead(rootDirectory.toString());
return allowedList.iterator();
} catch (SecurityException x) {
List<Path> disallowed = Collections.emptyList();
return disallowed.iterator();
return Collections.emptyIterator(); //disallowed
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Alternatively, you could use the exception parameter to capture that comment:

} catch (SecurityException disallowed) {

Copy link
Member

@jaikiran jaikiran left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

UnixFileSystem change looks OK to me.

@turbanoff
Copy link
Member Author

/integrate

@openjdk
Copy link

openjdk bot commented Dec 21, 2022

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

  • f36e144: 8299025: BMPImageReader.java readColorPalette could use staggeredReadByteStream
  • f56285c: 8299146: No copyright statement on ArtifactResolverException.java
  • 396a9bf: 8298913: Add override qualifiers to Relocation classes
  • 386db07: Merge
  • f4d7f43: 8299123: [BACKOUT] 4512626 Non-editable JTextArea provides no visual indication of keyboard focus
  • 03afec1: 8298162: Test PrintClasses hits assert when run with code that retransform classes
  • 03d9927: 8298061: vmTestbase/nsk/sysdict/vm/stress/btree/btree012/btree012.java failed with "fatal error: refcount has gone to zero"
  • 65fc058: 8298968: G1: Incorrect merged remset stats
  • 8dfb6d7: 8298651: Serial: Remove MarkSweep::follow_klass
  • de8153c: 8298526: JFR: Generate missing filename for time-bound recordings
  • ... and 684 more: https://git.openjdk.org/jdk/compare/3baad069a65a0ac138a6aaabf451758672d12fbc...master

Your commit was automatically rebased without conflicts.

@openjdk openjdk bot added the integrated Pull request has been integrated label Dec 21, 2022
@openjdk openjdk bot closed this Dec 21, 2022
@openjdk openjdk bot removed ready Pull request is ready to be integrated rfr Pull request is ready for review labels Dec 21, 2022
@openjdk
Copy link

openjdk bot commented Dec 21, 2022

@turbanoff Pushed as commit 85f9b37.

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
compiler compiler-dev@openjdk.org integrated Pull request has been integrated nio nio-dev@openjdk.org
5 participants