diff -r bac62054c0b6 -r ff8ff9dcccec hotspot/src/share/vm/classfile/systemDictionary.cpp --- a/hotspot/src/share/vm/classfile/systemDictionary.cpp Mon Dec 19 15:21:11 2016 +0000 +++ b/hotspot/src/share/vm/classfile/systemDictionary.cpp Mon Dec 19 13:54:33 2016 -0500 @@ -1231,6 +1231,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 = @@ -1258,6 +1260,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