changeset 9000:9cd2f42c84c0

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
author hseigel
date Tue, 22 Sep 2015 14:24:31 -0400
parents 8e4288c4127d
children fbac2a5639dc
files src/share/vm/classfile/verifier.cpp
diffstat 1 files changed, 4 insertions(+), 2 deletions(-) [+]
line wrap: on
line diff
--- a/src/share/vm/classfile/verifier.cpp	Tue Sep 22 09:48:19 2015 -0400
+++ b/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");