8135265: VM fails on 'empty' interface public <init>()V method with VerifyError
authorhseigel
Tue, 22 Sep 2015 14:24:31 -0400
changeset 32825 79488b52df9b
parent 32824 3b686e54dece
child 32826 14b2ab72189f
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
hotspot/src/share/vm/classfile/verifier.cpp
--- 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");