JDK-8194412 : Adding 256 units of IsoFields.QUARTER_YEARS broken
  • Type: Bug
  • Component: core-libs
  • Sub-Component: java.time
  • Affected Version: 8,9.0.1,10,11
  • Priority: P4
  • Status: Resolved
  • Resolution: Fixed
  • OS: other
  • CPU: x86
  • Submitted: 2017-12-29
  • Updated: 2019-01-14
  • Resolved: 2018-01-29
The Version table provides details related to the release that this issue/RFE will be addressed.

Unresolved : Release in which this issue/RFE will be addressed.
Resolved: Release in which this issue/RFE has been resolved.
Fixed : Release in which this issue/RFE has been fixed. The release containing this fix may be available for download as an Early Access Release or a General Availability Release.

To download the current JDK release, click here.
JDK 11 JDK 8
11 b01Fixed 8u192Fixed
Description
FULL PRODUCT VERSION :


A DESCRIPTION OF THE PROBLEM :
Adding more than 255 units of QUARTER_YEARS to a temporal instance is faulty. E.g. adding 256 QUARTER_YEARS is adding 1 year instead of 64 years.

See http://hg.openjdk.java.net/jdk9/jdk9/jdk/file/65464a307408/src/java.base/share/classes/java/time/temporal/IsoFields.java#l709


STEPS TO FOLLOW TO REPRODUCE THE PROBLEM :
LocalDate d = LocalDate.of(1900, 1, 1);
System.out.println(d.plus(255, IsoFields.QUARTER_YEARS));
System.out.println(d.plus(256, IsoFields.QUARTER_YEARS));


EXPECTED VERSUS ACTUAL BEHAVIOR :
EXPECTED -
1963-10-01
1964-01-01
ACTUAL -
1963-10-01
1901-01-01


REPRODUCIBILITY :
This bug can be reproduced always.