static Object decodeConstant(Object value, Type type) {
        if (value instanceof Integer) {
            int i = ((Integer) value).intValue();
            switch (type.tag) {
            case BOOLEAN:  return Boolean.valueOf(i != 0);
            case CHAR:     return Character.valueOf((char) i);
            case BYTE:     return Byte.valueOf((byte) i);
            case SHORT:    return Short.valueOf((short) i);
            }
        }
        return value;
    }