--- old/src/hotspot/share/oops/instanceKlass.cpp 2020-04-13 21:03:46.000000000 -0700 +++ new/src/hotspot/share/oops/instanceKlass.cpp 2020-04-13 21:03:46.000000000 -0700 @@ -2682,13 +2682,20 @@ 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 @@ -2697,7 +2704,9 @@ } // Add the semicolon and the NULL - dest[dest_index++] = JVM_SIGNATURE_ENDCLASS; + if (!is_hidden()) { + dest[dest_index++] = JVM_SIGNATURE_ENDCLASS; + } dest[dest_index] = '\0'; return dest; }