Missing a wildcard open statement

Kasper Nielsen kasperni at gmail.com
Mon Jan 14 12:26:45 UTC 2019


Hi,

Having worked with the module system for some time now. There is one
situation I've started coming across a number of times now, that requires a
lot of boiler plate.
Opening every package of a module to another module. For example, for
dependency injection, code analysis, ect.
Basically you have 2 choices now.
* Opening it to every possible module, via open <Module> which you rarely
want
* For each package in your module add an opens <Package> to <OtherModule>

The last option is fine if you have a couple of packages, but when you have
many packages it starts to be a bit of a work.
And since I (and most people) are lazy, they are just going to go with the
first option, opening the whole module unqualified.

What I am missing is a "open all packages to this module" option ("opens *
to mod1, mod2")
This could be implemented, for example, by adding simply by making the
package statement in opens <Package> to <OtherModule> optionally (maybe
there are some corner cases so it would'nt work syntactically).
Or maybe by adding an openallto <OtherModules> statement.
Implementation wise, it would just enumerate all packages and add a
qualified open statement for each of them. So no changes would be required
at runtime.

Anyone else had the same experience?

/Kasper


More information about the jigsaw-dev mailing list