287 // Package private methods may also override other vtable entries |
287 // Package private methods may also override other vtable entries |
288 InstanceKlass* klassVtable::find_transitive_override(InstanceKlass* initialsuper, methodHandle target_method, |
288 InstanceKlass* klassVtable::find_transitive_override(InstanceKlass* initialsuper, methodHandle target_method, |
289 int vtable_index, Handle target_loader, Symbol* target_classname, Thread * THREAD) { |
289 int vtable_index, Handle target_loader, Symbol* target_classname, Thread * THREAD) { |
290 InstanceKlass* superk = initialsuper; |
290 InstanceKlass* superk = initialsuper; |
291 while (superk != NULL && superk->super() != NULL) { |
291 while (superk != NULL && superk->super() != NULL) { |
292 InstanceKlass* supersuperklass = InstanceKlass::cast(superk->super()); |
292 klassVtable* ssVtable = (superk->super())->vtable(); |
293 klassVtable* ssVtable = supersuperklass->vtable(); |
|
294 if (vtable_index < ssVtable->length()) { |
293 if (vtable_index < ssVtable->length()) { |
295 Method* super_method = ssVtable->method_at(vtable_index); |
294 Method* super_method = ssVtable->method_at(vtable_index); |
|
295 // get the class holding the matching method |
|
296 // make sure you use that class for is_override |
|
297 InstanceKlass* supermethodholder = super_method->method_holder(); |
296 #ifndef PRODUCT |
298 #ifndef PRODUCT |
297 Symbol* name= target_method()->name(); |
299 Symbol* name= target_method()->name(); |
298 Symbol* signature = target_method()->signature(); |
300 Symbol* signature = target_method()->signature(); |
299 assert(super_method->name() == name && super_method->signature() == signature, "vtable entry name/sig mismatch"); |
301 assert(super_method->name() == name && super_method->signature() == signature, "vtable entry name/sig mismatch"); |
300 #endif |
302 #endif |
301 if (supersuperklass->is_override(super_method, target_loader, target_classname, THREAD)) { |
303 |
|
304 if (supermethodholder->is_override(super_method, target_loader, target_classname, THREAD)) { |
302 #ifndef PRODUCT |
305 #ifndef PRODUCT |
303 if (PrintVtables && Verbose) { |
306 if (PrintVtables && Verbose) { |
304 ResourceMark rm(THREAD); |
307 ResourceMark rm(THREAD); |
305 char* sig = target_method()->name_and_sig_as_C_string(); |
308 char* sig = target_method()->name_and_sig_as_C_string(); |
306 tty->print("transitive overriding superclass %s with %s::%s index %d, original flags: ", |
309 tty->print("transitive overriding superclass %s with %s::%s index %d, original flags: ", |
307 supersuperklass->internal_name(), |
310 supermethodholder->internal_name(), |
308 _klass->internal_name(), sig, vtable_index); |
311 _klass->internal_name(), sig, vtable_index); |
309 super_method->access_flags().print_on(tty); |
312 super_method->access_flags().print_on(tty); |
310 if (super_method->is_default_method()) { |
313 if (super_method->is_default_method()) { |
311 tty->print("default "); |
314 tty->print("default "); |
312 } |
315 } |