comparison src/share/vm/classfile/verifier.cpp @ 18055:1fa005fb28f5

8043454: Test case for 8037157 should not throw a VerifyError Summary: Don't throw VerifyError if method is NULL. Reviewed-by: acorn, lfoltan, mschoene
author hseigel
date Wed, 28 May 2014 08:09:26 -0400
parents 2373a1f4987c
children 54bc75c144b0
comparison
equal deleted inserted replaced
18054:fbf689f3752e 18055:1fa005fb28f5
2305 Klass* ref_klass = load_class( 2305 Klass* ref_klass = load_class(
2306 ref_class_type.name(), CHECK_VERIFY(this)); 2306 ref_class_type.name(), CHECK_VERIFY(this));
2307 Method* m = InstanceKlass::cast(ref_klass)->uncached_lookup_method( 2307 Method* m = InstanceKlass::cast(ref_klass)->uncached_lookup_method(
2308 vmSymbols::object_initializer_name(), 2308 vmSymbols::object_initializer_name(),
2309 cp->signature_ref_at(bcs->get_index_u2())); 2309 cp->signature_ref_at(bcs->get_index_u2()));
2310 if (m == NULL) { 2310 // Do nothing if method is not found. Let resolution detect the error.
2311 verify_error(ErrorContext::bad_code(bci), 2311 if (m != NULL) {
2312 "Call to missing <init> method"); 2312 instanceKlassHandle mh(THREAD, m->method_holder());
2313 return; 2313 if (m->is_protected() && !mh->is_same_class_package(_klass())) {
2314 } 2314 bool assignable = current_type().is_assignable_from(
2315 instanceKlassHandle mh(THREAD, m->method_holder()); 2315 objectref_type, this, true, CHECK_VERIFY(this));
2316 if (m->is_protected() && !mh->is_same_class_package(_klass())) { 2316 if (!assignable) {
2317 bool assignable = current_type().is_assignable_from( 2317 verify_error(ErrorContext::bad_type(bci,
2318 objectref_type, this, true, CHECK_VERIFY(this)); 2318 TypeOrigin::cp(new_class_index, objectref_type),
2319 if (!assignable) { 2319 TypeOrigin::implicit(current_type())),
2320 verify_error(ErrorContext::bad_type(bci, 2320 "Bad access to protected <init> method");
2321 TypeOrigin::cp(new_class_index, objectref_type), 2321 return;
2322 TypeOrigin::implicit(current_type())), 2322 }
2323 "Bad access to protected <init> method");
2324 return;
2325 } 2323 }
2326 } 2324 }
2327 } 2325 }
2328 current_frame->initialize_object(type, new_class_type); 2326 current_frame->initialize_object(type, new_class_type);
2329 } else { 2327 } else {