< prev index next >

src/hotspot/share/prims/jvmtiClassFileReconstituter.cpp

Print this page

        

@@ -1,7 +1,7 @@
 /*
- * Copyright (c) 2005, 2018, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2005, 2019, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
  * under the terms of the GNU General Public License version 2 only, as
  * published by the Free Software Foundation.

@@ -421,10 +421,30 @@
     u2 class_cp_index = nest_members->at(i);
     write_u2(class_cp_index);
   }
 }
 
+//  PermittedSubtypes {
+//    u2 attribute_name_index;
+//    u4 attribute_length;
+//    u2 number_of_classes;
+//    u2 classes[number_of_classes];
+//  }
+void JvmtiClassFileReconstituter::write_permitted_subtypes_attribute() {
+  Array<u2>* permitted_subtypes = ik()->permitted_subtypes();
+  int number_of_classes = permitted_subtypes->length();
+  int length = sizeof(u2) * (1 + number_of_classes);
+
+  write_attribute_name_index("PermittedSubtypes");
+  write_u4(length);
+  write_u2(number_of_classes);
+  for (int i = 0; i < number_of_classes; i++) {
+    u2 class_cp_index = permitted_subtypes->at(i);
+    write_u2(class_cp_index);
+  }
+}
+
 
 // Write InnerClasses attribute
 // JVMSpec|   InnerClasses_attribute {
 // JVMSpec|     u2 attribute_name_index;
 // JVMSpec|     u4 attribute_length;

@@ -697,10 +717,13 @@
     ++attr_count;
   }
   if (ik()->nest_members() != Universe::the_empty_short_array()) {
     ++attr_count;
   }
+  if (ik()->permitted_subtypes() != Universe::the_empty_short_array()) {
+    ++attr_count;
+  }
 
   write_u2(attr_count);
 
   if (generic_signature != NULL) {
     write_signature_attribute(symbol_to_cpool_index(generic_signature));

@@ -727,10 +750,13 @@
     write_nest_host_attribute();
   }
   if (ik()->nest_members() != Universe::the_empty_short_array()) {
     write_nest_members_attribute();
   }
+  if (ik()->permitted_subtypes() != Universe::the_empty_short_array()) {
+    write_permitted_subtypes_attribute();
+  }
 }
 
 // Write the method information portion of ClassFile structure
 // JVMSpec|     u2 methods_count;
 // JVMSpec|     method_info methods[methods_count];
< prev index next >