On Thu, 15 May 2025 22:42:15 GMT, Brian Burkhalter <b...@openjdk.org> wrote:

>> This change proposes to modify `java.io.File.delete()` so that regular files 
>> on Windows will not be deleted by default if their read-only attribute is 
>> set. A boolean-valued system compatibility property 
>> `jdk.io.File.deleteReadOnly` is defined to reinstate legacy behavior if 
>> desired.
>
> Brian Burkhalter has updated the pull request with a new target base due to a 
> merge or a rebase. The incremental webrev excludes the unrelated changes 
> brought in by the merge/rebase. The pull request contains five additional 
> commits since the last revision:
> 
>  - 8355954: Simplify test
>  - Merge
>  - 8355954: Fix HashedPasswordFileTest failure due to obsolete read-only 
> attribute being set
>  - 8355954: Address comments on naming in the PR
>  - 8355954: File.delete removes read-only files (win)

test/jdk/java/io/File/DeleteReadOnly.java line 47:

> 45: 
> 46:     private static final File DIR = new File(".", "dir");
> 47:     private static final File FILE = new File(DIR, "file");

If one of the tests fails then it will impact the test(s) that execute later. 
It might be better to just isolate them. deleteReadOnlyDirectory creates a 
directory that is used solely for that test, and deleteReadOnlyRegularFile 
creates a file that is used solely for that test.

test/jdk/java/io/File/DeleteReadOnly.java line 62:

> 60: 
> 61:         boolean deleted = FILE.delete();
> 62:         boolean shouldBeDeleted = !Platform.isWindows() || 
> DELETE_READ_ONLY;

The behavior and system property is Windows specific and might make things 
simpler to make it a Windows only test.

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

PR Review Comment: https://git.openjdk.org/jdk/pull/24977#discussion_r2092398839
PR Review Comment: https://git.openjdk.org/jdk/pull/24977#discussion_r2092395664

Reply via email to