RFR: 8317678: Fix up hashCode() for ZipFile.Source.Key [v4]

Alan Bateman alanb at openjdk.org
Mon Oct 16 07:59:52 UTC 2023


On Fri, 13 Oct 2023 12:18:41 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:
> 
>   minor test edits and comment updates

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

> 1428:             public int hashCode() {
> 1429:                 long t = utf8 ? 0 : Long.MAX_VALUE;
> 1430:                 t += attrs.lastModifiedTime().toMillis();

ZipFile cannot tolerate a zip file being changed while in use. I realise you don't want to change this part of the code but I think it is desperately needs a comment in both hashCode and equals to explain why the last modified time is included.

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

PR Review Comment: https://git.openjdk.org/jdk/pull/16115#discussion_r1360269216


More information about the core-libs-dev mailing list