On Thu, 19 Dec 2024 00:36:44 GMT, Brian Burkhalter <b...@openjdk.org> wrote:

> Update the specification of `java.io.File.exists()` to match its behavior, 
> which seems correct in the context of how the empty abstract pathname is 
> documented elsewhere in the class.

The `Files.exists(Path.of(""))` case returns `true` because 
`UnixPath.getByteArrayForSysCalls` has a special case that converts `""` to 
`"."`:

                // empty path case will access current directory
                byte[] here = { '.' };
                return here;

See [UnixPath.java, line 
142](https://github.com/openjdk/jdk/blob/4d77dbad4e15c5392878e7bc91cd8eb7ce49a482/src/java.base/unix/classes/sun/nio/fs/UnixPath.java#L142).

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

PR Comment: https://git.openjdk.org/jdk/pull/22821#issuecomment-2555699425

Reply via email to