Hi,

back then when working on our compiler I didn't pay much attention to non-Java resources, as JLS doesn't make any mention of them.

Recently, however, we found that plain text files in a modular jar can well cause the VM to refuse starting, complaining:

java.lang.LayerInstantiationException: Package foo in both module x and module y
at java.base/jdk.internal.module.ModuleBootstrap.checkSplitPackages(ModuleBootstrap.java:470)

I would like to report this problem at build time, to avoid bad surprises at launch time. For this I would like to learn what are the rules how non-Java resources participate in JLS 7.4.3 ("uniquely visible").

The closest I could find was in the javadoc of
  java.lang.Module.getResourceAsStream(String)
While it doesn't touch the split package issue, it introduces a distinction into encapsulated and not encapsulated resources, based on a package name (while at the same time judging by JLS no package exists). I guess this holds part of my answer but still I couldn't quite connect the remaining dots.

Where is it defined, in which situation non-Java resources contribute to illegally split packages?

Can a resource "package" conflict with a Java package in another module? Which of the two needs to be exported / opened in order to create a conflict? Etc...

best,
Stephan

Reply via email to