RFR: 8344078: Remove security manager dependency in java.nio [v3]

Alan Bateman alanb at openjdk.org
Sat Nov 16 08:58:55 UTC 2024


On Sat, 16 Nov 2024 00:33:13 GMT, Brian Burkhalter <bpb at openjdk.org> wrote:

>> Expunge the use of the `SecurityManager`, `AccessController`, and the like from the `java.nio` and `sun.nio` package hierarchies.
>
> Brian Burkhalter has updated the pull request incrementally with one additional commit since the last revision:
> 
>   8344078: Address reviewer comments

src/java.base/share/classes/java/nio/channels/spi/AsynchronousChannelProvider.java line 95:

> 93:             Iterator<AsynchronousChannelProvider> i = sl.iterator();
> 94:             for (;;) {
> 95:                 return (i.hasNext()) ? i.next() : null;

The loop was only required to filter SecurityException so you change this to `return sl.findFirst().orElse(null);`

src/java.base/share/classes/java/nio/channels/spi/SelectorProvider.java line 113:

> 111:             Iterator<SelectorProvider> i = sl.iterator();
> 112:             for (;;) {
> 113:                 return i.hasNext() ? i.next() : null;

Same thing as AsynchronousChannelProvider here, the loop goes away, it can be replaced with `return sl.findFirst().orElse(null);`

-------------

PR Review Comment: https://git.openjdk.org/jdk/pull/22132#discussion_r1844940028
PR Review Comment: https://git.openjdk.org/jdk/pull/22132#discussion_r1844940207


More information about the nio-dev mailing list