On Tue, 1 Oct 2024 21:46:44 GMT, Justin Lu <j...@openjdk.org> wrote: > Please review this PR which modifies a suspicious check in the fallback of > `Locale.getDisplayName(Locale inLocale)`. > > As a fallback, a hard coded pattern is used. The previous code outputted the > qualifiers if the `displayNames` array had length greater than 2. Just a few > lines above, the array is initialized with a length of 3 and so the check is > pointless. > > It would be better, if replaced with a null check for the last element of the > `displayNames` array, as that element may be null if there are no qualifiers. > See L2317 , > > `qualifierNames.length != 0 ? formatList(qualifierNames, > listCompositionPattern) : null` > > For example, now a fallback (with no qualifiers) might look like: `German` > instead of `German (null)`. > But will remain the same (with qualifiers): `German (Germany)`.
This pull request has now been integrated. Changeset: 49c7148d Author: Justin Lu <j...@openjdk.org> URL: https://git.openjdk.org/jdk/commit/49c7148d3770c1ba2cd291f7b55ad471577ee151 Stats: 6 lines in 1 file changed: 0 ins; 1 del; 5 mod 8341366: Suspicious check in Locale.getDisplayName(Locale inLocale) Reviewed-by: naoto ------------- PR: https://git.openjdk.org/jdk/pull/21298