On Thu, 9 Mar 2023 17:59:55 GMT, Mandy Chung <mch...@openjdk.org> wrote:
>> Yes, `Classfile::buildModule` contains logic determining if emission of >> `ModulePackages` is required or not. > > It'd be helpful to add a comment that `ModulePackages` attribute is only > emitted if there are packages that aren't exported or open. The ModulePackages attribute is optional and an optimization to avoid scanning the module contents to get the full set of packages. Tooling that creates packaged modules (jar and jmod for now) will want the ModulePackages attribute emitted always. So maybe the Classfile.buildModule methods should be looked at again, at least I think the 2-arg and 3-arg methods should emit the ModulePackages unconditionally, the 1-arg buildModule maybe not. This isn't an issue for ModuleInfoWriter of course as it is only used by tests. ------------- PR: https://git.openjdk.org/jdk/pull/11368