RFR: 8355954: File.delete removes read-only files (win) [v2]
Brian Burkhalter
bpb at openjdk.org
Thu May 1 18:31:38 UTC 2025
On Thu, 1 May 2025 12:40:02 GMT, Alan Bateman <alanb at openjdk.org> wrote:
>> Brian Burkhalter has updated the pull request incrementally with one additional commit since the last revision:
>>
>> 8355954: Address comments on naming in the PR
>
> src/java.base/windows/classes/java/io/WinNTFileSystem.java line 45:
>
>> 43:
>> 44: private static final boolean DELETE_READONLY =
>> 45: Boolean.getBoolean("jdk.io.File.deleteReadOnly");
>
> What would you think of allowDeleteReadOnlyFiles rather than deleteReadOnly?
Sounds better. So changed in efca3cf.
> src/java.base/windows/native/libjava/WinNTFileSystem_md.c line 665:
>
>> 663: BOOL attrSet = FALSE;
>> 664: if (deleteReadOnly && ((a & FILE_ATTRIBUTE_READONLY) != 0))
>> 665: attrSet = SetFileAttributesW(path, a & (~FILE_ATTRIBUTE_READONLY));
>
> A small comment on the name "attrSet". It hints that it will be set to TRUE if the attribute is set whereas the use here is to mean that SetFileAttributesW has succeeded, a bit confusing because it's clearing the READONLY value, not setting it. If you rename to something that has the word "modified" or "cleared" might be easy for future maintainers.
Name updated in efca3cf.
-------------
PR Review Comment: https://git.openjdk.org/jdk/pull/24977#discussion_r2070627406
PR Review Comment: https://git.openjdk.org/jdk/pull/24977#discussion_r2070627002
More information about the core-libs-dev
mailing list