39 import java.util.Map;
40 import java.util.Optional;
41 import java.util.Set;
42 import java.util.function.Function;
43 import java.util.stream.Collectors;
44
45 import jdk.internal.access.JavaLangModuleAccess;
46 import jdk.internal.loader.BootLoader;
47 import jdk.internal.loader.BuiltinClassLoader;
48 import jdk.internal.loader.ClassLoaders;
49 import jdk.internal.access.JavaLangAccess;
50 import jdk.internal.access.SharedSecrets;
51
52 /**
53 * A helper class for creating and updating modules. This class is intended to
54 * support command-line options, tests, and the instrumentation API. It is also
55 * used by the VM to load modules or add read edges when agents are instrumenting
56 * code that need to link to supporting classes.
57 *
58 * The parameters that are package names in this API are the fully-qualified
59 * names of the packages as defined in section 6.5.3 of <cite>The Java™
60 * Language Specification </cite>, for example, {@code "java.lang"}.
61 */
62
63 public class Modules {
64 private Modules() { }
65
66 private static final JavaLangAccess JLA = SharedSecrets.getJavaLangAccess();
67 private static final JavaLangModuleAccess JLMA = SharedSecrets.getJavaLangModuleAccess();
68
69 /**
70 * Creates a new Module. The module has the given ModuleDescriptor and
71 * is defined to the given class loader.
72 *
73 * The resulting Module is in a larval state in that it does not read
74 * any other module and does not have any exports.
75 *
76 * The URI is for information purposes only.
77 */
78 public static Module defineModule(ClassLoader loader,
79 ModuleDescriptor descriptor,
|
39 import java.util.Map;
40 import java.util.Optional;
41 import java.util.Set;
42 import java.util.function.Function;
43 import java.util.stream.Collectors;
44
45 import jdk.internal.access.JavaLangModuleAccess;
46 import jdk.internal.loader.BootLoader;
47 import jdk.internal.loader.BuiltinClassLoader;
48 import jdk.internal.loader.ClassLoaders;
49 import jdk.internal.access.JavaLangAccess;
50 import jdk.internal.access.SharedSecrets;
51
52 /**
53 * A helper class for creating and updating modules. This class is intended to
54 * support command-line options, tests, and the instrumentation API. It is also
55 * used by the VM to load modules or add read edges when agents are instrumenting
56 * code that need to link to supporting classes.
57 *
58 * The parameters that are package names in this API are the fully-qualified
59 * names of the packages as defined in section 6.5.3 of <cite>The Java
60 * Language Specification </cite>, for example, {@code "java.lang"}.
61 */
62
63 public class Modules {
64 private Modules() { }
65
66 private static final JavaLangAccess JLA = SharedSecrets.getJavaLangAccess();
67 private static final JavaLangModuleAccess JLMA = SharedSecrets.getJavaLangModuleAccess();
68
69 /**
70 * Creates a new Module. The module has the given ModuleDescriptor and
71 * is defined to the given class loader.
72 *
73 * The resulting Module is in a larval state in that it does not read
74 * any other module and does not have any exports.
75 *
76 * The URI is for information purposes only.
77 */
78 public static Module defineModule(ClassLoader loader,
79 ModuleDescriptor descriptor,
|