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

David Beaumont duke at openjdk.org
Mon May 12 09:45:02 UTC 2025


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).

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

Commit messages:
 - Read only Zip file system support.

Changes: https://git.openjdk.org/jdk/pull/25178/files
  Webrev: https://webrevs.openjdk.org/?repo=jdk&pr=25178&range=00
  Issue: https://bugs.openjdk.org/browse/JDK-8350880
  Stats: 373 lines in 5 files changed: 310 ins; 20 del; 43 mod
  Patch: https://git.openjdk.org/jdk/pull/25178.diff
  Fetch: git fetch https://git.openjdk.org/jdk.git pull/25178/head:pull/25178

PR: https://git.openjdk.org/jdk/pull/25178


More information about the nio-dev mailing list