6841420: classfile: add new methods to ConstantClassInfo

Reviewed-by: mcimadamore
This commit is contained in:
Kevin Looney 2009-05-19 11:33:13 -07:00 committed by Jonathan Gibbons
parent c1b42c6d84
commit 58eddef3f4

View File

@ -310,6 +310,20 @@ public class ConstantPool {
return cp.getUTF8Value(name_index);
}
public String getBaseName() throws ConstantPoolException {
String name = getName();
int index = name.indexOf("[L") + 1;
return name.substring(index);
}
public int getDimensionCount() throws ConstantPoolException {
String name = getName();
int count = 0;
while (name.charAt(count) == '[')
count++;
return count;
}
@Override
public String toString() {
return "CONSTANT_Class_info[name_index: " + name_index + "]";