--- old/src/share/vm/classfile/classFileParser.cpp 2017-04-16 02:24:06.050607232 -0700 +++ new/src/share/vm/classfile/classFileParser.cpp 2017-04-16 02:24:05.850599731 -0700 @@ -5361,8 +5361,14 @@ ik->set_name(_class_name); if (is_anonymous()) { - // I am well known to myself - patch_class(ik->constants(), _this_class_index, ik, ik->name()); // eagerly resolve + // _this_class_index is a CONSTANT_Class entry that refers to this + // anonymous class itself. If this class needs to refer to its own methods or + // fields, it would use a CONSTANT_MethodRef, etc, which would reference + // _this_class_index. However, because this class is anonymous (it's + // not stored in SystemDictionary), _this_class_index cannot be resolved + // with ConstantPool::klass_at_impl, which does a SystemDictionary lookup. + // Therefore, we must eagerly resolve _this_class_index now. + ik->constants()->klass_at_put(_this_class_index, ik); } ik->set_minor_version(_minor_version); @@ -5672,10 +5678,6 @@ _need_verify = Verifier::should_verify_for(_loader_data->class_loader(), stream->need_verify()); } - // reserve space for names of the patches classes - if (is_anonymous()) { - _max_num_patched_klasses ++; // for patching the class index - } if (_cp_patches != NULL) { int len = _cp_patches->length(); for (int i=0; i