RFR: 8262742: (fs) Add Path::resolve with varargs string

Jaikiran Pai jpai at openjdk.org
Mon Jul 10 06:22:54 UTC 2023


On Mon, 10 Jul 2023 06:15:29 GMT, Alan Bateman <alanb at openjdk.org> wrote:

>> src/java.base/share/classes/java/nio/file/Path.java line 553:
>> 
>>> 551:     default Path resolve(Path first, Path... more) {
>>> 552:         Path result = resolve(first);
>>> 553:         for (Path p : more) {
>> 
>> Hello Brian, do you think there should be a `@throws NullPointerException` in the javadoc, if any of these `Path` values is `null`?
>
>> Hello Brian, do you think there should be a `@throws NullPointerException` in the javadoc, if any of these `Path` values is `null`?
> 
> There is a paragraph in the package description to cover this, it avoids cluttering the methods with "@throws NPE".

You're right indeed. The `package-info.java` does say:


   Unless otherwise noted, passing a {@code null} argument to a
 * constructor or method in any class or interface in this package
 * will cause a {@link java.lang.NullPointerException
 * NullPointerException} to be thrown.

Before commenting, I had checked if the class level documentation had this detail and didn't see it, but I had forgotten to check package level documentation.

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

PR Review Comment: https://git.openjdk.org/jdk/pull/14805#discussion_r1257759329


More information about the nio-dev mailing list