Search in sources :

Example 6 with BuiltinClassLoader

use of jdk.internal.loader.BuiltinClassLoader in project Bytecoder by mirkosertic.

the class ModuleBootstrap method loadModules.

/**
 * Load/register the modules to the built-in class loaders.
 */
private static void loadModules(Configuration cf, Function<String, ClassLoader> clf) {
    for (ResolvedModule resolvedModule : cf.modules()) {
        ModuleReference mref = resolvedModule.reference();
        String name = resolvedModule.name();
        ClassLoader loader = clf.apply(name);
        if (loader == null) {
            // skip java.base as it is already loaded
            if (!name.equals(JAVA_BASE)) {
                BootLoader.loadModule(mref);
            }
        } else if (loader instanceof BuiltinClassLoader) {
            ((BuiltinClassLoader) loader).loadModule(mref);
        }
    }
}
Also used : BuiltinClassLoader(jdk.internal.loader.BuiltinClassLoader) ResolvedModule(java.lang.module.ResolvedModule) ModuleReference(java.lang.module.ModuleReference) BuiltinClassLoader(jdk.internal.loader.BuiltinClassLoader)

Aggregations

BuiltinClassLoader (jdk.internal.loader.BuiltinClassLoader)6 ResolvedModule (java.lang.module.ResolvedModule)5 ModuleDescriptor (java.lang.module.ModuleDescriptor)2 ModuleReference (java.lang.module.ModuleReference)2 URL (java.net.URL)2 CallerSensitive (jdk.internal.reflect.CallerSensitive)2 IOException (java.io.IOException)1 Configuration (java.lang.module.Configuration)1 ModuleFinder (java.lang.module.ModuleFinder)1 URI (java.net.URI)1 AccessController (java.security.AccessController)1 PrivilegedAction (java.security.PrivilegedAction)1 HashMap (java.util.HashMap)1 LinkedHashMap (java.util.LinkedHashMap)1 List (java.util.List)1 Map (java.util.Map)1 Set (java.util.Set)1 Function (java.util.function.Function)1 Collectors (java.util.stream.Collectors)1 BootLoader (jdk.internal.loader.BootLoader)1