Support for StringBuilder / Appendable in java.text APIs
Fabian Lange
lange.fabian at gmail.com
Tue Jan 20 09:49:12 UTC 2015
Hi all,
not sure if this is the appropriate audience, but I noticed that when I
have a StringBuilder, I cannot use any of the optimized format() methods in
the java.text APIs (NumberFormat, DateFormat, ChoiceFormat etc)
All those methods only accept a StringBuffer.
The obvious change would be to make them accept "Appendable", but that
would break to much reflective use of them, wouldn't it?
Could an API be added which accepts Appendable? Or is that effort not worth
the benefit of using StringBuilder over StringBuffer? Well the JIT might be
able to eliminate the locking overhead, however, there is a lot of code out
there using StringBuilders, and I would guess they should be able to use
the java.text APIs?
The sun misc internal APIs support Appendable already (like
FloatingDecimal.appendTo)
I searched the JDK Bug System and mailing list for this topic, but could
not find a suitable hit. If there is such a discussion somewhere, let me
know and I will weight in there.
Fabian
More information about the core-libs-dev
mailing list