changeset 13054:73aa17ad605c

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
author zmajo
date Mon, 19 Dec 2016 08:31:01 +0100
parents 880eee977f5f
children 9831cd4dd428
files src/share/vm/interpreter/rewriter.cpp
diffstat 1 files changed, 10 insertions(+), 9 deletions(-) [+]
line wrap: on
line diff
--- a/src/share/vm/interpreter/rewriter.cpp	Mon Dec 19 05:00:24 2016 +0000
+++ b/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);
+                    }
                   }
                 }
               }