RFR: 8340885: Desugar ZipCoder.Comparison

Eirik Bjørsnøs eirbjo at openjdk.org
Wed Sep 25 09:57:35 UTC 2024


On Wed, 25 Sep 2024 09:15:04 GMT, Claes Redestad <redestad at openjdk.org> wrote:

> This PR desugars the enum added by JDK-8301873 to reduce classes loaded on bootstrap and stored in the default CDS archive by 2.

Looks good to me, some minor suggestions inline.

src/java.base/share/classes/java/util/zip/ZipCoder.java line 59:

> 57: 
> 58:     /**
> 59:      * These values represents the three possible return values for

Consider simplifying to

Suggestion:

     * Constants representing the three possible return values for

src/java.base/share/classes/java/util/zip/ZipCoder.java line 69:

> 67:          * to the encoded string.
> 68:          */
> 69:         EXACT_MATCH = 1,

Would there be any (positive) performance implications of starting these at zero?

src/java.base/share/classes/java/util/zip/ZipFile.java line 1872:

> 1870:                     // Compare the lookup name with the name encoded in the CEN
> 1871:                     switch (zc.compare(name, cen, noff, nlen, addSlash)) {
> 1872:                         case ZipCoder.EXACT_MATCH:

This would perhaps read cleaner with a static import of the constants?

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

Marked as reviewed by eirbjo (Committer).

PR Review: https://git.openjdk.org/jdk/pull/21176#pullrequestreview-2327763749
PR Review Comment: https://git.openjdk.org/jdk/pull/21176#discussion_r1774928268
PR Review Comment: https://git.openjdk.org/jdk/pull/21176#discussion_r1774929175
PR Review Comment: https://git.openjdk.org/jdk/pull/21176#discussion_r1774931076


More information about the core-libs-dev mailing list