8135265: VM fails on 'empty' interface public <init>()V method with VerifyError
Summary: 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
--- a/hotspot/src/share/vm/classfile/verifier.cpp Tue Sep 22 09:48:19 2015 -0400
+++ b/hotspot/src/share/vm/classfile/verifier.cpp Tue Sep 22 14:24:31 2015 -0400
@@ -1579,9 +1579,11 @@
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");