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

Alan Bateman Alan.Bateman at oracle.com
Thu Oct 21 12:25:10 UTC 2021


On 21/10/2021 10:49, Jaikiran Pai wrote:
> :
>
> Digging into it, it appears that since the ModuleDescriptor#equals() 
> calls equals() on enum types (in this specific case on 
> ModuleDescriptor.Requires.Modifier) and since enum type equality is 
> implemented as identity checks, those identity checks are surprisingly 
> failing. More specifically ModuleDescriptor.Requires.Modifier.MANDATED 
> == ModuleDescriptor.Requires.Modifier.MANDATED is equating to false 
> because at runtime I see that two different instances of 
> ModuleDescriptor.Requires.Modifier.MANDATED have been loaded (by the 
> same boot module classloader). Although I use 
> ModuleDescriptor.Requires.Modifier.MANDATED as an example, the same is 
> reproducible with other enum values like 
> ModuleDescriptor.Requires.Modifier.TRANSITIVE.
>
> This appears to be specific to CDS since running the above program with:
>
> java -Xshare:off EnumEquality
>
> succeeds and the ModuleDescriptor equality check passes.
>
> In short, it looks like there is some general issue with CDS and 
> equality checks with enums and perhaps deserves a separate JBS issue?
I've asked Ioi Lam to comment on this, off-hand I'm not aware of any 
issues with CDS here but it may be related to the archiving of object 
graphs.

-Alan


More information about the core-libs-dev mailing list