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
--- 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);
+ }
}
}
}