Hi Alex, thanks for your reply. Please find answers inlined below.
Note: I just realized that you already replied to Robert, and from what I saw, the `--patch-module-descriptor` option idea would indeed be a workable solution. Have to re-read your reply two or three times to fully grasp that suggestion, though. I'll send this answer anyway -- to round-up and effectively close this sub-thread. On Mon, Feb 10, 2020 at 11:03 PM Alex Buckley <alex.buck...@oracle.com> wrote: > Hi Christian, > > On 2/7/2020 4:41 AM, Christian Stein wrote: > > This time, I created a project at [0] with a detailed description on its > > front page, i.e the README.md file. > > > > [0]: https://github.com/sormuras/java-module-patching > > To restate: > > - You're saying that, today, it's brittle to copy directives from > src/org.astro/main/java/module-info.java to > src/org.astro/test/java/module-info.java. (And having copied them, you > still need to `open` the test module and add some `requires`.) > > - You suggest that, in future, there will still be a > src/org.astro/test/java/module-info.java file which is of interest to > test frameworks. > > That is correct. It is and will be relevant to compile and run test-related modules. That includes inter-module (black box) test modules and in(tra)-module (white box) test modules. The former may use the standard `module-info.java` syntax as of today. As they use an unique name, no patching is required. The latter, re-use the name of their associated module on purpose. Those in-module tests are expected to use the same package name -- allowing access to package private members. > What you're hoping is that new syntax will let you invert the patching: > No, not at all. My hope is to re-use the same well-known `module-info.java` syntax to define the additional needs (modifiers and directives) of the in-module test module. Similar to the standalone intra-module test module. > - Today, you set the module-path so that out/modules/test/org.astro.jar > is the "primary" version of the module; then you redefine everything in > it except module-info by overlaying out/modules/main/org.astro.jar. > Exactly. > - In future, you want to have out/modules/main/org.astro.jar as the > "primary" version, and redefine only its module-info by specifying the > sidecar out/modules/test/org.astro.jar. [...] No. I still want out/modules/test/org.astro.jar to be and stay my only version of the org.astro module that is relevant at test compile and runtime time. I want some help when declaring src/org.astro/test/java/module-info.java It should "extend" the src/org.astro/main/java/module-info.java description. At compile and/or runtime. I don't want to manually merge the orginial modifiers already defined in src/org.astro/main/java/module-info.java > Stepping back, the core issue is that once the true "primary" version of > a module is built -- out/modules/main/org.astro.jar -- you don't want to > change it. [...] True. That's why I prefer to have standalone "test" versions of all modules. All in the sense of inter-module (black box) and in(-tra)-module (white box) testing. I'll cut it here and continue on the `--patch-module-descriptor` thread later. Cheers, Christian