changeset 147:00870be9028f

6841420: classfile: add new methods to ConstantClassInfo Reviewed-by: mcimadamore Contributed-by: kevin.t.looney@sun.com
author jjg
date Tue, 19 May 2009 11:33:13 -0700
parents c9b0fee44d44
children 17dfaebe2304
files src/share/classes/com/sun/tools/classfile/ConstantPool.java
diffstat 1 files changed, 14 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- a/src/share/classes/com/sun/tools/classfile/ConstantPool.java	Wed Jun 18 16:53:08 2008 -0700
+++ b/src/share/classes/com/sun/tools/classfile/ConstantPool.java	Tue May 19 11:33:13 2009 -0700
@@ -306,6 +306,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 + "]";