< prev index next >

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

Print this page

*** 102,113 **** // parent ClassLoader private final BuiltinClassLoader parent; // the URL class path, or null if there is no class path ! private final URLClassPath ucp; ! /** * A module defined/loaded by a built-in class loader. * * A LoadedModule encapsulates a ModuleReference along with its CodeSource --- 102,112 ---- // parent ClassLoader private final BuiltinClassLoader parent; // the URL class path, or null if there is no class path ! private @Stable URLClassPath ucp; /** * A module defined/loaded by a built-in class loader. * * A LoadedModule encapsulates a ModuleReference along with its CodeSource
*** 154,167 **** } return url; } } - // maps package name to loaded module for modules in the boot layer ! private static final Map<String, LoadedModule> packageToModule ! = new ConcurrentHashMap<>(1024); // maps a module name to a module reference private final Map<String, ModuleReference> nameToModule; // maps a module reference to a module reader --- 153,182 ---- } return url; } } // maps package name to loaded module for modules in the boot layer ! private static final Map<String, LoadedModule> packageToModule; ! static { ! ArchivedClassLoaders archivedClassLoaders = ArchivedClassLoaders.get(); ! if (archivedClassLoaders != null) { ! @SuppressWarnings("unchecked") ! Map<String, LoadedModule> map ! = (Map<String, LoadedModule>) archivedClassLoaders.packageToModule(); ! packageToModule = map; ! } else { ! packageToModule = new ConcurrentHashMap<>(1024); ! } ! } ! ! /** ! * Invoked by ArchivedClassLoaders to archive the package-to-module map. ! */ ! static Map<String, ?> packageToModule() { ! return packageToModule; ! } // maps a module name to a module reference private final Map<String, ModuleReference> nameToModule; // maps a module reference to a module reader
*** 184,193 **** --- 199,223 ---- this.nameToModule = new ConcurrentHashMap<>(32); this.moduleToReader = new ConcurrentHashMap<>(); } /** + * Appends to the given file path to the class path. + */ + void appendClassPath(String path) { + // assert ucp != null; + ucp.addFile(path); + } + + /** + * Sets the class path, called to reset the class path during -Xshare:dump + */ + void setClassPath(URLClassPath ucp) { + this.ucp = ucp; + } + + /** * Returns {@code true} if there is a class path associated with this * class loader. */ boolean hasClassPath() { return ucp != null;
*** 1040,1045 **** --- 1070,1080 ---- * checking with java.net.URLClassLoader. */ private static URL checkURL(URL url) { return URLClassPath.checkURL(url); } + + // Called from VM only, during -Xshare:dump + private void resetArchivedStates() { + ucp = null; + } }
< prev index next >