diff -r f48737be4fd7 -r dcb418f5aabd src/hotspot/share/classfile/systemDictionary.cpp --- a/src/hotspot/share/classfile/systemDictionary.cpp Mon Oct 07 17:12:22 2019 +0200 +++ b/src/hotspot/share/classfile/systemDictionary.cpp Mon Oct 07 11:29:10 2019 -0700 @@ -1432,6 +1432,11 @@ // a named package within the unnamed module. In all cases, // limit visibility to search for the class only in the boot // loader's append path. + if (!ClassLoader::has_bootclasspath_append()) { + // If there is no bootclasspath append entry, no need to continue + // searching. + return NULL; + } search_only_bootloader_append = true; } }