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

Alan Bateman alanb at openjdk.org
Sat Aug 9 08:19:10 UTC 2025


On Sat, 9 Aug 2025 07:54:47 GMT, Volkan Yazici <vyazici at openjdk.org> wrote:

>> Add `null` check to `AsynchronousChannelGroupImpl.execute`; update existing test.
>
> 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...

AsynchronousChannelGroup does not implement Executor. The implementation in the JDK does and the bug report is where someone casts it to an Executor. So an off-piste usage that could break of the JDK implementation changes.

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

PR Review Comment: https://git.openjdk.org/jdk/pull/26709#discussion_r2264596678


More information about the nio-dev mailing list