JDK-8040058 : IsoFields.WEEK_BASED_YEAR adjustInto incorrect
  • Type: Bug
  • Component: core-libs
  • Sub-Component: java.time
  • Affected Version: 8
  • Priority: P3
  • Status: Resolved
  • Resolution: Fixed
  • Submitted: 2014-04-12
  • Updated: 2014-07-29
  • Resolved: 2014-04-19
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 8 JDK 9
8u20Fixed 9 b11Fixed
Related Reports
Duplicate :  
Description
The implementation of IsoFields.WEEK_BASED_YEAR is completely invalid. As a result, addition using WEEK_BASED_YEARS is broken.

Given an input date 2012-W30-6 setting the week-based-year should only change the year and leave the week and day-of-week unaltered (except where week 53 becomes week 52). The current implementation does not achieve this.

In addition, the current code does not reset back to the input temporal, which results in JDK-8038490.

Sadly, this code managed to make it into the JDK with no tests, which also needs addressing.

Comments
Verifying and applying patches provided by scolebourne.
18-04-2014

A related issue is that WeekFields.weekOfWeekBasedYear().range should return 1 to 52/53 but does not. The second patch fixes this related issue and should be applied on top of the first patch.
12-04-2014

Patch to solve the issue
12-04-2014