// cc'ing the list because best practices should be public, and
// because it's easier to refer people to it in five years time
Hi Christian,
On 10/14/2019 12:16 PM, Christian Stein wrote:
just read your mail and was wondering if this extrapolation is correct:
A module that does not export any package should never need to
declare a "requires" as transitive.
Some qualification needed, I think. There are (at least) two kinds of
"top level" module that commonly have no `exports` clauses:
1. An "application module" intended to be launched (`java -m bizapp`)
rather than programmed against. I agree that this kind of module should
not use `requires transitive`.
2. An "aggregator module" intended to present a facade composed from the
APIs of other modules. For example, the `java.se` module has no
`exports`, but makes good use of `requires transitive`. (See
http://hg.openjdk.java.net/jdk/jdk/file/tip/src/java.se/share/classes/module-info.java.)
For example, I should remove all `transitive` modifiers from this module
module org.junit.platform.console {
requires transitive org.apiguardian.api;
requires transitive org.junit.platform.reporting;
provides java.util.spi.ToolProvider
with org.junit.platform.console.ConsoleLauncherToolProvider;
}
This "console" module certainly looks like #1 rather than #2.
Alex