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
23 * questions.
24 */
25
26 package jdk.internal.module;
27
28 import java.io.File;
29 import java.io.PrintStream;
30 import java.lang.module.Configuration;
31 import java.lang.module.ModuleDescriptor;
32 import java.lang.module.ModuleFinder;
33 import java.lang.module.ModuleReference;
34 import java.lang.module.ResolvedModule;
35 import java.net.URI;
36 import java.nio.file.Path;
37 import java.nio.file.Paths;
38 import java.util.ArrayList;
39 import java.util.Collections;
40 import java.util.HashMap;
41 import java.util.HashSet;
42 import java.util.Iterator;
43 import java.util.LinkedHashMap;
44 import java.util.List;
45 import java.util.Map;
46 import java.util.NoSuchElementException;
47 import java.util.Objects;
48 import java.util.Optional;
49 import java.util.Set;
50 import java.util.function.Function;
51 import java.util.stream.Collectors;
52
53 import jdk.internal.loader.BootLoader;
54 import jdk.internal.loader.BuiltinClassLoader;
55 import jdk.internal.misc.JavaLangAccess;
56 import jdk.internal.misc.JavaLangModuleAccess;
57 import jdk.internal.misc.SharedSecrets;
522 @Override
523 public Set<ModuleReference> findAll() {
524 return mrefs;
525 }
526 };
527 }
528
529 /**
530 * Creates a finder from the module path that is the value of the given
531 * system property and optionally patched by --patch-module
532 */
533 private static ModuleFinder finderFor(String prop) {
534 String s = System.getProperty(prop);
535 if (s == null) {
536 return null;
537 } else {
538 String[] dirs = s.split(File.pathSeparator);
539 Path[] paths = new Path[dirs.length];
540 int i = 0;
541 for (String dir: dirs) {
542 paths[i++] = Paths.get(dir);
543 }
544 return ModulePath.of(patcher, paths);
545 }
546 }
547
548 /**
549 * Initialize the module patcher for the initial configuration passed on the
550 * value of the --patch-module options.
551 */
552 private static ModulePatcher initModulePatcher() {
553 Map<String, List<String>> map = decode("jdk.module.patch.",
554 File.pathSeparator,
555 false);
556 return new ModulePatcher(map);
557 }
558
559 /**
560 * Returns the set of module names specified by --add-module options.
561 */
562 private static Set<String> addModules() {
|
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
23 * questions.
24 */
25
26 package jdk.internal.module;
27
28 import java.io.File;
29 import java.io.PrintStream;
30 import java.lang.module.Configuration;
31 import java.lang.module.ModuleDescriptor;
32 import java.lang.module.ModuleFinder;
33 import java.lang.module.ModuleReference;
34 import java.lang.module.ResolvedModule;
35 import java.net.URI;
36 import java.nio.file.Path;
37 import java.util.ArrayList;
38 import java.util.Collections;
39 import java.util.HashMap;
40 import java.util.HashSet;
41 import java.util.Iterator;
42 import java.util.LinkedHashMap;
43 import java.util.List;
44 import java.util.Map;
45 import java.util.NoSuchElementException;
46 import java.util.Objects;
47 import java.util.Optional;
48 import java.util.Set;
49 import java.util.function.Function;
50 import java.util.stream.Collectors;
51
52 import jdk.internal.loader.BootLoader;
53 import jdk.internal.loader.BuiltinClassLoader;
54 import jdk.internal.misc.JavaLangAccess;
55 import jdk.internal.misc.JavaLangModuleAccess;
56 import jdk.internal.misc.SharedSecrets;
521 @Override
522 public Set<ModuleReference> findAll() {
523 return mrefs;
524 }
525 };
526 }
527
528 /**
529 * Creates a finder from the module path that is the value of the given
530 * system property and optionally patched by --patch-module
531 */
532 private static ModuleFinder finderFor(String prop) {
533 String s = System.getProperty(prop);
534 if (s == null) {
535 return null;
536 } else {
537 String[] dirs = s.split(File.pathSeparator);
538 Path[] paths = new Path[dirs.length];
539 int i = 0;
540 for (String dir: dirs) {
541 paths[i++] = Path.get(dir);
542 }
543 return ModulePath.of(patcher, paths);
544 }
545 }
546
547 /**
548 * Initialize the module patcher for the initial configuration passed on the
549 * value of the --patch-module options.
550 */
551 private static ModulePatcher initModulePatcher() {
552 Map<String, List<String>> map = decode("jdk.module.patch.",
553 File.pathSeparator,
554 false);
555 return new ModulePatcher(map);
556 }
557
558 /**
559 * Returns the set of module names specified by --add-module options.
560 */
561 private static Set<String> addModules() {
|