Adding constant for line.separator and friends

Martin Buchholz martinrb at google.com
Tue Nov 10 04:29:51 UTC 2009


On Mon, Nov 9, 2009 at 20:14, Joe Darcy <Joe.Darcy at sun.com> wrote:

> Martin Buchholz wrote:
>
>>
>>
> Hi Martin,
>
> Given that these values are not true constants since they vary across
> platforms, I think it is misleading to make them look like constant by
> having them be "public static final" fields with ALL CAPS names.
>
> I would prefer to see these values returned by wrapper methods that did the
> necessary security checks and caching.
>
>
We could certainly turn the fields into methods.

Since line.separator is the most popular system property,
and other system properties like
java.home have vague security implications
that would suggest they must be protected by
a security manager, we might consider just
making the one system property available.
Perhaps very simply

String System.lineSeparator()?

or we could put it into java.io.File

String File.lineSeparator()

Martin

-Joe
>
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.openjdk.java.net/pipermail/core-libs-dev/attachments/20091109/cd863b1d/attachment.html>


More information about the core-libs-dev mailing list