RFR: 8358958: (aio) AsynchronousByteChannel.read/write should throw IAE if buffer is thread-confined [v2]

Jaikiran Pai jpai at openjdk.org
Thu Jun 12 11:24:34 UTC 2025


On Thu, 12 Jun 2025 06:31:21 GMT, Alan Bateman <alanb at openjdk.org> wrote:

>> test/jdk/java/nio/channels/etc/MemorySegments.java line 663:
>> 
>>> 661:         Arena arena = arenaSupplier.get();
>>> 662: 
>>> 663:         Path file = Files.createTempFile(Path.of(""), "foo", ".dat");
>> 
>> Is the use of an empty `Path` instead of `Path.of(".")` intentional here? The documentation of `Path` states:
>> 
>> 
>>> Accessing a file using an <i>empty path</i> is equivalent to accessing the default directory of the file system.
>> 
>> Unlike the current working directory, I couldn't find the definition of default directory. Are they the same for the default filesystem?
>
> Path.of("") is intentional here, using Path.of(".") would work the same way. The default directory has always been the current working directory (user.dir). Maybe the docs could be clearer on this but it would be significant work to review changes to long standing API docs.

I had a brief look for the "default directory" term within the JDK. It appears even in java.io area. So like you note it would need bigger work to make it clear. In any case, my question was more for understanding what the default directory resolves to and since it's the same as `Path.of(".")`, its usage itself is fine.

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

PR Review Comment: https://git.openjdk.org/jdk/pull/25691#discussion_r2142414605


More information about the nio-dev mailing list