RFE simplify usage of patched module [by Robert Scholte, from jdk-dev]
Christian Stein
sormuras at gmail.com
Wed Feb 5 04:19:47 UTC 2020
On Wed, Feb 5, 2020 at 4:47 AM Christian Stein <sormuras at gmail.com> wrote:
> // Hope this email will be technically associated as a reply for the
> // "RFE simplify usage of patched module" thread.
>
> I agree with Robert that a user-friendly and (build) tool-agnostic way
> to express additional module directives and modifiers for testing
> purposes only is ... a good thing to have.
>
> As a workaround, I proposed, implemented and promoted a tool-agnostic
> `module-info.test` file in [/] which, as of today, I no longer really like
> that
> much. The standard javac/java command options and arguments listed
> as plain text lines in that file require users to know the module-related
> options of javac/java meant to be primarily used by (build) tools.
>
>
Here's a Maven-based project that demonstrates most (all?) interesting
main/test scope mixing combinations: https://github.com/micromata/sawdust
Instead of using the Surefire plugin to launch tests, it uses [0]. The
latter
supports the `module-info.test` configuration file, which is used in one of
the examples: [1]
Relevant in this context are the two examples whose names starts with
"modular-whitebox-".
With the "patch modifier"-proposal applied as suggested by Robert,
this manually constructed test module descriptor:
open module foo {
exports foo;
requires org.junit.jupiter.api;
}
from [2] would shrink to:
open patch module foo {
requires org.junit.jupiter.api;
}
Only the additional "open" modifier and the additional requires directive
remain.
The other (here the single exports directive) directives are copied from the
non-patched module "foo".
Cheers,
Christian
[0]: https://github.com/sormuras/junit-platform-maven-plugin
[1]:
https://github.com/micromata/sawdust/blob/master/modular-whitebox-patch-runtime/src/test/resources/module-info.test
[2]:
https://github.com/micromata/sawdust/blob/master/modular-whitebox-patch-compile/src/test/java/module-info.java
More information about the jigsaw-dev
mailing list