JDK-8275509: (jlink) SystemModulesPlugin generates a jdk.internal.module.SystemModules$all.class which isn't reproducible
Claes Redestad
claes.redestad at oracle.com
Tue Oct 19 13:37:06 UTC 2021
On 2021-10-19 14:31, Jaikiran Pai wrote:
> The other option I experimented with was to make
> ModuleDescriptor#hashCode() generate the same hashcode across multiple
> JVM runs. Although I do have a "working" version of that change, I
> decided not to spend too much time on it because the
> java.lang.Object#hashCode() contract itself clearly states that this
> value isn't expected to be same across multiple JVM runs. So whatever
> I do here is going to be brittle.
I'm assuming the cause for ModuleDescriptor#hashCode being is due to the
various enums not having an explicitly defined hashCode? I think this
should be fixed.
Either way you're going to be brittle since the patch to emit a 0 is
relying on the ModuleDescriptor#hashCode implementation disallowing 0 as
a hash value (a 0 will force a recalculation). While it'll only happen
at most once per module these relatively expensive calculations are
something we want to avoid on startup if we can do so for free.
/Claes
More information about the core-libs-dev
mailing list