--- old/src/share/vm/classfile/systemDictionary.cpp 2016-12-08 19:05:29.571064422 -0500 +++ new/src/share/vm/classfile/systemDictionary.cpp 2016-12-08 19:05:28.150983285 -0500 @@ -1222,6 +1222,8 @@ bool SystemDictionary::is_shared_class_visible(Symbol* class_name, instanceKlassHandle ik, Handle class_loader, TRAPS) { + assert(!ModuleEntryTable::javabase_moduleEntry()->is_patched(), + "Cannot use sharing if java.base is patched"); ResourceMark rm; int path_index = ik->shared_classpath_index(); SharedClassPathEntry* ent = @@ -1249,6 +1251,12 @@ } } + // If the archived class is from a module that has been patched at runtime, + // the class cannot be loaded from the archive. + if (mod_entry != NULL && mod_entry->is_patched()) { + return false; + } + if (class_loader.is_null()) { assert(ent != NULL, "Shared class for NULL classloader must have valid SharedClassPathEntry"); // The NULL classloader can load archived class originated from the