8322322: Support archived full module graph when -Xbootclasspath/a is used

Reviewed-by: alanb, mchung
This commit is contained in:
Calvin Cheung 2024-01-05 00:00:24 +00:00
parent 3fbccb01dc
commit 3b1e56a427
4 changed files with 53 additions and 14 deletions

View file

@ -64,19 +64,19 @@ public class ClassLoaders {
// Creates the built-in class loaders.
static {
ArchivedClassLoaders archivedClassLoaders = ArchivedClassLoaders.get();
// -Xbootclasspath/a or -javaagent with Boot-Class-Path attribute
String append = VM.getSavedProperty("jdk.boot.class.path.append");
URLClassPath bootUcp = (append != null && !append.isEmpty())
? new URLClassPath(append, true)
: null;
if (archivedClassLoaders != null) {
// assert VM.getSavedProperty("jdk.boot.class.path.append") == null
BOOT_LOADER = (BootClassLoader) archivedClassLoaders.bootLoader();
BOOT_LOADER.setClassPath(bootUcp);
setArchivedServicesCatalog(BOOT_LOADER);
PLATFORM_LOADER = (PlatformClassLoader) archivedClassLoaders.platformLoader();
setArchivedServicesCatalog(PLATFORM_LOADER);
} else {
// -Xbootclasspath/a or -javaagent with Boot-Class-Path attribute
String append = VM.getSavedProperty("jdk.boot.class.path.append");
URLClassPath ucp = (append != null && !append.isEmpty())
? new URLClassPath(append, true)
: null;
BOOT_LOADER = new BootClassLoader(ucp);
BOOT_LOADER = new BootClassLoader(bootUcp);
PLATFORM_LOADER = new PlatformClassLoader(BOOT_LOADER);
}
// A class path is required when no initial module is specified.