1.1 --- a/src/share/classes/com/sun/tools/javac/util/Constants.java Mon Sep 21 21:08:11 2009 -0700 1.2 +++ b/src/share/classes/com/sun/tools/javac/util/Constants.java Wed Sep 23 18:29:41 2009 -0700 1.3 @@ -83,16 +83,28 @@ 1.4 */ 1.5 public static String format(Object value) { 1.6 if (value instanceof Byte) return formatByte((Byte) value); 1.7 + if (value instanceof Short) return formatShort((Short) value); 1.8 if (value instanceof Long) return formatLong((Long) value); 1.9 if (value instanceof Float) return formatFloat((Float) value); 1.10 if (value instanceof Double) return formatDouble((Double) value); 1.11 if (value instanceof Character) return formatChar((Character) value); 1.12 if (value instanceof String) return formatString((String) value); 1.13 - return value + ""; 1.14 + if (value instanceof Integer || 1.15 + value instanceof Boolean) return value.toString(); 1.16 + else 1.17 + throw new IllegalArgumentException("Argument is not a primitive type or a string; it " + 1.18 + ((value == null) ? 1.19 + "is a null value." : 1.20 + "has class " + 1.21 + value.getClass().getName()) + "." ); 1.22 } 1.23 1.24 private static String formatByte(byte b) { 1.25 - return String.format("0x%02x", b); 1.26 + return String.format("(byte)0x%02x", b); 1.27 + } 1.28 + 1.29 + private static String formatShort(short s) { 1.30 + return String.format("(short)%d", s); 1.31 } 1.32 1.33 private static String formatLong(long lng) {