On Tue, 11 Feb 2025 08:39:51 GMT, Per Minborg <pminb...@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? I'd prefer `Objects.requireNonNull(task, "task");` ------------- PR Review Comment: https://git.openjdk.org/jdk/pull/23050#discussion_r1952715499