RFR: 8317678: Fix up hashCode() for ZipFile.Source.Key [v8]
Alan Bateman
alanb at openjdk.org
Fri Oct 20 16:48:38 UTC 2023
On Wed, 18 Oct 2023 15:59:13 GMT, Sean Coffey <coffeys at openjdk.org> wrote:
>> Fix up java.util.zip.ZipFile$Source hashCode() impl so that duplicate Source objects aren't created for the same zip file.
>
> Sean Coffey has updated the pull request incrementally with one additional commit since the last revision:
>
> Update lastModifiedTime comment
src/java.base/share/classes/java/util/zip/ZipFile.java line 1431:
> 1429: * the same file is opened more than once and where it has been
> 1430: * modified in the mean-time
> 1431: */
The code change to the hashCode method is fine but I think the comments added to both hashCode + equals are still a bit confusing because they hint that the last modified time is used to detect if a zip file has been modified. What would you think about dropping these comments and instead put a class file comment on Key to say that it represents a key to a zip file. It key is based on the file key if available, or the canonical path if the file key is not available. The key is also based on the file's last modified time to allow for cases where a zip file is re-opened after it has been modified.
-------------
PR Review Comment: https://git.openjdk.org/jdk/pull/16115#discussion_r1367246534
More information about the core-libs-dev
mailing list