Please review: http://cr.openjdk.java.net/~sundar/8158736/webrev.00/ for https://bugs.openjdk.java.net/browse/JDK-8158736
Nashorn creates named, dynamic modules for java adapter classes. This can be avoided and we can use the default, unnamed module created for the adapter class loader. Nashorn allows only subtyping of public, exported supertypes be implemented in scripts. The only package used in adapter module is exported and the adapter type is public as well. There is no need for named dynamic module - as there is nothing to encapsulate. Nashorn module can still selectively export packages to adapter module [ so that generated adapter class can access nashorn internals as needed]. This avoids having to generate read-links to the modules of the reference types used by the adapter class - because unnamed adapter module has read edges to all the modules. Thanks, -Sundar