On Wed, 8 Apr 2026 17:21:43 GMT, Justin Lu <[email protected]> wrote: > This PR standardizes the null related behavior for the `Locale` filtering and > lookup APIs. > > There are two issues. First, null elements within either `Collection` which > are passed to these APIs may cause NPE, but this is not specified. Second, if > the `tags` or `locales` list is null and `priorityList` empty, NPE is not > thrown (even though it is specified to). > > For example, this is the current null related behavior for > `Locale:lookup(List<LanguageRange>, Collection<Locale>)`, > >> [], null -> NPE not thrown >> [en], null >> null, [] >> null, [en] >> [null], [en] >> [null], [] -> NPE not thrown >> [], [null] -> NPE not thrown >> [en], [null] > > > This update fixes the empty case to correctly throw NPE. Additionally, there > is a specification update to make the `null` element NPE apparent (and > implementation dependent). > > --------- > - [x] I confirm that I make this contribution in accordance with the [OpenJDK > Interim AI Policy](https://openjdk.org/legal/ai).
This pull request has now been integrated. Changeset: a2ea276e Author: Justin Lu <[email protected]> URL: https://git.openjdk.org/jdk/commit/a2ea276e83ea3c83daee354e9cb08e5001a6247c Stats: 83 lines in 3 files changed: 44 ins; 8 del; 31 mod 8381644: Locale matching APIs should describe `null` element behavior Reviewed-by: naoto ------------- PR: https://git.openjdk.org/jdk/pull/30632
