RFR: 8220816: (fs) Files.createDirectory should make it more obvious that it fails when the directory already exists [v2]

Justin Lu jlu at openjdk.org
Tue Nov 18 21:48:14 UTC 2025


On Tue, 18 Nov 2025 17:53:51 GMT, Brian Burkhalter <bpb at openjdk.org> wrote:

>> Slightly changes the specification of `Files.createDirectory` to highlight that it fails if a filesystem entity already exists at the given location.
>
> Brian Burkhalter has updated the pull request incrementally with one additional commit since the last revision:
> 
>   8220816: "directory" -> "file or directory"

Wording looks reasonable to me. I presume the CSR will be filed after wording is finalized.

src/java.base/share/classes/java/nio/file/Files.java line 640:

> 638:      *          when creating the directory
> 639:      * @throws  FileAlreadyExistsException
> 640:      *          if a directory could not otherwise be created because a file of

Is it worth clarifying ..."file _or directory_"... in the `throws` tag as well?

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

PR Review: https://git.openjdk.org/jdk/pull/28378#pullrequestreview-3479777478
PR Review Comment: https://git.openjdk.org/jdk/pull/28378#discussion_r2539701953


More information about the nio-dev mailing list