mirror of
https://github.com/openjdk/jdk.git
synced 2025-08-28 07:14:30 +02:00
8004823: Add VM support for type annotation reflection
Reviewed-by: dholmes, coleenp
This commit is contained in:
parent
9c761152db
commit
6ed6cb5375
22 changed files with 302 additions and 11 deletions
|
@ -3338,7 +3338,20 @@ void VM_RedefineClasses::redefine_single_class(jclass the_jclass,
|
|||
the_class->set_access_flags(flags);
|
||||
}
|
||||
|
||||
// Replace annotation fields value
|
||||
// Since there is currently no rewriting of type annotations indexes
|
||||
// into the CP, we null out type annotations on scratch_class before
|
||||
// we swap annotations with the_class rather than facing the
|
||||
// possibility of shipping annotations with broken indexes to
|
||||
// Java-land.
|
||||
Annotations* new_annotations = scratch_class->annotations();
|
||||
if (new_annotations != NULL) {
|
||||
Annotations* new_type_annotations = new_annotations->type_annotations();
|
||||
if (new_type_annotations != NULL) {
|
||||
MetadataFactory::free_metadata(scratch_class->class_loader_data(), new_type_annotations);
|
||||
new_annotations->set_type_annotations(NULL);
|
||||
}
|
||||
}
|
||||
// Swap annotation fields values
|
||||
Annotations* old_annotations = the_class->annotations();
|
||||
the_class->set_annotations(scratch_class->annotations());
|
||||
scratch_class->set_annotations(old_annotations);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue