1 /*
2 * Copyright (c) 2015, 2016, Oracle and/or its affiliates. All rights reserved.
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4 *
5 * This code is free software; you can redistribute it and/or modify it
6 * under the terms of the GNU General Public License version 2 only, as
7 * published by the Free Software Foundation. Oracle designates this
8 * particular file as subject to the "Classpath" exception as provided
9 * by Oracle in the LICENSE file that accompanied this code.
10 *
11 * This code is distributed in the hope that it will be useful, but WITHOUT
12 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
13 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
14 * version 2 for more details (a copy is included in the LICENSE file that
15 * accompanied this code).
16 *
17 * You should have received a copy of the GNU General Public License version
18 * 2 along with this work; if not, write to the Free Software Foundation,
19 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
20 *
21 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
22 * or visit www.oracle.com if you need additional information or have any
26 package jdk.internal.module;
27
28 import java.lang.module.Configuration;
29 import java.lang.module.ModuleDescriptor;
30 import java.lang.module.ModuleFinder;
31 import java.lang.module.ModuleReference;
32 import java.lang.module.ResolvedModule;
33 import java.net.URI;
34 import java.security.AccessController;
35 import java.security.PrivilegedAction;
36 import java.util.List;
37 import java.util.Map;
38 import java.util.Optional;
39 import java.util.Set;
40 import java.util.function.Function;
41 import java.util.stream.Collectors;
42
43 import jdk.internal.loader.BootLoader;
44 import jdk.internal.loader.BuiltinClassLoader;
45 import jdk.internal.loader.ClassLoaders;
46 import jdk.internal.misc.JavaLangAccess;
47 import jdk.internal.misc.SharedSecrets;
48
49 /**
50 * A helper class for creating and updating modules. This class is intended to
51 * support command-line options, tests, and the instrumentation API. It is also
52 * used by the VM to load modules or add read edges when agents are instrumenting
53 * code that need to link to supporting classes.
54 *
55 * The parameters that are package names in this API are the fully-qualified
56 * names of the packages as defined in section 6.5.3 of <cite>The Java™
57 * Language Specification </cite>, for example, {@code "java.lang"}.
58 */
59
60 public class Modules {
61 private Modules() { }
62
63 private static final JavaLangAccess JLA = SharedSecrets.getJavaLangAccess();
64
65 /**
66 * Creates a new Module. The module has the given ModuleDescriptor and
67 * is defined to the given class loader.
|
1 /*
2 * Copyright (c) 2015, 2018, Oracle and/or its affiliates. All rights reserved.
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4 *
5 * This code is free software; you can redistribute it and/or modify it
6 * under the terms of the GNU General Public License version 2 only, as
7 * published by the Free Software Foundation. Oracle designates this
8 * particular file as subject to the "Classpath" exception as provided
9 * by Oracle in the LICENSE file that accompanied this code.
10 *
11 * This code is distributed in the hope that it will be useful, but WITHOUT
12 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
13 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
14 * version 2 for more details (a copy is included in the LICENSE file that
15 * accompanied this code).
16 *
17 * You should have received a copy of the GNU General Public License version
18 * 2 along with this work; if not, write to the Free Software Foundation,
19 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
20 *
21 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
22 * or visit www.oracle.com if you need additional information or have any
26 package jdk.internal.module;
27
28 import java.lang.module.Configuration;
29 import java.lang.module.ModuleDescriptor;
30 import java.lang.module.ModuleFinder;
31 import java.lang.module.ModuleReference;
32 import java.lang.module.ResolvedModule;
33 import java.net.URI;
34 import java.security.AccessController;
35 import java.security.PrivilegedAction;
36 import java.util.List;
37 import java.util.Map;
38 import java.util.Optional;
39 import java.util.Set;
40 import java.util.function.Function;
41 import java.util.stream.Collectors;
42
43 import jdk.internal.loader.BootLoader;
44 import jdk.internal.loader.BuiltinClassLoader;
45 import jdk.internal.loader.ClassLoaders;
46 import jdk.internal.access.JavaLangAccess;
47 import jdk.internal.access.SharedSecrets;
48
49 /**
50 * A helper class for creating and updating modules. This class is intended to
51 * support command-line options, tests, and the instrumentation API. It is also
52 * used by the VM to load modules or add read edges when agents are instrumenting
53 * code that need to link to supporting classes.
54 *
55 * The parameters that are package names in this API are the fully-qualified
56 * names of the packages as defined in section 6.5.3 of <cite>The Java™
57 * Language Specification </cite>, for example, {@code "java.lang"}.
58 */
59
60 public class Modules {
61 private Modules() { }
62
63 private static final JavaLangAccess JLA = SharedSecrets.getJavaLangAccess();
64
65 /**
66 * Creates a new Module. The module has the given ModuleDescriptor and
67 * is defined to the given class loader.
|