< prev index next >

src/java.base/share/classes/jdk/internal/loader/BootLoader.java

Print this page

        

*** 28,37 **** --- 28,38 ---- import java.io.InputStream; import java.lang.module.ModuleReference; import java.lang.reflect.Layer; import java.lang.reflect.Module; import java.net.MalformedURLException; + import java.net.URI; import java.net.URL; import java.nio.file.Files; import java.nio.file.Path; import java.nio.file.Paths; import java.security.AccessController;
*** 182,202 **** static class PackageHelper { private static final JavaLangAccess JLA = SharedSecrets.getJavaLangAccess(); /** * Define the {@code Package} with the given name. The specified ! * location is a jrt URL to a named module in the run-time image, a ! * file path to a module in an exploded run-time image, or the file ! * path to an enty on the boot class path (java agent Boot-Class-Path * or -Xbootclasspath/a. * * <p> If the given location is a JAR file containing a manifest, * the defined Package contains the versioning information from * the manifest, if present. * * @param name package name ! * @param location location where the package is (jrt URL or file path) */ static Package definePackage(String name, String location) { Module module = findModule(location); if (module != null) { // named module from runtime image or exploded module --- 183,205 ---- static class PackageHelper { private static final JavaLangAccess JLA = SharedSecrets.getJavaLangAccess(); /** * Define the {@code Package} with the given name. The specified ! * location is a jrt URL to a named module in the run-time image, ! * a file URL to a module in an exploded run-time image, or a file ! * path to an entry on the boot class path (java agent Boot-Class-Path * or -Xbootclasspath/a. * * <p> If the given location is a JAR file containing a manifest, * the defined Package contains the versioning information from * the manifest, if present. * * @param name package name ! * @param location location where the package is (jrt URL or file URL ! * for a named module in the run-time or exploded image; ! * a file path for a package from -Xbootclasspath/a) */ static Package definePackage(String name, String location) { Module module = findModule(location); if (module != null) { // named module from runtime image or exploded module
*** 220,232 **** private static Module findModule(String location) { String mn = null; if (location.startsWith("jrt:/")) { // named module in runtime image ("jrt:/".length() == 5) mn = location.substring(5, location.length()); ! } else { // named module in exploded image ! Path path = Paths.get(location); Path modulesDir = Paths.get(JAVA_HOME, "modules"); if (path.startsWith(modulesDir)) { mn = path.getFileName().toString(); } } --- 223,235 ---- private static Module findModule(String location) { String mn = null; if (location.startsWith("jrt:/")) { // named module in runtime image ("jrt:/".length() == 5) mn = location.substring(5, location.length()); ! } else if (location.startsWith("file:")) { // named module in exploded image ! Path path = Paths.get(URI.create(location)); Path modulesDir = Paths.get(JAVA_HOME, "modules"); if (path.startsWith(modulesDir)) { mn = path.getFileName().toString(); } }
< prev index next >