8171155: Scanning method file for initialized final field updates can fail for non-existent fields
authorzmajo
Mon, 19 Dec 2016 08:31:01 +0100
changeset 42870 525f24ac5db0
parent 42869 32e49f36d795
child 42871 c89e1f0a084e
8171155: Scanning method file for initialized final field updates can fail for non-existent fields Summary: Check if field exists before possibly marking it as having initialized final updates. Reviewed-by: stsmirno, vlivanov, coleenp
hotspot/src/share/vm/interpreter/rewriter.cpp
--- a/hotspot/src/share/vm/interpreter/rewriter.cpp	Mon Dec 19 05:00:24 2016 +0000
+++ b/hotspot/src/share/vm/interpreter/rewriter.cpp	Mon Dec 19 08:31:01 2016 +0100
@@ -426,15 +426,16 @@
               Symbol* field_sig = cp->signature_ref_at(bc_index);
 
               fieldDescriptor fd;
-              klass->find_field(field_name, field_sig, &fd);
-              if (fd.access_flags().is_final()) {
-                if (fd.access_flags().is_static()) {
-                  if (!method->is_static_initializer()) {
-                    fd.set_has_initialized_final_update(true);
-                  }
-                } else {
-                  if (!method->is_object_initializer()) {
-                    fd.set_has_initialized_final_update(true);
+              if (klass->find_field(field_name, field_sig, &fd) != NULL) {
+                if (fd.access_flags().is_final()) {
+                  if (fd.access_flags().is_static()) {
+                    if (!method->is_static_initializer()) {
+                      fd.set_has_initialized_final_update(true);
+                    }
+                  } else {
+                    if (!method->is_object_initializer()) {
+                      fd.set_has_initialized_final_update(true);
+                    }
                   }
                 }
               }