On Sat, 11 Jan 2025 07:10:53 GMT, He-Pin(kerr) <d...@openjdk.org> wrote:
> Motivation: > When a user passes a wrong parameter, the current implementation throws an > IllegalArgumentException with an error message `null`, which is not helpful. > > Modification: > Add detail error messages. > > Result: > Helpful messages. src/java.base/share/classes/java/util/concurrent/AbstractExecutorService.java line 122: > 120: @Override > 121: public Future<?> submit(Runnable task) { > 122: if (task == null) throw new NullPointerException("task can't be > null"); Why not use `Objects.requireNonNull()` and break out the repeated code into a common method? test/jdk/java/util/concurrent/tck/ThreadPoolExecutorTest.java line 758: > 756: new ArrayBlockingQueue<Runnable>(10)); > 757: shouldThrow(); > 758: } catch (IllegalArgumentException success) { We could test the actual message here. ------------- PR Review Comment: https://git.openjdk.org/jdk/pull/23050#discussion_r1950433862 PR Review Comment: https://git.openjdk.org/jdk/pull/23050#discussion_r1950435392