< prev index next >

src/hotspot/share/oops/instanceKlass.cpp

Print this page
rev 58768 : 8238358: Implementation of JEP 371: Hidden Classes
Reviewed-by: alanb, cjplummer, coleenp, dholmes, dlong, forax, jlahoda, psandoz, plevart, vromero
Contributed-by: mandy.chung@oracle.com, lois.foltan@oracle.com, david.holmes@oracle.com, harold.seigel@oracle.com, serguei.spitsyn@oracle.com, alex.buckley@oracle.com, jamsheed.c.m@oracle.com, jan.lahoda@oracle.com, amy.lu@oracle.com
rev 58769 : imported patch type-descriptor-name
rev 58770 : [mq]: svc-spec-update

@@ -2680,26 +2680,35 @@
   // Add the actual class name
   for (int src_index = 0; src_index < src_length; ) {
     dest[dest_index++] = src[src_index++];
   }
 
-  if (is_hidden()) { // Replace the last '+' with a '.'.
-    for (int index = (int)src_length; index > 0; index--) {
+  if (is_hidden()) {
+    int end_class = -1;
+    for (int index = (int)dest_index-1; index > 0; index--) {  // dest[0] is "L"
+      dest[index+1] = dest[index];
       if (dest[index] == '+') {
-        dest[index] = JVM_SIGNATURE_DOT;
+        // Replace the last '+' with a ';' followed with '/'.
+        dest[index] = JVM_SIGNATURE_ENDCLASS;
+        dest[index+1] = JVM_SIGNATURE_SLASH;
+        end_class = index;
         break;
       }
     }
+    assert(end_class > 0, "unexpected hidden class name");
+    dest_index++;
   }
 
   // If we have a hash, append it
   for (int hash_index = 0; hash_index < hash_len; ) {
     dest[dest_index++] = hash_buf[hash_index++];
   }
 
   // Add the semicolon and the NULL
+  if (!is_hidden()) {
   dest[dest_index++] = JVM_SIGNATURE_ENDCLASS;
+  }
   dest[dest_index] = '\0';
   return dest;
 }
 
 ModuleEntry* InstanceKlass::module() const {
< prev index next >