On Thu, 15 May 2025 18:27:35 GMT, David Beaumont <d...@openjdk.org> wrote:

>> Adding read-only support to ZipFileSystem.
>> 
>> The new `accessMode` environment property allows for readOnly and readWrite 
>> values, and ensures that the requested mode is consistent with what's 
>> returned.
>> 
>> This involved a little refactoring to ensure that "read only" state was set 
>> initially and only unset at the end of initialization if appropriate.
>> 
>> By making 2 methods return values (rather than silently set non-final fields 
>> as a side effect) it's now clear in what order fields are initialized and 
>> which are final (sadly there are still non-final fields, but only a split of 
>> this class into two types can fix that, since determining multi-jar support 
>> requires reading the file system).
>
> David Beaumont has updated the pull request incrementally with one additional 
> commit since the last revision:
> 
>   Changes based on review feedback.

src/jdk.zipfs/share/classes/jdk/nio/zipfs/ZipFileSystem.java line 114:

> 112:     private final ZipPath rootdir;
> 113:     // Starts in readOnly (safe mode), but might be reset at the end of 
> initialization.
> 114:     private boolean readOnly = true;

If `readOnly` gets used by some code when a `ZipFileSystem` instance is being 
constructed (which is why I believe this can't be a `final` field), then I 
think we should not change this value to `true`. In other words, would this 
change now have a chance of introducing a `ReadOnlyFileSystemException` when 
constructing the `ZipFileSystem` whereas before it wouldn't?

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

PR Review Comment: https://git.openjdk.org/jdk/pull/25178#discussion_r2093154523

Reply via email to