RFR: 8344078: Remove security manager dependency in java.nio

Alan Bateman alanb at openjdk.org
Fri Nov 15 09:05:59 UTC 2024


On Fri, 15 Nov 2024 05:37:43 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.

src/java.base/share/classes/sun/nio/ch/UnixDomainSockets.java line 62:

> 60:     }
> 61: 
> 62:     static UnixDomainSocketAddress getRevealedLocalAddress(SocketAddress sa) {

This method can be removed.

src/java.base/share/classes/sun/nio/ch/UnixDomainSockets.java line 74:

> 72:     private static native byte[] localAddress0(FileDescriptor fd) throws IOException;
> 73: 
> 74:     static String getRevealedLocalAddressAsString(SocketAddress sa) {

This method can be removed, replace with toString at the use-site.

src/java.base/windows/classes/sun/nio/ch/PipeImpl.java line 65:

> 63: 
> 64:     private static class Initializer
> 65:     {

The "{" can move back to the previous line now.

src/java.base/windows/classes/sun/nio/fs/WindowsChannelFactory.java line 307:

> 305:             }
> 306:         }
> 307: 

I assume the pathToCheck parameter should be removed from newFileChannel and open methods.

src/java.base/windows/classes/sun/nio/fs/WindowsFileSystem.java line 197:

> 195:                 return Collections.emptyList();
> 196:             }
> 197:         }

I assume this can just be replaced with `return FileStoreIterator::new;`.

src/java.base/windows/classes/sun/nio/fs/WindowsPath.java line 916:

> 914:         }
> 915:     }
> 916: 

I assume getPathForPermissionCheck() should be removed too.

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

PR Review Comment: https://git.openjdk.org/jdk/pull/22132#discussion_r1843401197
PR Review Comment: https://git.openjdk.org/jdk/pull/22132#discussion_r1843400845
PR Review Comment: https://git.openjdk.org/jdk/pull/22132#discussion_r1843417289
PR Review Comment: https://git.openjdk.org/jdk/pull/22132#discussion_r1843404057
PR Review Comment: https://git.openjdk.org/jdk/pull/22132#discussion_r1843405995
PR Review Comment: https://git.openjdk.org/jdk/pull/22132#discussion_r1843408457


More information about the nio-dev mailing list