src/share/vm/prims/jvmtiClassFileReconstituter.cpp

Print this page

        

@@ -326,18 +326,23 @@
 void JvmtiClassFileReconstituter::write_inner_classes_attribute(int length) {
   typeArrayOop inner_class_list = ikh()->inner_classes();
   guarantee(inner_class_list != NULL && inner_class_list->length() == length,
             "caller must check");
   typeArrayHandle inner_class_list_h(thread(), inner_class_list);
-  assert (length % instanceKlass::inner_class_next_offset == 0, "just checking");
+  assert ((length % instanceKlass::inner_class_next_offset == 0 ||
+           length % instanceKlass::inner_class_next_offset == instanceKlass::enclosing_method_attribute_size),
+           "just checking");
   u2 entry_count = length / instanceKlass::inner_class_next_offset;
   u4 size = 2 + entry_count * (2+2+2+2);
 
   write_attribute_name_index("InnerClasses");
   write_u4(size);
   write_u2(entry_count);
   for (int i = 0; i < length; i += instanceKlass::inner_class_next_offset) {
+    if (i == length - instanceKlass::enclosing_method_attribute_size) {
+      break;
+    }
     write_u2(inner_class_list_h->ushort_at(
                       i + instanceKlass::inner_class_inner_class_info_offset));
     write_u2(inner_class_list_h->ushort_at(
                       i + instanceKlass::inner_class_outer_class_info_offset));
     write_u2(inner_class_list_h->ushort_at(