RFR: 8270490: Charset.forName() taking fallback default value [v2]
Alan Bateman
alanb at openjdk.java.net
Wed Oct 20 19:02:31 UTC 2021
On Wed, 20 Oct 2021 18:56:22 GMT, Naoto Sato <naoto at openjdk.org> wrote:
>> src/java.base/share/classes/java/nio/charset/Charset.java line 545:
>>
>>> 543: * @return A charset object for the named charset, or {@code fallback}
>>> 544: * in case the charset object for the named charset is not
>>> 545: * available. May be {@code null}
>>
>> A minor comment: it seems to me returning the fallback charset is sufficient, and "May be null" may be not necessary since the fallback charset is provided, it's expected if it's null.
>
> Thanks, Joe. Moved that explanation into the `fallback` param, which I initially intended.
The java.nio.charset package has the usual "Unless otherwise noted, passing a null argument ..." so if fallback is allowed to be null then you will need to add ", can null" to its description.
-------------
PR: https://git.openjdk.java.net/jdk/pull/6045
More information about the core-libs-dev
mailing list