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

2023-03-13 Thread Mandy Chung
On Mon, 13 Mar 2023 19:59:18 GMT, Adam Sotona wrote: >>> 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

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

2023-03-13 Thread Adam Sotona
On Mon, 13 Mar 2023 19:18:26 GMT, Mandy Chung wrote: >>> 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 tha

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

2023-03-13 Thread Mandy Chung
On Mon, 13 Mar 2023 18:46:28 GMT, Alan Bateman 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 AP

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

2023-03-13 Thread Alan Bateman
On Mon, 13 Mar 2023 17:15:21 GMT, Adam Sotona wrote: > 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 t

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

2023-03-13 Thread Adam Sotona
On Mon, 13 Mar 2023 14:18:55 GMT, Alan Bateman wrote: >> Or another approach for the specific use cases might be to use >> `Classfile::buildModule` with empty list of packages and then provide custom >> `ModulePackagesAttribute` to the handler directly. > >> `Classfile::buildModule` is a helper

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

2023-03-13 Thread Alan Bateman
On Mon, 13 Mar 2023 13:47:31 GMT, Adam Sotona wrote: >> `Classfile::buildModule` is a helper method simplifying the major use case - >> building valid module with minimal user effort and knowledge. It emits >> `ModulePackages` if there are any packages specified and not exported nor >> opened.

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

2023-03-13 Thread Adam Sotona
On Mon, 13 Mar 2023 13:43:22 GMT, Adam Sotona wrote: >> Maybe the variants of Classfile.buildModule need to be looked at again. For >> the usage here, buildModule(ModuleAttribute, Consumer) >> would be more useful as it would allow all of the additional attributes to >> be emitted in the handl

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

2023-03-13 Thread Adam Sotona
On Sat, 11 Mar 2023 17:00:18 GMT, Alan Bateman wrote: >> `buildModules` is expected to be called with additional packages but instead >> it's called with all packages including all exported and open packages. >> >> >> /** >> * Build a module descriptor into a byte array. >> *

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

2023-03-11 Thread liach
On Fri, 10 Mar 2023 16:46:35 GMT, Glavo wrote: > The Classfile API looks great. I want to ask if you have any plans to > completely replace all uses of `jdk.internal.org.objectweb.asm` and delete > its source code from OpenJDK in a short time? I guess yes. https://bugs.openjdk.org/browse/JDK-8

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

2023-03-11 Thread Alan Bateman
On Fri, 10 Mar 2023 19:30:45 GMT, Mandy Chung wrote: >> 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 >> attribu

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

2023-03-10 Thread Mandy Chung
On Fri, 10 Mar 2023 17:59:20 GMT, Alan Bateman wrote: >> 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 conten