RFR: 8350880: (zipfs) Add support for read-only zip file systems [v11]

Lance Andersen lancea at openjdk.org
Wed May 21 22:20:59 UTC 2025


On Wed, 21 May 2025 10:43:12 GMT, David Beaumont <duke at 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:
> 
>   Tweaking exact wording.

src/jdk.zipfs/share/classes/module-info.java line 279:

> 277:  *       <ul>
> 278:  *           <li>
> 279:  *               If no value is set, the file system is created <em>read-write</em>

created -> created as

I think it might be better as 

> If no value is specified, the file system is created as ....

src/jdk.zipfs/share/classes/module-info.java line 289:

> 287:  *               <em>read-only</em> file system requires the underlying ZIP file to
> 288:  *               already exist.
> 289:  *               Specifying {@code create} as {@code true} and {@code accessMode} as

> Specifying {@code  create} 

You should make this clear that it is the 'create property '

src/jdk.zipfs/share/classes/module-info.java line 291:

> 289:  *               Specifying {@code create} as {@code true} and {@code accessMode} as
> 290:  *               {@code readOnly} will cause an {@code IllegalArgumentException}
> 291:  *               to be thrown when creating the ZIP file system.

I 'think' this should be "cause a" or "result in a" for the usages  of "cause an" based on how the phrase is used

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

PR Review Comment: https://git.openjdk.org/jdk/pull/25178#discussion_r2101259671
PR Review Comment: https://git.openjdk.org/jdk/pull/25178#discussion_r2101262569
PR Review Comment: https://git.openjdk.org/jdk/pull/25178#discussion_r2101257012


More information about the core-libs-dev mailing list