Re changes from JDK-8068498, but docs everywhere still referencing line.separator system property

Michael Rasmussen Michael.Rasmussen at roguewave.com
Fri Mar 1 17:43:24 UTC 2019


Hi,

When JDK-8068498 was implemented (in JDK9), it simply changed PrintWriter and BufferedWriter to use System.lineSeparator(), but the spec for the classes and methods still mentions line.separator system property, thus giving the impression that changing that system property has an impact.
I know that JDK-8068498 was there to counter people from doing stuff like:
System.setProperty("line.separator", "\n");
unixBW = new BufferedWriter(...)

But according to the javadoc for BufferedWriter, the value of that property should impact how the writer works.
This also applies to a method like Files.write(path, lines), where .newLine() is implicitly called after each element in the lines Iterable, and again the line.separator system property is explicitly mentioned in the spec for that method.

The spec for these classes and methods should probably be updated to reference System.lineSeparator() instead?

/Michael


More information about the core-libs-dev mailing list