From 58eddef3f42dc09bb23bec53c1776d7a5bf35628 Mon Sep 17 00:00:00 2001 From: Kevin Looney Date: Tue, 19 May 2009 11:33:13 -0700 Subject: [PATCH] 6841420: classfile: add new methods to ConstantClassInfo Reviewed-by: mcimadamore --- .../com/sun/tools/classfile/ConstantPool.java | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/langtools/src/share/classes/com/sun/tools/classfile/ConstantPool.java b/langtools/src/share/classes/com/sun/tools/classfile/ConstantPool.java index 95ac3442671..f06c1386689 100644 --- a/langtools/src/share/classes/com/sun/tools/classfile/ConstantPool.java +++ b/langtools/src/share/classes/com/sun/tools/classfile/ConstantPool.java @@ -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 + "]";