comparison src/share/vm/classfile/defaultMethods.cpp @ 13414:379f11bc04fc

8028438: static superclass method masks default methods Reviewed-by: hseigel, lfoltan, coleenp
author acorn
date Tue, 03 Dec 2013 11:13:14 -0800
parents fce21ac5968d
children 02f27ecb4f3a 2353011244bd
comparison
equal deleted inserted replaced
13413:7a58803b5069 13414:379f11bc04fc
623 // (can't use the vtable because it is not guaranteed to be initialized yet) 623 // (can't use the vtable because it is not guaranteed to be initialized yet)
624 InstanceKlass* super = klass->java_super(); 624 InstanceKlass* super = klass->java_super();
625 while (super != NULL) { 625 while (super != NULL) {
626 for (int i = 0; i < super->methods()->length(); ++i) { 626 for (int i = 0; i < super->methods()->length(); ++i) {
627 Method* m = super->methods()->at(i); 627 Method* m = super->methods()->at(i);
628 if (m->is_overpass()) { 628 if (m->is_overpass() || m->is_static()) {
629 // m is a method that would have been a miranda if not for the 629 // m is a method that would have been a miranda if not for the
630 // default method processing that occurred on behalf of our superclass, 630 // default method processing that occurred on behalf of our superclass,
631 // so it's a method we want to re-examine in this new context. That is, 631 // so it's a method we want to re-examine in this new context. That is,
632 // unless we have a real implementation of it in the current class. 632 // unless we have a real implementation of it in the current class.
633 Method* impl = klass->lookup_method(m->name(), m->signature()); 633 Method* impl = klass->lookup_method(m->name(), m->signature());
634 if (impl == NULL || impl->is_overpass()) { 634 if (impl == NULL || impl->is_overpass() || impl->is_static()) {
635 if (!already_in_vtable_slots(slots, m)) { 635 if (!already_in_vtable_slots(slots, m)) {
636 slots->append(new EmptyVtableSlot(m)); 636 slots->append(new EmptyVtableSlot(m));
637 } 637 }
638 } 638 }
639 } 639 }
646 // m is a method that would have been a miranda if not for the 646 // m is a method that would have been a miranda if not for the
647 // default method processing that occurred on behalf of our superclass, 647 // default method processing that occurred on behalf of our superclass,
648 // so it's a method we want to re-examine in this new context. That is, 648 // so it's a method we want to re-examine in this new context. That is,
649 // unless we have a real implementation of it in the current class. 649 // unless we have a real implementation of it in the current class.
650 Method* impl = klass->lookup_method(m->name(), m->signature()); 650 Method* impl = klass->lookup_method(m->name(), m->signature());
651 if (impl == NULL || impl->is_overpass()) { 651 if (impl == NULL || impl->is_overpass() || impl->is_static()) {
652 if (!already_in_vtable_slots(slots, m)) { 652 if (!already_in_vtable_slots(slots, m)) {
653 slots->append(new EmptyVtableSlot(m)); 653 slots->append(new EmptyVtableSlot(m));
654 } 654 }
655 } 655 }
656 } 656 }