RFR: 8364761: (aio) AsynchronousChannelGroup.execute doesn't check null command

Volkan Yazici vyazici at openjdk.org
Sat Aug 9 07:58:10 UTC 2025


On Sat, 9 Aug 2025 00:10:16 GMT, Brian Burkhalter <bpb at openjdk.org> wrote:

> Add `null` check to `AsynchronousChannelGroupImpl.execute`; update existing test.

LGTM

src/java.base/share/classes/sun/nio/ch/AsynchronousChannelGroupImpl.java line 303:

> 301:     @Override
> 302:     public final void execute(Runnable task) {
> 303:         Objects.requireNonNull(task, "task");

Do we need to add a `@throws NullPointerException if command is null` to the Javadoc? This is already stated in the Javadoc of the overriden method, but since we explicitly provide Javadoc for the override here...

test/jdk/java/nio/channels/AsynchronousChannelGroup/AsExecutor.java line 1:

> 1: /*

Just a thought: This test can be migrated to JUnit, and `@ParameterizedTest` can be used to provide `AsynchronousChannelGroup`s. This will make it easier to add new `AsynchronousChannelGroup`s and test cases.

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

Marked as reviewed by vyazici (Committer).

PR Review: https://git.openjdk.org/jdk/pull/26709#pullrequestreview-3102834912
PR Review Comment: https://git.openjdk.org/jdk/pull/26709#discussion_r2264587638
PR Review Comment: https://git.openjdk.org/jdk/pull/26709#discussion_r2264586927


More information about the nio-dev mailing list