override module with an alternative implementation in the child layer
Alan Bateman
Alan.Bateman at oracle.com
Mon Jul 30 18:17:23 UTC 2018
On 30/07/2018 10:16, Milen Dyankov wrote:
> In response to a question posted on this list [1] some time ago, Alan
> Bateman stated "You can override *any* module (except java.base) with an
> alternative implementation in the child layer". Is that true for the
> standard JDK modules? If so, is there any documentation / code samples that
> explains how?
>
The previous thread didn't get into this but the other restriction is
that you can't contain modules that export java.* APIs in custom layers
(javax.* APIs are not an issue). I don't have time to give a detailed
reply just now but look for the following in the javadoc of the
ModuleLayer defineModulesXXX methods:
"In addition, a layer cannot be created if the configuration contains a
module named "java.base", a configuration contains a module with a
package named "java" or a package name starting with "java.", or the
function to map a module name to a class loader returns null or the
platform class loader"
-Alan.
More information about the jigsaw-dev
mailing list