< prev index next >

src/hotspot/share/oops/klass.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

@@ -719,13 +719,20 @@
   if (name() == NULL)  return "<unknown>";
   if (is_objArray_klass() && ObjArrayKlass::cast(this)->bottom_klass()->is_hidden()) {
     size_t name_len = name()->utf8_length();
     char* result = NEW_RESOURCE_ARRAY(char, name_len + 1);
     name()->as_C_string(result, (int)name_len + 1);
-    for (int index = (int)name_len; index > 0; index--) {
+    // the signature name of an array of hidden class is of the form "[L<N>;/<S>"
+    // <N> is the binary name of the original class file in internal form
+    // <S> is the suffix
+    assert(result[name_len-1] == JVM_SIGNATURE_ENDCLASS, "unexpected signature endclass character");
+    for (int index = (int)name_len-2; index > 0; index--) {
+      result[index+1] = result[index];   // shift the suffix to the right
       if (result[index] == '+') {
-        result[index] = JVM_SIGNATURE_DOT;
+        // Replace the last '+' with a ';' followed with '/'.
+        result[index] = JVM_SIGNATURE_ENDCLASS;
+        result[index+1] = JVM_SIGNATURE_SLASH;
         break;
       }
     }
     return result;
   }
< prev index next >