JEP proposed to target JDK 18: 400: UTF-8 by Default
Alex Buckley
alex.buckley at oracle.com
Wed Aug 18 20:47:53 UTC 2021
On 8/18/2021 12:48 PM, Naoto Sato wrote:
> On 8/18/21 10:03 AM, Remi Forax wrote:
>> A minor comment, there is a sentence in the JEP that is weird.
>>
>> "However, having to pass an argument prevents these methods from being
>> used via method references (::) in stream pipelines."
>>
>> You can not use these methods in a Stream anyway because they are
>> declared with "throws IOException", so this argument does not hold.
>> I think this sentence should be removed.
>
> Thanks. Removed the sentence.
There is now a dangling paragraph -- "Developers familiar with such
hazards can use methods that take a charset argument explicitly." --
whose words undermine the case for having a default charset at all.
I recommend preserving the complaint about having to pass an argument,
but rephrasing it to be less connected to the specific
FileWriter/FileReader APIs in the prior paragraph (after all, there are
ctors in Formatter and Scanner which use the default charset and don't
throw IOException) :
-----
Developers familiar with such hazards can use methods and constructors
that take a charset argument explicitly. However, having to pass an
argument prevents methods and constructors from being used via method
references (::) in stream pipelines.
[Swapped first two words, to continue the Developer theme] Developers
sometimes attempt to set the default charset via ...
-----
Alex
More information about the jdk-dev
mailing list