Here is a real example of some code that does that, namely Glassfish 4.1 does not run on JDK nine because the JVM throws an
IllegalAccessError
The error message is
class com.sun.enterprise.security.provider policy wrapper
in module unnamed module, cannot access class
com.sun.security.provider policy file
in module java.base.
Now a glance at the open JDK repository shows us that the policy file
class in sun.security is declared
public, but because that package is not exported by java.base,
policy file is only accessible from code in java.base itself.
I would like to return to the
module-info.java
file that declares the HelloWorld module.
It is really important to understand that a module
- exports packages,
- but requires modules.
The reason is due to an old software engineering principle.
The "unit of reuse" is the "unit of release".