6841420: classfile: add new methods to ConstantClassInfo
authorjjg
Tue, 19 May 2009 11:33:13 -0700
changeset 2977 fdbc11409428
parent 2976 6850de672553
child 2978 a72220103e31
6841420: classfile: add new methods to ConstantClassInfo Reviewed-by: mcimadamore Contributed-by: kevin.t.looney@sun.com
langtools/src/share/classes/com/sun/tools/classfile/ConstantPool.java
--- a/langtools/src/share/classes/com/sun/tools/classfile/ConstantPool.java	Tue May 19 11:27:10 2009 -0700
+++ b/langtools/src/share/classes/com/sun/tools/classfile/ConstantPool.java	Tue May 19 11:33:13 2009 -0700
@@ -310,6 +310,20 @@
             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 + "]";