Problems with non-exported split packages (for resources/files)

Sven Strohschein novanic at
Tue May 9 20:33:12 UTC 2017


I'm trying to switch a project from OSGi to Jigsaw with the latest JDK 9 
ea build (168). The most is working fine and I like that it is much 
easier and much more practical than OSGi.

But there is one strong limitation within Jigsaw which I don't 
understand, which is much more restrictive even than OSGi and which will 
be a big problem to introduce Jigsaw in other projects: Non-exported 
split packages 
OSGi allows such private split packages, Jigsaw doesn't. In my 
understanding only packages which are declared in the module-info class 
should get checked for split packages and Jigsaw shouldn't care about 
internal module structures.

Mark Reinhold wrote, that it will be solved in a future release, but 
this is a strong, useless, unnecessary restrictive limitation which will 
cause a lot of problems when the people try to use Jigsaw in their 
projects. It blocks me and it will block others. And even worse: It will 
lead and force to senseless internal module structures, which can get 
reverted when the future release gets released...

There is a very practical example which isn't a bad practice: Resources. 
Imagine that every Java module has its own ResourceBundle properties for 
multi-language support (or imagine any other file which is not a Java 
class). These files are typically placed in a "conf", "etc" or 
"resources" folder structure and added to the classpath. It should not 
be necessary that every module has another place for such resources, 
that would be a bad solution! Java throws a LayerInstantiationException 
on starting the application when multiple modules have the same resource 
folder structures... How should resources be organized in your opinion? 
Should conf/etc/resources renamed and restructured to common package 
names starting with the top level domain? I don't want to change my 
projects in such a way for Jigsaw, it shouldn't be necessary...

I would be happy when this is fixed within the first release of Java 9 / 
Jigsaw (and I don't belong to Red Hat or IBM ;-)).

Thank you in advance.

Best regards,

Sven Strohschein

More information about the jigsaw-dev mailing list