src/share/vm/classfile/verifier.cpp

changeset 6784
e6b738407432
parent 6771
b5ae226b7516
child 6785
d6fcbd1e1075
equal deleted inserted replaced
6783:eb984acb23fe 6784:e6b738407432
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, 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, 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 {

mercurial