RFR: 8294962: Convert java.base/jdk.internal.module package to use the Classfile API to modify and write module-info.class [v4]

Mandy Chung mchung at openjdk.org
Mon Mar 13 19:21:10 UTC 2023


On Mon, 13 Mar 2023 18:46:28 GMT, Alan Bateman <alanb at openjdk.org> wrote:

>> I see, I'll move the "packages magic" back from Classfile API to the `ModuleInfoWriter` and correct the API accordingly.
>
>> I see, I'll move the "packages magic" back from Classfile API to the `ModuleInfoWriter` and correct the API accordingly.
> 
> I would need to check the history in the jake repo but I think it dates from a prototype version of that attribute that only listed the concealed packages. I think it should be okay to just drop this from ModuleInfoWriter now. As I mentioned in another comment, the only user now is tests so you should able to just remove this code so that it doesn't generate the ModulePackages attributes.

> I think it would be better to change is so that calling it with ModuleAttribute will emit a Module attribute. The overloads that take a Module plus a set of packages can emit a Module + ModulePackage unconditionally.

I'm fine with this.

`buildModule(ModuleAttribute moduleAttribute, List<PackageDesc> packages, Consumer handler)` would emit `ModulePackages` unconditionally.   It means that it would need another `buildModule` variant that takes ModuleAttribute and handler only if no `ModulePackages` is generated.

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

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


More information about the core-libs-dev mailing list