So, is my assumption correct: if no --add-modules and --limit-modules are specified, the set of observable system modules consists of all system modules except java.se.ee?
In short, yes that is correct.
The default set of modules enabled in Java 9 are known as the root modules.
Per JEP 261, the default set of root modules are defined as:
The java.se module is a root, if it exists. If it does not exist then every java.* module on the upgrade module path or among the system modules that exports at least one package, without qualification, is a root.
Every non-java.* module on the upgrade module path or among the system modules that exports at least one package, without qualification, is also a root.
Here is a nice graphic of what is included in the java.se
module:
(Source: Java 9 javadoc)
Like the java.se
aggregate module, the java.se.ee
module itself does not provide any classes, it is an aggregate module that includes the following modules:
java.se
java.activation
java.annotations.common
java.corba
java.transaction
java.xml.bind
java.xml.ws
Is there a reliable way to know the exact list of default observable system modules? I know there is a --list-modules option, but it lists all modules including java.se.ee.
Your terminology is slightly off here. In Java 9 a module is observable if both of the following are true:
- the module is a system module (i.e. comes from the JDK) OR it is added to the module path
- the module is not excluded via
--limit-modules
This means java.se.ee
is observable by default.
I think instead you are wondering what modules are the default set of root modules? In which case, see the above definition of root modules.
sun.misc.Unsafe
?Unsafe
is certainly not in the java.se module graph. – Colorist