On Tue, 27 Oct 2026 20:15:37 GMT, Justin Lu <[email protected]> wrote:
> This issue originally came in as a performance suggestion to replace the > regex based validation with an ASCII check for `getInstance(Locale)`. > > However, the current regex validation does not even appear like it is > required at all, since `getMainTableEntry` already returns > `INVALID_COUNTRY_ENTRY` for invalid characters, correctly leading to `IAE`. > Additionally, the `null` check looks incorrect because > `BaseLocale.getCountry()` is specified to return the empty String, not > `null`. `getCountry()` also returns the country code in uppercase. > > All we need to do is check the length to ensure that a country exists and > that it is in the form of a ISO 3166 2-letter code instead of a UN M.49 3 > digit code. > > --------- > - [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: 69177972 Author: Justin Lu <[email protected]> URL: https://git.openjdk.org/jdk/commit/691779725369c6e6b69e80c173a9c36582b0fb78 Stats: 24 lines in 1 file changed: 13 ins; 8 del; 3 mod 8395882: Currency.getInstance(Locale) compiles a regex on every call Reviewed-by: naoto ------------- PR: https://git.openjdk.org/jdk/pull/33594
