Commits
Tarun Sukhani authored 241dd4bf190
perf(utils): migrate AlternativeDateFormat to thread-safe DateTimeFormatter Replaces the synchronized SimpleDateFormat list with an immutable DateTimeFormatter list, removing the global monitor that previously serialized every date parse across the whole app. Throughput is now bounded by per-thread parse latency rather than by one parse at a time. Behavior preservation: - ResolverStyle.LENIENT keeps the SDF rollover semantics callers rely on (e.g., month overflow, day overflow). Existing parse outcomes are unchanged for the 13 default patterns. - ZoneId captured once at construction mirrors SDF's "zone fixed at formatter creation" contract; later TimeZone.setDefault() does not retroactively shift parses through this formatter. - setFormats() retains its existing append (not replace) semantics. Concurrency: - DateTimeFormatter is documented immutable + thread-safe, so parse() takes no monitor. - The compiled-pattern list is volatile, so a parse() iterating the list never sees a partially-published setFormats() update. Tests: - Adds 10 new UtilsTest cases exercising every default parse path (ISO8601 with/without literal Z, space-separated date-time, date-only, compact ddMMyyyy, slashed and dashed European formats, length-mismatch rejection, unrecognized-input rejection, setFormats-append). - Two latent quirks surfaced by the test scaffolding are preserved rather than silently changed: yyyyMMdd is not a default pattern, and dd-MM-yyyy HH:mm:ss is unreachable under current ordering because yyyy-MM-dd HH:mm:ss lenient eats the input first. Worth a separate format-ordering fix; explicitly out of scope here. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>