< prev index next >

src/jdk.jdi/share/classes/com/sun/tools/jdi/EventSetImpl.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

@@ -423,20 +423,22 @@
             super(evt, evt.requestID);
             this.classSignature = evt.signature;
         }
 
         public String className() {
-            String name = classSignature.substring(1, classSignature.length() - 1);
-            int index = name.indexOf(".");  // check if it's a hidden class
-            if (index < 0) {
-                name = name.replace('/', '.');
+            int index = classSignature.indexOf(";");
+            if (index == classSignature.length()) {
+                // trim leading 'L' and trailing ';'
+                return classSignature.substring(1, classSignature.length() - 1)
+                                     .replace('/', '.');
             } else {
-                // the class name of a hidden class is <binary-name> + "/" + <suffix>
-                name = name.substring(0, index).replace('/', '.') + "/" +
-                         name.substring(index + 1, name.length());
+                // type descriptor of a hidden class is "L" + N + ";" + "/" + <suffix>
+                // the class name is mapped to: N.replace('/', '.') + "/" + <suffix>
+                return classSignature.substring(1, index)
+                                     .replace('/', '.')
+                       + classSignature.substring(index+1);  // skip ';'
             }
-            return name;
         }
 
         public String classSignature() {
             return classSignature;
         }
< prev index next >