withVariant() used getDayOfYear() as the month-length bound when clamping the day-of-month to the target variant.
Use getMonthLength(), matching resolvePreviousValid. getMonthLength() now calls checkCalendarInit(). HijrahConfigTest copies a custom variant whose year 1300 month 1 has 29 days and checks that day 30 clamps to 29. --------- - [x] I confirm that I make this contribution in accordance with the [OpenJDK Interim AI Policy](https://openjdk.org/legal/ai). ------------- Commit messages: - init Changes: https://git.openjdk.org/jdk/pull/33079/files Webrev: https://webrevs.openjdk.org/?repo=jdk&pr=33079&range=00 Issue: https://bugs.openjdk.org/browse/JDK-8393048 Stats: 61 lines in 5 files changed: 59 ins; 0 del; 2 mod Patch: https://git.openjdk.org/jdk/pull/33079.diff Fetch: git fetch https://git.openjdk.org/jdk.git pull/33079/head:pull/33079 PR: https://git.openjdk.org/jdk/pull/33079
