--- a/jdk/src/java.base/share/classes/jdk/internal/misc/JavaLangAccess.java Thu Apr 06 17:01:03 2017 +0000
+++ b/jdk/src/java.base/share/classes/jdk/internal/misc/JavaLangAccess.java Fri Apr 07 08:05:54 2017 +0000
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2003, 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2003, 2017, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@@ -27,10 +27,10 @@
import java.io.IOException;
import java.lang.annotation.Annotation;
+import java.lang.module.ModuleDescriptor;
import java.lang.reflect.Executable;
-import java.lang.reflect.Layer;
import java.lang.reflect.Method;
-import java.lang.reflect.Module;
+import java.net.URI;
import java.net.URL;
import java.security.AccessControlContext;
import java.security.ProtectionDomain;
@@ -38,6 +38,7 @@
import java.util.concurrent.ConcurrentHashMap;
import java.util.stream.Stream;
+import jdk.internal.module.ServicesCatalog;
import jdk.internal.reflect.ConstantPool;
import sun.reflect.annotation.AnnotationType;
import sun.nio.ch.Interruptible;
@@ -140,11 +141,6 @@
void invokeFinalize(Object o) throws Throwable;
/**
- * Returns the boot Layer
- */
- Layer getBootLayer();
-
- /**
* Returns the ConcurrentHashMap used as a storage for ClassLoaderValue(s)
* associated with the given class loader, creating it if it doesn't already exist.
*/
@@ -185,4 +181,74 @@
* Invalidate package access cache
*/
void invalidatePackageAccessCache();
+
+ /**
+ * Defines a new module to the Java virtual machine. The module
+ * is defined to the given class loader.
+ *
+ * The URI is for information purposes only, it can be {@code null}.
+ */
+ Module defineModule(ClassLoader loader, ModuleDescriptor descriptor, URI uri);
+
+ /**
+ * Defines the unnamed module for the given class loader.
+ */
+ Module defineUnnamedModule(ClassLoader loader);
+
+ /**
+ * Updates the readability so that module m1 reads m2. The new read edge
+ * does not result in a strong reference to m2 (m2 can be GC'ed).
+ *
+ * This method is the same as m1.addReads(m2) but without a permission check.
+ */
+ void addReads(Module m1, Module m2);
+
+ /**
+ * Updates module m to read all unnamed modules.
+ */
+ void addReadsAllUnnamed(Module m);
+
+ /**
+ * Updates module m1 to export a package to module m2. The export does
+ * not result in a strong reference to m2 (m2 can be GC'ed).
+ */
+ void addExports(Module m1, String pkg, Module m2);
+
+ /**
+ * Updates a module m to export a package to all unnamed modules.
+ */
+ void addExportsToAllUnnamed(Module m, String pkg);
+
+ /**
+ * Updates module m1 to open a package to module m2. Opening the
+ * package does not result in a strong reference to m2 (m2 can be GC'ed).
+ */
+ void addOpens(Module m1, String pkg, Module m2);
+
+ /**
+ * Updates a module m to open a package to all unnamed modules.
+ */
+ void addOpensToAllUnnamed(Module m, String pkg);
+
+ /**
+ * Updates a module m to use a service.
+ */
+ void addUses(Module m, Class<?> service);
+
+ /**
+ * Returns the ServicesCatalog for the given Layer.
+ */
+ ServicesCatalog getServicesCatalog(ModuleLayer layer);
+
+ /**
+ * Returns an ordered stream of layers. The first element is is the
+ * given layer, the remaining elements are its parents, in DFS order.
+ */
+ Stream<ModuleLayer> layers(ModuleLayer layer);
+
+ /**
+ * Returns a stream of the layers that have modules defined to the
+ * given class loader.
+ */
+ Stream<ModuleLayer> layers(ClassLoader loader);
}