RFR: 8376483: Avoid loading java.nio.charset.StandardCharsets in java.util.zip.ZipCoder

Eirik Bjørsnøs eirbjo at openjdk.org
Tue Jan 27 10:58:55 UTC 2026


Please review this class which removes a dependency on `java.nio.charset.StandardCharsets` introduced in [JDK-8365703](https://bugs.openjdk.org/browse/JDK-8365703).

We can use `UTF_8.INSTANCE` here as elsewhere in this class to prevent startup regression loading otherwise unused classes and charsets.

Verified that running `java -cp hello.jar Hello" observes the following diff in loaded classes when run with this PR:


< java.nio.charset.StandardCharsets
< sun.nio.cs.US_ASCII
< sun.nio.cs.ISO_8859_1
< sun.nio.cs.UTF_16BE
< sun.nio.cs.UTF_16LE
< sun.nio.cs.UTF_16
< sun.nio.cs.UTF_32BE
< sun.nio.cs.UTF_32LE
< sun.nio.cs.UTF_32


This is a strict refactoring, no tests updated, `noreg-trivial`.

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

Commit messages:
 - Avoid loading java.nio.charset.StandardCharsets

Changes: https://git.openjdk.org/jdk/pull/29443/files
  Webrev: https://webrevs.openjdk.org/?repo=jdk&pr=29443&range=00
  Issue: https://bugs.openjdk.org/browse/JDK-8376483
  Stats: 3 lines in 1 file changed: 0 ins; 1 del; 2 mod
  Patch: https://git.openjdk.org/jdk/pull/29443.diff
  Fetch: git fetch https://git.openjdk.org/jdk.git pull/29443/head:pull/29443

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


More information about the core-libs-dev mailing list