What\'s the difference between requires and requires transitive module statements in module declaration?
For exam
Nicolai has explained in detail. I'm just giving a specific example from JDK code here. Consider the jdk.scripting.nashorn module. The module-info of this module is as follows:
http://hg.openjdk.java.net/jdk9/dev/nashorn/file/17cc754c8936/src/jdk.scripting.nashorn/share/classes/module-info.java
It has this line:
requires transitive java.scripting;
This is because jdk.scripting.nashorn module's own API in jdk.scripting.api.scripting package accepts/returns types from javax.script package of the java.scripting module. So jdk.scripting.nashorn tells the JMPS that any module that depends on jdk.scripting.nashorn automatically depends on java.scripting module as well!
Now, the same jdk.scripting.nashorn module uses this line:
requires jdk.dynalink;
for another module jdk.dynalink. That is because none of the exported packages (the "API") from jdk.scripting.nashorn module uses types from jdk.dynalink module. The use of jdk.dynalink by jdk.scripting.nashorn is purely an implementation detail.