On Sat, 6 Aug 2022 08:08:43 GMT, Jaikiran Pai <j...@openjdk.org> wrote:
> Can I please get a review of this change which proposes to fix > https://bugs.openjdk.org/browse/JDK-8290041? > > As noted by the reporter, the current implementation is buggy since the > calculation can result in a different value of the hashcode depending on the > order of iteration of the `Modifier`s. The commit in this PR changes that > computation to produce consistent result irrespective of the order in which > the `Modifier`s (enum) is iterated upon. > > A new test has been added which reproduces the issue and verifies the fix. > Sorry for joining late. I noticed that modsHashCode is a private method and > it takes Iterable> as a parameter. But everywhere it is called, a Set> is > passed to it. So why not just calling the set.hashCode() and be done with it? > It may be even more optimal in some cases. There's a lot going on here as the hash code is generated at link time and we also want it to be reproducible across builds. We also had a CDS bug with the the way that Enum objects were archived - Ioi has fixed that in JDK 19 so we have one less thing to be concerned about now. ------------- PR: https://git.openjdk.org/jdk/pull/9790