RFR: 8270490: Charset.forName() taking fallback default value

Joe Wang joehw at openjdk.java.net
Wed Oct 20 18:40:05 UTC 2021


On Wed, 20 Oct 2021 17:23:36 GMT, Naoto Sato <naoto at openjdk.org> wrote:

> During the review of JEP 400, a proposal to provide an overloaded method to `Charset.forName()` was suggested [[1]](https://github.com/openjdk/jdk/pull/4733#discussion_r669693954). This PR is to implement the proposal. A CSR is also drafted as https://bugs.openjdk.java.net/browse/JDK-8275348

Marked as reviewed by joehw (Reviewer).

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.

-------------

PR: https://git.openjdk.java.net/jdk/pull/6045


More information about the core-libs-dev mailing list