Hi Naoto,

Sorry for the off thread reply.  I didn't have the mail replies setup on the 
list and I seem to be unable to add a in-reply-to header via web email.

> Although the error message may be confusing, 'c' conversion cannot be 
> used for a String argument (like in your example). It simply converts 
> numeric value into a single character, thus no need for output 
> "precision." I am not the designer of the class, so might be wrong.

Yes I totally missed that.  I dug up the relevant source:

https://github.com/openjdk/jdk/blob/350303d4f0c71f77fa784a92d13522a380e3b2fe/src/java.base/share/classes/java/util/Formatter.java#L3006
https://github.com/openjdk/jdk/blob/c709e1cbf030e7129fa34815b150097ba6f6840c/test/jdk/java/util/Formatter/Basic-X.java.template#L432

So this code doesn't deal with CharSequence and therefore the precision is 
implicitly one.  With the exception if null getting converted to 4 chars.

Is it worth me filing an RFE to allow 'c' to accept a CharSequence and allow 
precision to be set?

Thanks,

Jason

Reply via email to