8043454: Test case for 8037157 should not throw a VerifyError
authorhseigel
Mon, 14 Jul 2014 13:31:03 +0400
changeset 25509 2677915ac7ef
parent 25508 3b6775dd6f41
child 25510 d6c0b1381379
child 25647 949674dcd7c7
8043454: Test case for 8037157 should not throw a VerifyError Summary: Don't throw VerifyError if method is NULL. Reviewed-by: acorn, lfoltan, mschoene
hotspot/src/share/vm/classfile/verifier.cpp
--- a/hotspot/src/share/vm/classfile/verifier.cpp	Wed May 07 19:34:48 2014 +0400
+++ b/hotspot/src/share/vm/classfile/verifier.cpp	Mon Jul 14 13:31:03 2014 +0400
@@ -2311,21 +2311,19 @@
         vmSymbols::object_initializer_name(),
         cp->signature_ref_at(bcs->get_index_u2()),
         Klass::normal);
-      if (m == NULL) {
-        verify_error(ErrorContext::bad_code(bci),
-            "Call to missing <init> method");
-        return;
-      }
-      instanceKlassHandle mh(THREAD, m->method_holder());
-      if (m->is_protected() && !mh->is_same_class_package(_klass())) {
-        bool assignable = current_type().is_assignable_from(
-          objectref_type, this, CHECK_VERIFY(this));
-        if (!assignable) {
-          verify_error(ErrorContext::bad_type(bci,
-              TypeOrigin::cp(new_class_index, objectref_type),
-              TypeOrigin::implicit(current_type())),
-              "Bad access to protected <init> method");
-          return;
+      // Do nothing if method is not found.  Let resolution detect the error.
+      if (m != NULL) {
+        instanceKlassHandle mh(THREAD, m->method_holder());
+        if (m->is_protected() && !mh->is_same_class_package(_klass())) {
+          bool assignable = current_type().is_assignable_from(
+            objectref_type, this, CHECK_VERIFY(this));
+          if (!assignable) {
+            verify_error(ErrorContext::bad_type(bci,
+                TypeOrigin::cp(new_class_index, objectref_type),
+                TypeOrigin::implicit(current_type())),
+                "Bad access to protected <init> method");
+            return;
+          }
         }
       }
     }