--- old/src/hotspot/share/classfile/moduleEntry.cpp 2018-05-24 13:18:16.086401116 -0400 +++ new/src/hotspot/share/classfile/moduleEntry.cpp 2018-05-24 13:18:14.136451505 -0400 @@ -25,7 +25,7 @@ #include "precompiled.hpp" #include "jni.h" #include "classfile/classLoaderData.inline.hpp" -#include "classfile/javaClasses.hpp" +#include "classfile/javaClasses.inline.hpp" #include "classfile/moduleEntry.hpp" #include "logging/log.hpp" #include "memory/resourceArea.hpp" @@ -236,10 +236,14 @@ // The java.lang.Module for this loader's // corresponding unnamed module can be found in the java.lang.ClassLoader object. oop module = java_lang_ClassLoader::unnamedModule(cld->class_loader()); + + // Ensure that the unnamed module was correctly set when + // the class loader was constructed. + guarantee(java_lang_Module::is_instance(module), "unnamed module is not an instance of type java.lang.Module"); + ModuleEntry* unnamed_module = new_unnamed_module_entry(Handle(Thread::current(), module), cld); - // Store pointer to the ModuleEntry in the unnamed module's java.lang.Module - // object. + // Store pointer to the ModuleEntry in the unnamed module's java.lang.Module object. java_lang_Module::set_module_entry(module, unnamed_module); return unnamed_module;