1.1 --- a/src/share/classes/com/sun/tools/javap/ConstantWriter.java Sat Aug 08 17:50:57 2009 -0700 1.2 +++ b/src/share/classes/com/sun/tools/javap/ConstantWriter.java Sat Aug 08 17:56:37 2009 -0700 1.3 @@ -134,10 +134,10 @@ 1.4 int width = String.valueOf(constant_pool.size()).length() + 1; 1.5 int cpx = 1; 1.6 while (cpx < constant_pool.size()) { 1.7 - print(String.format("const %" + width + "s", ("#" + cpx))); 1.8 + print(String.format("%" + width + "s", ("#" + cpx))); 1.9 try { 1.10 CPInfo cpInfo = constant_pool.get(cpx); 1.11 - print(String.format(" = %-15s ", tagName(cpInfo.getTag()))); 1.12 + print(String.format(" = %-18s ", cpTagName(cpInfo))); 1.13 cpx += cpInfo.accept(v, null); 1.14 } catch (ConstantPool.InvalidIndex ex) { 1.15 // should not happen 1.16 @@ -178,10 +178,15 @@ 1.17 print(tagName(tag) + " " + stringValue(cpInfo)); 1.18 } 1.19 1.20 + String cpTagName(CPInfo cpInfo) { 1.21 + String n = cpInfo.getClass().getSimpleName(); 1.22 + return n.replace("CONSTANT_", "").replace("_info", ""); 1.23 + } 1.24 + 1.25 String tagName(int tag) { 1.26 switch (tag) { 1.27 case CONSTANT_Utf8: 1.28 - return "Asciz"; 1.29 + return "Utf8"; 1.30 case CONSTANT_Integer: 1.31 return "int"; 1.32 case CONSTANT_Float: 1.33 @@ -203,7 +208,7 @@ 1.34 case CONSTANT_NameAndType: 1.35 return "NameAndType"; 1.36 default: 1.37 - return "unknown tag"; 1.38 + return "(unknown tag)"; 1.39 } 1.40 } 1.41