RFR: 8344078: Remove security manager dependency in java.nio
Alan Bateman
alanb at openjdk.org
Fri Nov 15 08:13:18 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.
CopyMoveHelper needs to be updated too.
src/java.base/linux/classes/sun/nio/ch/DefaultSelectorProvider.java line 34:
> 32: public class DefaultSelectorProvider {
> 33: private static final SelectorProviderImpl INSTANCE =
> 34: new EPollSelectorProvider();
You should be able to put it on the same line, same thing in the other implementations.
src/java.base/share/classes/java/nio/channels/spi/SelectorProvider.java line 116:
> 114: return i.hasNext() ? i.next() : null;
> 115: } catch (ServiceConfigurationError sce) {
> 116: throw sce;
There's no need to catch ServiceConfigurationError now, same thing in AsynchronousChannelProvider, Charset ...
src/java.base/share/classes/java/nio/file/FileTreeWalker.java line 206:
> 204: // if attributes are cached then use them if possible
> 205: if (canUseCached &&
> 206: (file instanceof BasicFileAttributesHolder))
We can replace this with `if ((canUseCached && (file instanceof BasicFileAttributesHolde holder) {` and it would make it a lot more readable.
src/java.base/share/classes/sun/nio/ch/Net.java line 218:
> 216: * Returns the local address
> 217: */
> 218: static InetSocketAddress getRevealedLocalAddress(SocketAddress sa) {
This method should be removed.
src/java.base/share/classes/sun/nio/ch/Net.java line 223:
> 221: }
> 222:
> 223: static String getRevealedLocalAddressAsString(SocketAddress sa) {
This method should be removed too.
-------------
PR Comment: https://git.openjdk.org/jdk/pull/22132#issuecomment-2478190884
PR Review Comment: https://git.openjdk.org/jdk/pull/22132#discussion_r1843321219
PR Review Comment: https://git.openjdk.org/jdk/pull/22132#discussion_r1843325337
PR Review Comment: https://git.openjdk.org/jdk/pull/22132#discussion_r1843337667
PR Review Comment: https://git.openjdk.org/jdk/pull/22132#discussion_r1843326286
PR Review Comment: https://git.openjdk.org/jdk/pull/22132#discussion_r1843326483
More information about the nio-dev
mailing list