equal
deleted
inserted
replaced
1 /* |
1 /* |
2 * Copyright (c) 2017, Oracle and/or its affiliates. All rights reserved. |
2 * Copyright (c) 2017, 2018, Oracle and/or its affiliates. All rights reserved. |
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. |
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. |
4 * |
4 * |
5 * This code is free software; you can redistribute it and/or modify it |
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 |
6 * under the terms of the GNU General Public License version 2 only, as |
7 * published by the Free Software Foundation. Oracle designates this |
7 * published by the Free Software Foundation. Oracle designates this |
28 import java.io.PrintStream; |
28 import java.io.PrintStream; |
29 import java.lang.module.Configuration; |
29 import java.lang.module.Configuration; |
30 import java.lang.module.ResolvedModule; |
30 import java.lang.module.ResolvedModule; |
31 import java.net.URI; |
31 import java.net.URI; |
32 import java.nio.file.Path; |
32 import java.nio.file.Path; |
33 import java.nio.file.Paths; |
|
34 import java.util.ArrayDeque; |
33 import java.util.ArrayDeque; |
35 import java.util.Collections; |
34 import java.util.Collections; |
36 import java.util.Deque; |
35 import java.util.Deque; |
37 import java.util.HashMap; |
36 import java.util.HashMap; |
38 import java.util.HashSet; |
37 import java.util.HashSet; |
127 private Path moduleToPath(String name) { |
126 private Path moduleToPath(String name) { |
128 ResolvedModule rm = configuration.findModule(name).orElseThrow( |
127 ResolvedModule rm = configuration.findModule(name).orElseThrow( |
129 () -> new InternalError("Selected module " + name + " not on module path")); |
128 () -> new InternalError("Selected module " + name + " not on module path")); |
130 |
129 |
131 URI uri = rm.reference().location().get(); |
130 URI uri = rm.reference().location().get(); |
132 Path path = Paths.get(uri); |
131 Path path = Path.of(uri); |
133 String fn = path.getFileName().toString(); |
132 String fn = path.getFileName().toString(); |
134 if (!fn.endsWith(".jar") && !fn.endsWith(".jmod")) { |
133 if (!fn.endsWith(".jar") && !fn.endsWith(".jmod")) { |
135 throw new UnsupportedOperationException(path + " is not a modular JAR or jmod file"); |
134 throw new UnsupportedOperationException(path + " is not a modular JAR or jmod file"); |
136 } |
135 } |
137 return path; |
136 return path; |