comparison src/share/vm/classfile/defaultMethods.cpp @ 21870:12dcf5ba8b34

Merge with jdk8u45-b14
author Gilles Duboscq <gilles.m.duboscq@oracle.com>
date Tue, 09 Jun 2015 11:54:04 +0200
parents 52b4284cb496 02e2c04a3289
children dd9cc155639c
comparison
equal deleted inserted replaced
21801:ea56cec1de34 21870:12dcf5ba8b34
729 InstanceKlass* iklass = current_class(); 729 InstanceKlass* iklass = current_class();
730 730
731 Method* m = iklass->find_method(_method_name, _method_signature); 731 Method* m = iklass->find_method(_method_name, _method_signature);
732 // private interface methods are not candidates for default methods 732 // private interface methods are not candidates for default methods
733 // invokespecial to private interface methods doesn't use default method logic 733 // invokespecial to private interface methods doesn't use default method logic
734 // private class methods are not candidates for default methods,
735 // private methods do not override default methods, so need to perform
736 // default method inheritance without including private methods
734 // The overpasses are your supertypes' errors, we do not include them 737 // The overpasses are your supertypes' errors, we do not include them
735 // future: take access controls into account for superclass methods 738 // future: take access controls into account for superclass methods
736 if (m != NULL && !m->is_static() && !m->is_overpass() && 739 if (m != NULL && !m->is_static() && !m->is_overpass() && !m->is_private()) {
737 (!iklass->is_interface() || m->is_public())) {
738 if (_family == NULL) { 740 if (_family == NULL) {
739 _family = new StatefulMethodFamily(); 741 _family = new StatefulMethodFamily();
740 } 742 }
741 743
742 if (iklass->is_interface()) { 744 if (iklass->is_interface()) {
743 StateRestorer* restorer = _family->record_method_and_dq_further(m); 745 StateRestorer* restorer = _family->record_method_and_dq_further(m);
744 scope->add_mark(restorer); 746 scope->add_mark(restorer);
745 } else { 747 } else {
746 // This is the rule that methods in classes "win" (bad word) over 748 // This is the rule that methods in classes "win" (bad word) over
747 // methods in interfaces. This works because of single inheritance 749 // methods in interfaces. This works because of single inheritance
750 // private methods in classes do not "win", they will be found
751 // first on searching, but overriding for invokevirtual needs
752 // to find default method candidates for the same signature
748 _family->set_target_if_empty(m); 753 _family->set_target_if_empty(m);
749 } 754 }
750 } 755 }
751 return true; 756 return true;
752 } 757 }