src/share/vm/prims/jvmtiRedefineClasses.cpp

changeset 4393
35431a769282
parent 4278
070d523b96a7
child 4395
cc6a617fffd2
     1.1 --- a/src/share/vm/prims/jvmtiRedefineClasses.cpp	Wed Dec 19 10:35:08 2012 -0800
     1.2 +++ b/src/share/vm/prims/jvmtiRedefineClasses.cpp	Thu Dec 20 10:22:19 2012 +0100
     1.3 @@ -3338,7 +3338,20 @@
     1.4      the_class->set_access_flags(flags);
     1.5    }
     1.6  
     1.7 -  // Replace annotation fields value
     1.8 +  // Since there is currently no rewriting of type annotations indexes
     1.9 +  // into the CP, we null out type annotations on scratch_class before
    1.10 +  // we swap annotations with the_class rather than facing the
    1.11 +  // possibility of shipping annotations with broken indexes to
    1.12 +  // Java-land.
    1.13 +  Annotations* new_annotations = scratch_class->annotations();
    1.14 +  if (new_annotations != NULL) {
    1.15 +    Annotations* new_type_annotations = new_annotations->type_annotations();
    1.16 +    if (new_type_annotations != NULL) {
    1.17 +      MetadataFactory::free_metadata(scratch_class->class_loader_data(), new_type_annotations);
    1.18 +      new_annotations->set_type_annotations(NULL);
    1.19 +    }
    1.20 +  }
    1.21 +  // Swap annotation fields values
    1.22    Annotations* old_annotations = the_class->annotations();
    1.23    the_class->set_annotations(scratch_class->annotations());
    1.24    scratch_class->set_annotations(old_annotations);

mercurial