< prev index next >

src/hotspot/share/classfile/systemDictionary.cpp

Print this page




1415         if (ModuleEntryTable::javabase_defined()) {
1416           return NULL;
1417         }
1418       } else {
1419         // Check that the class' package is defined within java.base.
1420         ModuleEntry* mod_entry = pkg_entry->module();
1421         Symbol* mod_entry_name = mod_entry->name();
1422         if (mod_entry_name->fast_compare(vmSymbols::java_base()) != 0) {
1423           return NULL;
1424         }
1425       }
1426     } else {
1427       // After the module system has been initialized, check if the class'
1428       // package is in a module defined to the boot loader.
1429       if (pkg_name == NULL || pkg_entry == NULL || pkg_entry->in_unnamed_module()) {
1430         // Class is either in the unnamed package, in a named package
1431         // within a module not defined to the boot loader or in a
1432         // a named package within the unnamed module.  In all cases,
1433         // limit visibility to search for the class only in the boot
1434         // loader's append path.





1435         search_only_bootloader_append = true;
1436       }
1437     }
1438 
1439     // Prior to bootstrapping's module initialization, never load a class outside
1440     // of the boot loader's module path
1441     assert(Universe::is_module_initialized() ||
1442            !search_only_bootloader_append,
1443            "Attempt to load a class outside of boot loader's module path");
1444 
1445     // Search for classes in the CDS archive.
1446     InstanceKlass* k = NULL;
1447     {
1448 #if INCLUDE_CDS
1449       PerfTraceTime vmtimer(ClassLoader::perf_shared_classload_time());
1450       k = load_shared_boot_class(class_name, THREAD);
1451 #endif
1452     }
1453 
1454     if (k == NULL) {




1415         if (ModuleEntryTable::javabase_defined()) {
1416           return NULL;
1417         }
1418       } else {
1419         // Check that the class' package is defined within java.base.
1420         ModuleEntry* mod_entry = pkg_entry->module();
1421         Symbol* mod_entry_name = mod_entry->name();
1422         if (mod_entry_name->fast_compare(vmSymbols::java_base()) != 0) {
1423           return NULL;
1424         }
1425       }
1426     } else {
1427       // After the module system has been initialized, check if the class'
1428       // package is in a module defined to the boot loader.
1429       if (pkg_name == NULL || pkg_entry == NULL || pkg_entry->in_unnamed_module()) {
1430         // Class is either in the unnamed package, in a named package
1431         // within a module not defined to the boot loader or in a
1432         // a named package within the unnamed module.  In all cases,
1433         // limit visibility to search for the class only in the boot
1434         // loader's append path.
1435         if (!ClassLoader::has_bootclasspath_append()) {
1436            // If there is no bootclasspath append entry, no need to continue
1437            // searching.
1438            return NULL;
1439         }
1440         search_only_bootloader_append = true;
1441       }
1442     }
1443 
1444     // Prior to bootstrapping's module initialization, never load a class outside
1445     // of the boot loader's module path
1446     assert(Universe::is_module_initialized() ||
1447            !search_only_bootloader_append,
1448            "Attempt to load a class outside of boot loader's module path");
1449 
1450     // Search for classes in the CDS archive.
1451     InstanceKlass* k = NULL;
1452     {
1453 #if INCLUDE_CDS
1454       PerfTraceTime vmtimer(ClassLoader::perf_shared_classload_time());
1455       k = load_shared_boot_class(class_name, THREAD);
1456 #endif
1457     }
1458 
1459     if (k == NULL) {


< prev index next >