From 26663c70d64d2b754086125b0e414a87e46f462a Mon Sep 17 00:00:00 2001 From: zmajo Date: Mon, 19 Dec 2016 08:31:01 +0100 Subject: [PATCH] 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 --- src/share/vm/interpreter/rewriter.cpp | 19 ++++++++++--------- 1 file changed, 10 insertions(+), 9 deletions(-) diff --git a/src/share/vm/interpreter/rewriter.cpp b/src/share/vm/interpreter/rewriter.cpp index 7bb42e9d1..b2d89c89c 100644 --- a/src/share/vm/interpreter/rewriter.cpp +++ b/src/share/vm/interpreter/rewriter.cpp @@ -416,15 +416,16 @@ void Rewriter::scan_method(Method* method, bool reverse, bool* invokespecial_err 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); + } } } } -- GitLab