JDK-8275509: (jlink) SystemModulesPlugin generates a jdk.internal.module.SystemModules$all.class which isn't reproducible

Jaikiran Pai jai.forums2013 at gmail.com
Tue Oct 19 13:52:27 UTC 2021


Hello Claes,

On 19/10/21 7:07 pm, Claes Redestad wrote:
> 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? 

You are right. That was what was causing the change in values. I just 
sent a separate reply in this thread with additional details.

> I think this should be fixed.

Okay, I'll pursue this path then.

>
> 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.

Understood. Thank you for these inputs.

-Jaikiran




More information about the core-libs-dev mailing list