Mercurial > hg > graal-jvmci-8
diff src/share/vm/prims/jvmtiRedefineClasses.cpp @ 7457:35431a769282
8004823: Add VM support for type annotation reflection
Reviewed-by: dholmes, coleenp
Contributed-by: joel.franck@oracle.com
author | stefank |
---|---|
date | Thu, 20 Dec 2012 10:22:19 +0100 |
parents | 070d523b96a7 |
children | cc6a617fffd2 |
line wrap: on
line diff
--- a/src/share/vm/prims/jvmtiRedefineClasses.cpp Wed Dec 19 10:35:08 2012 -0800 +++ b/src/share/vm/prims/jvmtiRedefineClasses.cpp Thu Dec 20 10:22:19 2012 +0100 @@ -3338,7 +3338,20 @@ 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);