# HG changeset patch # User hseigel # Date 1401278966 14400 # Node ID 1fa005fb28f5cef65c592cf9cfeed3f4ed4e8524 # Parent fbf689f3752e93d4ca5451bb2ce396a1881a2638 8043454: Test case for 8037157 should not throw a VerifyError Summary: Don't throw VerifyError if method is NULL. Reviewed-by: acorn, lfoltan, mschoene diff -r fbf689f3752e -r 1fa005fb28f5 src/share/vm/classfile/verifier.cpp --- a/src/share/vm/classfile/verifier.cpp Tue May 20 19:50:58 2014 -0700 +++ b/src/share/vm/classfile/verifier.cpp Wed May 28 08:09:26 2014 -0400 @@ -2307,21 +2307,19 @@ Method* m = InstanceKlass::cast(ref_klass)->uncached_lookup_method( vmSymbols::object_initializer_name(), cp->signature_ref_at(bcs->get_index_u2())); - if (m == NULL) { - verify_error(ErrorContext::bad_code(bci), - "Call to missing method"); - return; - } - instanceKlassHandle mh(THREAD, m->method_holder()); - if (m->is_protected() && !mh->is_same_class_package(_klass())) { - bool assignable = current_type().is_assignable_from( - objectref_type, this, true, CHECK_VERIFY(this)); - if (!assignable) { - verify_error(ErrorContext::bad_type(bci, - TypeOrigin::cp(new_class_index, objectref_type), - TypeOrigin::implicit(current_type())), - "Bad access to protected method"); - return; + // Do nothing if method is not found. Let resolution detect the error. + if (m != NULL) { + instanceKlassHandle mh(THREAD, m->method_holder()); + if (m->is_protected() && !mh->is_same_class_package(_klass())) { + bool assignable = current_type().is_assignable_from( + objectref_type, this, true, CHECK_VERIFY(this)); + if (!assignable) { + verify_error(ErrorContext::bad_type(bci, + TypeOrigin::cp(new_class_index, objectref_type), + TypeOrigin::implicit(current_type())), + "Bad access to protected method"); + return; + } } } }