--- old/src/hotspot/share/prims/jvmtiRedefineClasses.cpp 2020-03-26 15:59:40.000000000 -0700 +++ new/src/hotspot/share/prims/jvmtiRedefineClasses.cpp 2020-03-26 15:59:40.000000000 -0700 @@ -150,8 +150,9 @@ } oop mirror = JNIHandles::resolve_non_null(_class_defs[i].klass); - // classes for primitives and arrays and vm unsafe anonymous classes cannot be redefined - // check here so following code can assume these classes are InstanceKlass + // classes for primitives, arrays, hidden and vm unsafe anonymous classes + // cannot be redefined. Check here so following code can assume these classes + // are InstanceKlass. if (!is_modifiable_class(mirror)) { _res = JVMTI_ERROR_UNMODIFIABLE_CLASS; return false; @@ -293,8 +294,9 @@ return false; } - // Cannot redefine or retransform an unsafe anonymous class. - if (InstanceKlass::cast(k)->is_unsafe_anonymous()) { + // Cannot redefine or retransform a hidden or an unsafe anonymous class. + if (InstanceKlass::cast(k)->is_hidden() || + InstanceKlass::cast(k)->is_unsafe_anonymous()) { return false; } return true; @@ -1239,11 +1241,12 @@ // load hook event. state->set_class_being_redefined(the_class, _class_load_kind); + ClassLoadInfo cl_info(protection_domain); InstanceKlass* scratch_class = SystemDictionary::parse_stream( the_class_sym, the_class_loader, - protection_domain, &st, + cl_info, THREAD); // Clear class_being_redefined just to be sure. state->clear_class_being_redefined();