Repository navigation
Conversation
…e it Symmetry454Date.with(TemporalField, long) and Symmetry010Date.with returned `this` when the new value was zero, so with(YEAR, 0), with(PROLEPTIC_MONTH, 0) and with(EPOCH_DAY, 0) left the date unchanged, and values outside the field range were accepted: with(DAY_OF_WEEK, 0) returned the date unchanged although the day-of-week range is 1-7. The two Symmetry calendars are the only ones in the package with this special case; every other chronology inherits AbstractDate.with, which validates the value and uses it, as does java.time (LocalDate.with(EPOCH_DAY, 0) is 1970-01-01 and LocalDate.with(DAY_OF_WEEK, 0) throws). with(EPOCH_DAY, 0) is now epoch day 0, with(YEAR, 0) is year 0 and with(DAY_OF_WEEK, 0) throws DateTimeException. The three data rows that asserted the old no-op move to the invalid-value data, and rows are added for the zero values of YEAR, PROLEPTIC_MONTH and EPOCH_DAY.
|
No actionable comments were generated in the recent review. Walkthrough
Merge Risk:
|
Symmetry454Date.with(TemporalField, long)andSymmetry010Date.withstarted withso a zero value silently left the date unchanged, and a value outside the field range was accepted too:
java.timetreats zero as an ordinary value:LocalDate.of(2014, 5, 26).with(EPOCH_DAY, 0)is 1970-01-01 andwith(DAY_OF_WEEK, 0)throwsDateTimeException. Every other chronology in this package behaves the same way, because they inheritAbstractDate.with, which checks the field's range and uses the value -PaxDate,InternationalFixedDate,CopticDate,EthiopicDate,JulianDate,DiscordianDate,AccountingDateandBritishCutoverDateall overridewithwithout this special case.The special case is removed, so
with(EPOCH_DAY, 0)is epoch day 0,with(YEAR, 0)andwith(PROLEPTIC_MONTH, 0)set the field to zero, and a value outside the field's range throwsDateTimeException.Verification:
TestSymmetry454ChronologyandTestSymmetry010Chronologyfail onmainwith these changes (14 failures: the three data rows per calendar that asserted the old no-op, the new invalid-value rows and the newtest_with_TemporalField_zeroValue) and pass with the fix - 1493 tests;mvn checkstyle:checkreports 0 violations.Summary by CodeRabbit