On Fri, 13 Dec 2024 23:32:14 GMT, Henry Jen <henry...@openjdk.org> wrote:
>> src/jdk.jlink/share/classes/jdk/tools/jlink/internal/plugins/SystemModulesPlugin.java >> line 619: >> >>> 617: // generate dedup set fields and provider >>> methods >>> 618: var dedupSets = genConstants(clb); >>> 619: >> >> These constants are all for building the module descriptors and `dedupSets` >> is needed by `genModuleDescriptorsMethod`. This can be moved and be >> called in `genModuleDescriptorsMethod`. > > The static initializer currently only contains the cache from DedupSet, but > it feels wrong to generate the static initializer in > genModuleDescriptorsMethod. I was wondering that there should be `genClassInitializer`. It seems to me that `SystemModulesClassGenerator` should have `List<Snippet> clinitSnippets;` and `genClassInitializer` will emit the code from the snippets if not empty. It'd have to be called at the end since other code might add clinit snippet in the future. ------------- PR Review Comment: https://git.openjdk.org/jdk/pull/21022#discussion_r1884657494