8247444: Trust final fields in records

Co-authored-by: Christoph Dreis <christoph.dreis@freenet.de>
Reviewed-by: jrose, dholmes, forax, coleenp, vlivanov
This commit is contained in:
Mandy Chung 2020-06-19 08:27:59 -07:00
parent 983e012c9f
commit f2b191a6e9
26 changed files with 227 additions and 49 deletions

View file

@ -897,6 +897,9 @@ oop Reflection::new_field(fieldDescriptor* fd, TRAPS) {
java_lang_reflect_Field::set_slot(rh(), fd->index());
java_lang_reflect_Field::set_name(rh(), name());
java_lang_reflect_Field::set_type(rh(), type());
if (fd->is_trusted_final()) {
java_lang_reflect_Field::set_trusted_final(rh());
}
// Note the ACC_ANNOTATION bit, which is a per-class access flag, is never set here.
java_lang_reflect_Field::set_modifiers(rh(), fd->access_flags().as_int() & JVM_RECOGNIZED_FIELD_MODIFIERS);
java_lang_reflect_Field::set_override(rh(), false);