8027804: JCK resolveMethod test fails expecting AbstractMethodError

Create AME overpass methods and fix method search logic

Reviewed-by: kamg, acorn, lfoltan, coleenp
This commit is contained in:
Harold Seigel 2013-12-16 08:24:33 -05:00
parent bbb97e5b39
commit 4856bd53aa
5 changed files with 51 additions and 16 deletions

View file

@ -300,7 +300,7 @@ int LinkResolver::vtable_index_of_interface_method(KlassHandle klass,
Symbol* signature = resolved_method->signature();
// First check in default method array
if (!resolved_method->is_abstract() &&
if (!resolved_method->is_abstract() &&
(InstanceKlass::cast(klass())->default_methods() != NULL)) {
int index = InstanceKlass::find_method_index(InstanceKlass::cast(klass())->default_methods(), name, signature);
if (index >= 0 ) {
@ -318,7 +318,11 @@ int LinkResolver::vtable_index_of_interface_method(KlassHandle klass,
void LinkResolver::lookup_method_in_interfaces(methodHandle& result, KlassHandle klass, Symbol* name, Symbol* signature, TRAPS) {
InstanceKlass *ik = InstanceKlass::cast(klass());
result = methodHandle(THREAD, ik->lookup_method_in_all_interfaces(name, signature));
// Specify 'true' in order to skip default methods when searching the
// interfaces. Function lookup_method_in_klasses() already looked for
// the method in the default methods table.
result = methodHandle(THREAD, ik->lookup_method_in_all_interfaces(name, signature, true));
}
void LinkResolver::lookup_polymorphic_method(methodHandle& result,
@ -620,7 +624,7 @@ void LinkResolver::resolve_interface_method(methodHandle& resolved_method,
bool check_access,
bool nostatics, TRAPS) {
// check if klass is interface
// check if klass is interface
if (!resolved_klass->is_interface()) {
ResourceMark rm(THREAD);
char buf[200];
@ -1287,8 +1291,11 @@ void LinkResolver::runtime_resolve_interface_method(CallInfo& result, methodHand
resolved_klass()->external_name());
THROW_MSG(vmSymbols::java_lang_IncompatibleClassChangeError(), buf);
}
// do lookup based on receiver klass
methodHandle sel_method;
// This search must match the linktime preparation search for itable initialization
// to correctly enforce loader constraints for interface method inheritance
lookup_instance_method_in_klasses(sel_method, recv_klass,
resolved_method->name(),
resolved_method->signature(), CHECK);