953 if (sel_klass() != current_klass()) {
954 ss.print("Update to %s final field %s.%s attempted from a different class (%s) than the field's declaring class",
955 is_static ? "static" : "non-static", resolved_klass()->external_name(), fd.name()->as_C_string(),
956 current_klass()->external_name());
957 THROW_MSG(vmSymbols::java_lang_IllegalAccessError(), ss.as_string());
958 }
959
960 if (fd.constants()->pool_holder()->major_version() >= 53) {
961 methodHandle m = link_info.current_method();
962 assert(!m.is_null(), "information about the current method must be available for 'put' bytecodes");
963 bool is_initialized_static_final_update = (byte == Bytecodes::_putstatic &&
964 fd.is_static() &&
965 !m()->is_static_initializer());
966 bool is_initialized_instance_final_update = ((byte == Bytecodes::_putfield || byte == Bytecodes::_nofast_putfield) &&
967 !fd.is_static() &&
968 !m->is_object_initializer());
969
970 if (is_initialized_static_final_update || is_initialized_instance_final_update) {
971 ss.print("Update to %s final field %s.%s attempted from a different method (%s) than the initializer method %s ",
972 is_static ? "static" : "non-static", resolved_klass()->external_name(), fd.name()->as_C_string(),
973 current_klass()->external_name(),
974 is_static ? "<clinit>" : "<init>");
975 THROW_MSG(vmSymbols::java_lang_IllegalAccessError(), ss.as_string());
976 }
977 }
978 }
979
980 // initialize resolved_klass if necessary
981 // note 1: the klass which declared the field must be initialized (i.e, sel_klass)
982 // according to the newest JVM spec (5.5, p.170) - was bug (gri 7/28/99)
983 //
984 // note 2: we don't want to force initialization if we are just checking
985 // if the field access is legal; e.g., during compilation
986 if (is_static && initialize_class) {
987 sel_klass->initialize(CHECK);
988 }
989
990 if (sel_klass() != current_klass()) {
991 check_field_loader_constraints(field, sig, current_klass, sel_klass, CHECK);
992 }
993
|
953 if (sel_klass() != current_klass()) {
954 ss.print("Update to %s final field %s.%s attempted from a different class (%s) than the field's declaring class",
955 is_static ? "static" : "non-static", resolved_klass()->external_name(), fd.name()->as_C_string(),
956 current_klass()->external_name());
957 THROW_MSG(vmSymbols::java_lang_IllegalAccessError(), ss.as_string());
958 }
959
960 if (fd.constants()->pool_holder()->major_version() >= 53) {
961 methodHandle m = link_info.current_method();
962 assert(!m.is_null(), "information about the current method must be available for 'put' bytecodes");
963 bool is_initialized_static_final_update = (byte == Bytecodes::_putstatic &&
964 fd.is_static() &&
965 !m()->is_static_initializer());
966 bool is_initialized_instance_final_update = ((byte == Bytecodes::_putfield || byte == Bytecodes::_nofast_putfield) &&
967 !fd.is_static() &&
968 !m->is_object_initializer());
969
970 if (is_initialized_static_final_update || is_initialized_instance_final_update) {
971 ss.print("Update to %s final field %s.%s attempted from a different method (%s) than the initializer method %s ",
972 is_static ? "static" : "non-static", resolved_klass()->external_name(), fd.name()->as_C_string(),
973 m()->name()->as_C_string(),
974 is_static ? "<clinit>" : "<init>");
975 THROW_MSG(vmSymbols::java_lang_IllegalAccessError(), ss.as_string());
976 }
977 }
978 }
979
980 // initialize resolved_klass if necessary
981 // note 1: the klass which declared the field must be initialized (i.e, sel_klass)
982 // according to the newest JVM spec (5.5, p.170) - was bug (gri 7/28/99)
983 //
984 // note 2: we don't want to force initialization if we are just checking
985 // if the field access is legal; e.g., during compilation
986 if (is_static && initialize_class) {
987 sel_klass->initialize(CHECK);
988 }
989
990 if (sel_klass() != current_klass()) {
991 check_field_loader_constraints(field, sig, current_klass, sel_klass, CHECK);
992 }
993
|