--- old/src/hotspot/share/classfile/systemDictionaryShared.cpp 2019-12-03 19:36:49.000000000 -0800 +++ new/src/hotspot/share/classfile/systemDictionaryShared.cpp 2019-12-03 19:36:49.000000000 -0800 @@ -899,7 +899,7 @@ if (!UseSharedSpaces) { return NULL; } - if (class_name == NULL) { // don't do this for anonymous classes + if (class_name == NULL) { // don't do this for hidden and unsafe anonymous classes return NULL; } if (class_loader.is_null() || @@ -1078,9 +1078,9 @@ } bool SystemDictionaryShared::should_be_excluded(InstanceKlass* k) { - if (k->class_loader_data()->is_unsafe_anonymous()) { - warn_excluded(k, "Unsafe anonymous class"); - return true; // unsafe anonymous classes are not archived, skip + if (k->is_hidden() || k->is_unsafe_anonymous()) { + warn_excluded(k, "Hidden or Unsafe anonymous class"); + return true; // hidden and unsafe anonymous classes are not archived, skip } if (k->is_in_error_state()) { warn_excluded(k, "In error state");