RFR: 8294962: java.base jdk.internal.module package uses ASM to modify and write module-info.class [v4]
Alan Bateman
alanb at openjdk.org
Fri Mar 10 18:03:25 UTC 2023
On Thu, 9 Mar 2023 17:59:55 GMT, Mandy Chung <mchung at 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
More information about the core-libs-dev
mailing list