RFR: 8364277: (fs) BasicFileAttributes.isDirectory and isOther return true for NTFS directory junctions when links not followed [v2]
Brian Burkhalter
bpb at openjdk.org
Tue Aug 5 19:31:04 UTC 2025
On Tue, 5 Aug 2025 18:27:13 GMT, Johannes Döbler <duke at openjdk.org> wrote:
>> Brian Burkhalter has updated the pull request incrementally with one additional commit since the last revision:
>>
>> 8364277: 1) Add and use package scope isDirectoryJunction(); 2) Remove explicit delete of junction from test
>
> test/lib/jdk/test/lib/util/FileUtils.java line 463:
>
>> 461: return createWinDirectoryJunction(junction, target);
>> 462: } else {
>> 463: Files.createSymbolicLink(Path.of(junction), Path.of(target));
>
> Suggestion: Junctions are Windows-only, so why not throw a RuntimeException for the non-windows case (and maybe also rename the method to something like `createWindowsDirectoryJunction`)
A `RuntimeException` for non-Windows, i.e., Unix, would be a test failure and we can't have that. I think it would be better to convert the test to JUnit 5 and use [@EnabledOnOs(OS.WINDOWS)](https://docs.junit.org/5.2.0/api/org/junit/jupiter/api/condition/EnabledOnOs.html), but that might not be in this PR.
-------------
PR Review Comment: https://git.openjdk.org/jdk/pull/26631#discussion_r2255155387
More information about the core-libs-dev
mailing list