On Thu, 9 Mar 2023 10:59:25 GMT, Adam Sotona <asot...@openjdk.org> wrote:

>> src/java.base/share/classes/jdk/internal/module/ModuleInfoWriter.java line 
>> 146:
>> 
>>> 144: 
>>> 145:                 // packages
>>> 146:                 md.packages().stream().map(PackageDesc::of).toList(),
>> 
>> When writing `module_info.class` via ASM, it only visits the packages if 
>> there are packages that aren't exported or open.
>> 
>> Does the ClassFile API add `ModulePackages` attribute only if there are 
>> packages that aren't exported or open?
>
> 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.

-------------

PR: https://git.openjdk.org/jdk/pull/11368

Reply via email to