< prev index next >

src/jdk.jdi/share/classes/com/sun/tools/jdi/JNITypeParser.java

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

@@ -75,16 +75,16 @@
         } else {
             sb.append('L');
             index = typeName.indexOf("/");   // check if it's a hidden class
             if (index < 0) {
                 sb.append(typeName.replace('.', '/'));
+                sb.append(";");
             } else {
                 sb.append(typeName.substring(0, index).replace('.', '/'));
-                sb.append(".");
-                sb.append(typeName.substring(index+1, typeName.length()));
+                sb.append(";");
+                sb.append(typeName.substring(index, typeName.length()));
             }
-            sb.append(';');
         }
 
         return sb.toString();
     }
 

@@ -163,13 +163,19 @@
                 return  key + nextSignature();
 
             case (JDWP.Tag.OBJECT):
                 int endClass = signature.indexOf(SIGNATURE_ENDCLASS,
                                                  currentIndex);
-                String retVal = signature.substring(currentIndex - 1,
-                                                    endClass + 1);
+                String retVal;
+                if ((endClass+1) < signature.length() && signature.charAt(endClass+1) == '/') {
+                    // hidden class
+                    retVal = signature.substring(currentIndex - 1);
+                    currentIndex = signature.length();
+                } else {
+                    retVal = signature.substring(currentIndex - 1, endClass + 1);
                 currentIndex = endClass + 1;
+                }
                 return retVal;
 
             case (JDWP.Tag.VOID):
             case (JDWP.Tag.BOOLEAN):
             case (JDWP.Tag.BYTE):

@@ -208,18 +214,18 @@
             case (JDWP.Tag.OBJECT):
                 int endClass = signature.indexOf(SIGNATURE_ENDCLASS,
                                                  currentIndex);
                 String retVal = signature.substring(currentIndex,
                                                     endClass);
-                int index = retVal.indexOf(".");
-                if (index < 0) {
-                    retVal = retVal.replace('/', '.');
+                if ((endClass+1) < signature.length() && signature.charAt(endClass+1) == '/') {
+                    // hidden class
+                    retVal = retVal.replace('/', '.') + signature.substring(endClass + 1);
+                    currentIndex = signature.length();
                 } else {
-                    retVal = retVal.substring(0, index).replace('/', '.') + "/" +
-                             retVal.substring(index + 1, retVal.length());
-                }
+                    retVal = retVal.replace('/', '.');
                 currentIndex = endClass + 1;
+                }
                 return retVal;
 
             case (JDWP.Tag.FLOAT):
                 return "float";
 
< prev index next >