Adding constant for line.separator and friends
Joseph D. Darcy
Joe.Darcy at Sun.COM
Tue Nov 10 18:06:58 UTC 2009
Mark Reinhold wrote:
>> Date: Mon, 09 Nov 2009 23:07:05 -0800
>> From: Martin Buchholz <martinrb at google.com>
>> On Mon, Nov 9, 2009 at 21:54, Mark Reinhold <mr at sun.com> wrote:
>>> Yet ... how much of a problem is this outside of the JDK itself and,
>>> more generally, for new code rather than old?
>>> If there are n (for n <= 43) problematic uses in the JDK then we could
>>> just fix those without defining any new public API. For new code we
>>> should encourage people to use String.format("...%n...") rather than
>>> access the line.separator property explicitly.
>> Hacking on Formatter is how I got here.
>> String.format("%n")" is both at risk of throwing SecurityException
>> (because Formatter does not use doPrivileged;
>> my proposal here is a step to fixing that)
>> and is rather slow.
>> Too slow for performance-sensitive uses.
> Okay, fair enough.
If we're settled on a method in System, please send a revised spec and
I'll file the ccc paperwork.
More information about the core-libs-dev