This PR reorganizes `java.util.zip.ZipCoder` class hierarchies to handle UTF-8 
in the base class and move support for general charsets down to a subclass. 
This better reflects reality where most ZIP files are encoded using UTF-8. 

The motivation can be summarized as:

* Supporting the common case in the base class and the exceptional case in a 
subclass seems more natural and intuitive for maintainers
* We avoid loading both classes for most JVM instances
* A small performance improvement is observed, probably caused by unlocking 
effecively-monomorphic JVM optimizations

See core-libs-dev discussion for details: 
https://mail.openjdk.org/pipermail/core-libs-dev/2026-January/158281.html

I have tried to not move methods around too much,  making the side-by-side diff 
when ignoring whitespace easier to review. We can discuss further cleanups and 
reorganizaton if so desired. 

It may be useful to review commits individually. The first commit fe4a627 moves 
some methods out the way for the second commit 2926398. 

This PR also includes the similar change to the `ZipFileSystem` implementation 
of ZipCoder to keep these aligned. Could be pulled out to a separate PR if 
reviewers want to focus on a single area per PR.

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

Commit messages:
 - Make ZipFS ZipCoder base class UTF-8 to align with java.util.zip.ZipCoder
 - Merge branch 'master' into zipcoder-utf8-baseclass
 - Merge branch 'master' into zipcoder-utf8-baseclass
 - Reorganize such that the ZipCoder base class now handles UTF-8 and the new 
subclass CharsetZipCoder handles arbitrary charsets
 - Move some method out of the way for reorg

Changes: https://git.openjdk.org/jdk/pull/30640/files
  Webrev: https://webrevs.openjdk.org/?repo=jdk&pr=30640&range=00
  Issue: https://bugs.openjdk.org/browse/JDK-8376842
  Stats: 423 lines in 2 files changed: 178 ins; 172 del; 73 mod
  Patch: https://git.openjdk.org/jdk/pull/30640.diff
  Fetch: git fetch https://git.openjdk.org/jdk.git pull/30640/head:pull/30640

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

Reply via email to