RFR: 8275509: ModuleDescriptor.hashCode isn't reproducible across builds

Alan Bateman alanb at openjdk.java.net
Wed Nov 3 19:51:18 UTC 2021


On Wed, 3 Nov 2021 03:22:40 GMT, Jaikiran Pai <jai.forums2013 at gmail.com> wrote:

> So I decided to stick with using the ordinal modifiers in the hashCode() computation. However, I'm not an expert on the performance aspects of the Collections and how much using the modifiers for hashCode() will improve the performance in this case. Perhaps that's what you meant by it not giving a good (enough) spread? If so, do let me know and I'll go ahead and update the PR to remove using the modifiers in the hashCode() computation and also update the javadoc of each of those hashCode() methods which state that the modifiers are used in the hashCode() computation.

Okay, but we may have to re-visit this some time because summing the ordinals won't give a good spread, e.g. STATIC+SYNTHETIC will give the same value as TRANSITIVE. This is why I was saying it would be nearly the same to just leave them out. So let's go with it for now.

Thanks for the update to the test. The assertNotSame to check that they aren't the same instance looks a bit odd but at least you have a comment to explain it. I guess we should add an assertEquals to check that the 2 descriptors are equals too. Then I think we are done.

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

PR: https://git.openjdk.java.net/jdk/pull/6078


More information about the core-libs-dev mailing list