Skip to content

8376842: Reorganize ZipCoder hierarchies to handle UTF8 in the base classes#30640

Open
eirbjo wants to merge 5 commits intoopenjdk:masterfrom
eirbjo:zipcoder-utf8-baseclass
Open

8376842: Reorganize ZipCoder hierarchies to handle UTF8 in the base classes#30640
eirbjo wants to merge 5 commits intoopenjdk:masterfrom
eirbjo:zipcoder-utf8-baseclass

Conversation

@eirbjo
Copy link
Copy Markdown
Contributor

@eirbjo eirbjo commented Apr 9, 2026

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.


Progress

  • Change must be properly reviewed (1 review required, with at least 1 Reviewer)
  • Change must not contain extraneous whitespace
  • Commit message must refer to an issue

Issue

  • JDK-8376842: Reorganize ZipCoder hierarchies to handle UTF8 in the base classes (Enhancement - P4)

Reviewing

Using git

Checkout this PR locally:
$ git fetch https://git.openjdk.org/jdk.git pull/30640/head:pull/30640
$ git checkout pull/30640

Update a local copy of the PR:
$ git checkout pull/30640
$ git pull https://git.openjdk.org/jdk.git pull/30640/head

Using Skara CLI tools

Checkout this PR locally:
$ git pr checkout 30640

View PR using the GUI difftool:
$ git pr show -t 30640

Using diff file

Download this PR as a diff file:
https://git.openjdk.org/jdk/pull/30640.diff

Using Webrev

Link to Webrev Comment

@bridgekeeper
Copy link
Copy Markdown

bridgekeeper bot commented Apr 9, 2026

👋 Welcome back eirbjo! A progress list of the required criteria for merging this PR into master will be added to the body of your pull request. There are additional pull request commands available for use with this pull request.

@openjdk
Copy link
Copy Markdown

openjdk bot commented Apr 9, 2026

❗ This change is not yet ready to be integrated.
See the Progress checklist in the description for automated requirements.

@openjdk openjdk bot added nio nio-dev@openjdk.org core-libs core-libs-dev@openjdk.org labels Apr 9, 2026
@openjdk
Copy link
Copy Markdown

openjdk bot commented Apr 9, 2026

@eirbjo The following labels will be automatically applied to this pull request:

  • core-libs
  • nio

When this pull request is ready to be reviewed, an "RFR" email will be sent to the corresponding mailing lists. If you would like to change these labels, use the /label pull request command.

@eirbjo eirbjo marked this pull request as ready for review April 9, 2026 08:08
@openjdk openjdk bot added the rfr Pull request is ready for review label Apr 9, 2026
@mlbridge
Copy link
Copy Markdown

mlbridge bot commented Apr 9, 2026

Webrevs

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

core-libs core-libs-dev@openjdk.org nio nio-dev@openjdk.org rfr Pull request is ready for review

Development

Successfully merging this pull request may close these issues.

1 participant