8135265: VM fails on 'empty' interface public <init>()V method with VerifyError

Don't check for calls to super() or this() fro <init>()V methods if they are in interfaces.  Because, they are not ctors.

Reviewed-by: acorn, gtriantafill
This commit is contained in:
Harold Seigel 2015-09-22 14:24:31 -04:00
parent 1890d7a430
commit d01e8e3c74

View file

@ -1579,9 +1579,11 @@ void ClassVerifier::verify_method(methodHandle m, TRAPS) {
return;
}
// Make sure "this" has been initialized if current method is an
// <init>
// <init>. Note that "<init>" methods in interfaces are just
// normal methods. Interfaces cannot have ctors.
if (_method->name() == vmSymbols::object_initializer_name() &&
current_frame.flag_this_uninit()) {
current_frame.flag_this_uninit() &&
!current_class()->is_interface()) {
verify_error(ErrorContext::bad_code(bci),
"Constructor must call super() or this() "
"before return");