8203480: IncompatibleClassChangeError thrown at sites linked to default interface methods

Reviewed-by: kvn
This commit is contained in:
Vladimir Ivanov 2018-06-06 23:36:08 +03:00
parent ff7db9b11a
commit ddc42415c0
4 changed files with 96 additions and 24 deletions

View file

@ -1082,6 +1082,7 @@ Handle SharedRuntime::find_callee_info_helper(JavaThread* thread,
Bytecode_invoke bytecode(caller, bci);
int bytecode_index = bytecode.index();
bc = bytecode.invoke_code();
methodHandle attached_method = extract_attached_method(vfst);
if (attached_method.not_null()) {
@ -1095,6 +1096,11 @@ Handle SharedRuntime::find_callee_info_helper(JavaThread* thread,
// Adjust invocation mode according to the attached method.
switch (bc) {
case Bytecodes::_invokevirtual:
if (attached_method->method_holder()->is_interface()) {
bc = Bytecodes::_invokeinterface;
}
break;
case Bytecodes::_invokeinterface:
if (!attached_method->method_holder()->is_interface()) {
bc = Bytecodes::_invokevirtual;
@ -1110,10 +1116,10 @@ Handle SharedRuntime::find_callee_info_helper(JavaThread* thread,
break;
}
}
} else {
bc = bytecode.invoke_code();
}
assert(bc != Bytecodes::_illegal, "not initialized");
bool has_receiver = bc != Bytecodes::_invokestatic &&
bc != Bytecodes::_invokedynamic &&
bc != Bytecodes::_invokehandle;