src/hotspot/share/classfile/systemDictionary.cpp
changeset 47991 a474466c4fdb
parent 47774 69c081ca110a
child 48138 78b2ecdd3c4b
equal deleted inserted replaced
47915:d4af6b80aec3 47991:a474466c4fdb
  1463       // During bootstrapping, prior to module initialization, any
  1463       // During bootstrapping, prior to module initialization, any
  1464       // class attempting to be loaded must be checked against the
  1464       // class attempting to be loaded must be checked against the
  1465       // java.base packages in the boot loader's PackageEntryTable.
  1465       // java.base packages in the boot loader's PackageEntryTable.
  1466       // No class outside of java.base is allowed to be loaded during
  1466       // No class outside of java.base is allowed to be loaded during
  1467       // this bootstrapping window.
  1467       // this bootstrapping window.
  1468       if (!DumpSharedSpaces) {
  1468       if (pkg_entry == NULL || pkg_entry->in_unnamed_module()) {
  1469         if (pkg_entry == NULL || pkg_entry->in_unnamed_module()) {
  1469         // Class is either in the unnamed package or in
  1470           // Class is either in the unnamed package or in
  1470         // a named package within the unnamed module.  Either
  1471           // a named package within the unnamed module.  Either
  1471         // case is outside of java.base, do not attempt to
  1472           // case is outside of java.base, do not attempt to
  1472         // load the class post java.base definition.  If
  1473           // load the class post java.base definition.  If
  1473         // java.base has not been defined, let the class load
  1474           // java.base has not been defined, let the class load
  1474         // and its package will be checked later by
  1475           // and its package will be checked later by
  1475         // ModuleEntryTable::verify_javabase_packages.
  1476           // ModuleEntryTable::verify_javabase_packages.
  1476         if (ModuleEntryTable::javabase_defined()) {
  1477           if (ModuleEntryTable::javabase_defined()) {
  1477           return NULL;
  1478             return NULL;
  1478         }
  1479           }
  1479       } else {
  1480         } else {
  1480         // Check that the class' package is defined within java.base.
  1481           // Check that the class' package is defined within java.base.
  1481         ModuleEntry* mod_entry = pkg_entry->module();
  1482           ModuleEntry* mod_entry = pkg_entry->module();
  1482         Symbol* mod_entry_name = mod_entry->name();
  1483           Symbol* mod_entry_name = mod_entry->name();
  1483         if (mod_entry_name->fast_compare(vmSymbols::java_base()) != 0) {
  1484           if (mod_entry_name->fast_compare(vmSymbols::java_base()) != 0) {
  1484           return NULL;
  1485             return NULL;
       
  1486           }
       
  1487         }
  1485         }
  1488       }
  1486       }
  1489     } else {
  1487     } else {
  1490       // After the module system has been initialized, check if the class'
  1488       // After the module system has been initialized, check if the class'
  1491       // package is in a module defined to the boot loader.
  1489       // package is in a module defined to the boot loader.
  1499       }
  1497       }
  1500     }
  1498     }
  1501 
  1499 
  1502     // Prior to bootstrapping's module initialization, never load a class outside
  1500     // Prior to bootstrapping's module initialization, never load a class outside
  1503     // of the boot loader's module path
  1501     // of the boot loader's module path
  1504     assert(Universe::is_module_initialized() || DumpSharedSpaces ||
  1502     assert(Universe::is_module_initialized() ||
  1505            !search_only_bootloader_append,
  1503            !search_only_bootloader_append,
  1506            "Attempt to load a class outside of boot loader's module path");
  1504            "Attempt to load a class outside of boot loader's module path");
  1507 
  1505 
  1508     // Search the shared system dictionary for classes preloaded into the
  1506     // Search the shared system dictionary for classes preloaded into the
  1509     // shared spaces.
  1507     // shared spaces.