<i18n dev> RFR: 8349000: Performance improvement for Currency.isPastCutoverDate(String) [v2]

Justin Lu jlu at openjdk.org
Mon Feb 3 19:01:51 UTC 2025


On Mon, 3 Feb 2025 18:05:51 GMT, Naoto Sato <naoto at openjdk.org> wrote:

>> src/java.base/share/classes/java/util/Currency.java line 1182:
>> 
>>> 1180:         private static boolean isPastCutoverDate(String cutOver) {
>>> 1181:             return System.currentTimeMillis() >
>>> 1182:                     LocalDateTime.parse(cutOver.trim(), DateTimeFormatter.ISO_LOCAL_DATE_TIME)
>> 
>> Btw, do we really need this `trim()` call?
>> It looks redundant. prop.date is result part of `m.group(4)` of this regexp:
>> https://github.com/openjdk/jdk/blob/3f1d9b573546685215af06031656efe6f1429caf/src/java.base/share/classes/java/util/Currency.java#L255-L257
>> `(\\d{4}-\\d{2}-\\d{2}T\\d{2}:\\d{2}:\\d{2})`
>> 
>> I don't see how it could contain whitespace characters on start or end.
>
> That seems to be correct to me

Right, that previous `trim()` is unnecessary. Removed.

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

PR Review Comment: https://git.openjdk.org/jdk/pull/23374#discussion_r1939875572


More information about the i18n-dev mailing list