On Thu, 18 Jul 2024 23:02:53 GMT, Chen Liang <li...@openjdk.org> wrote:
>> src/java.base/share/classes/java/lang/Process.java line 504: >> >>> 502: */ >>> 503: public boolean waitFor(Duration duration) throws >>> InterruptedException { >>> 504: Objects.requireNonNull(duration, "duration"); >> >> Does this explicit null-check pull its weight here? > > Maybe not, but when this method gets a custom implementation, people don't > have to remember to add a null check at front so there's no path that misses > the NPE. It isn't wrong, so I don't see a problem with this. Maybe it's a personal preference, but I think it is a good practice to explicitly check non-null for public APIs. Some recent methods in that class, such as `inputReader(Charset)` do it, so there are precedences. ------------- PR Review Comment: https://git.openjdk.org/jdk/pull/20220#discussion_r1683633761