--- old/src/hotspot/share/ci/ciField.cpp 2020-03-26 15:56:56.000000000 -0700 +++ new/src/hotspot/share/ci/ciField.cpp 2020-03-26 15:56:55.000000000 -0700 @@ -223,9 +223,10 @@ holder->is_in_package("jdk/internal/foreign") || holder->is_in_package("jdk/incubator/foreign") || holder->is_in_package("java/lang")) return true; - // Trust VM unsafe anonymous classes. They are private API (jdk.internal.misc.Unsafe) - // and can't be serialized, so there is no hacking of finals going on with them. - if (holder->is_unsafe_anonymous()) + // Trust VM hidden and unsafe anonymous classes. They are created via Lookup.defineClass or + // the private API (jdk.internal.misc.Unsafe) and can't be serialized, so there is no hacking + // of finals going on with them. + if (holder->is_hidden() || holder->is_unsafe_anonymous()) return true; // Trust final fields in all boxed classes if (holder->is_box_klass())