On Tue, 11 Mar 2025 15:31:09 GMT, Eirik Bjørsnøs <eir...@openjdk.org> wrote:
> This seems mostly used to determine which ZipCoder to pick. Could we fold > this into the method, calling it zipCoderForPos and make it just return the > ZipCoder, like we had in Source? I intentionally removed the `zipCoderForPos()` method and instead introduced this static method to avoid the case where the code ends up calling this method and then stores the returned `ZipCoder` (like was being done in `Source`). Instead with this new method, it now allows the call sites to determine if a UTF8 `ZipCoder` is needed or a non-UTF8 one and then decide where to get the non-UTF8 `ZipCoder` from. If the call site is a instance method in `ZipFile`, then it was use the `ZipFile`'s `zipCoder` field and if the call site is within `Source`, when the `Source` is being instantiated then it constructs a non-UTF8 `ZipCoder` afresh. That level of detail is better dealt at the call site instead of a method like `zipCoderForPos()`. > src/java.base/share/classes/java/util/zip/ZipFile.java line 1744: > >> 1742: >> 1743: int entryPos = pos + CENHDR; >> 1744: final ZipCoder entryZipCoder; > > If you want to construct this lazily, then I think a comment documenting that > purpose would be useful here. Done. ------------- PR Review Comment: https://git.openjdk.org/jdk/pull/23986#discussion_r1990711952 PR Review Comment: https://git.openjdk.org/jdk/pull/23986#discussion_r1990713465