< prev index next >
src/jdk.jdi/share/classes/com/sun/tools/jdi/JNITypeParser.java
Print this page
rev 58565 : 8238358: Implementation of JEP 371: Hidden Classes
Reviewed-by: duke
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
*** 1,7 ****
/*
! * Copyright (c) 1998, 2017, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License version 2 only, as
* published by the Free Software Foundation. Oracle designates this
--- 1,7 ----
/*
! * Copyright (c) 1998, 2020, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License version 2 only, as
* published by the Free Software Foundation. Oracle designates this
*** 41,82 ****
JNITypeParser(String signature) {
this.signature = signature;
}
! static String typeNameToSignature(String signature) {
StringBuilder sb = new StringBuilder();
! int firstIndex = signature.indexOf('[');
int index = firstIndex;
while (index != -1) {
sb.append('[');
! index = signature.indexOf('[', index + 1);
}
if (firstIndex != -1) {
! signature = signature.substring(0, firstIndex);
}
! if (signature.equals("boolean")) {
sb.append('Z');
! } else if (signature.equals("byte")) {
sb.append('B');
! } else if (signature.equals("char")) {
sb.append('C');
! } else if (signature.equals("short")) {
sb.append('S');
! } else if (signature.equals("int")) {
sb.append('I');
! } else if (signature.equals("long")) {
sb.append('J');
! } else if (signature.equals("float")) {
sb.append('F');
! } else if (signature.equals("double")) {
sb.append('D');
} else {
sb.append('L');
! sb.append(signature.replace('.', '/'));
sb.append(';');
}
return sb.toString();
}
--- 41,89 ----
JNITypeParser(String signature) {
this.signature = signature;
}
! static String typeNameToSignature(String typeName) {
StringBuilder sb = new StringBuilder();
! int firstIndex = typeName.indexOf('[');
int index = firstIndex;
while (index != -1) {
sb.append('[');
! index = typeName.indexOf('[', index + 1);
}
if (firstIndex != -1) {
! typeName = typeName.substring(0, firstIndex);
}
! if (typeName.equals("boolean")) {
sb.append('Z');
! } else if (typeName.equals("byte")) {
sb.append('B');
! } else if (typeName.equals("char")) {
sb.append('C');
! } else if (typeName.equals("short")) {
sb.append('S');
! } else if (typeName.equals("int")) {
sb.append('I');
! } else if (typeName.equals("long")) {
sb.append('J');
! } else if (typeName.equals("float")) {
sb.append('F');
! } else if (typeName.equals("double")) {
sb.append('D');
} else {
sb.append('L');
! index = typeName.indexOf("/"); // check if it's a hidden class
! if (index < 0) {
! sb.append(typeName.replace('.', '/'));
! } else {
! sb.append(typeName.substring(0, index).replace('.', '/'));
! sb.append(".");
! sb.append(typeName.substring(index+1, typeName.length()));
! }
sb.append(';');
}
return sb.toString();
}
*** 201,211 ****
case (JDWP.Tag.OBJECT):
int endClass = signature.indexOf(SIGNATURE_ENDCLASS,
currentIndex);
String retVal = signature.substring(currentIndex,
endClass);
! retVal = retVal.replace('/','.');
currentIndex = endClass + 1;
return retVal;
case (JDWP.Tag.FLOAT):
return "float";
--- 208,224 ----
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('/', '.');
! } else {
! retVal = retVal.substring(0, index).replace('/', '.') + "/" +
! retVal.substring(index + 1, retVal.length());
! }
currentIndex = endClass + 1;
return retVal;
case (JDWP.Tag.FLOAT):
return "float";
< prev index next >