JDK-8261476 : Release Note: TreeMap.computeIfAbsent Mishandles Existing Entries Whose Values Are null
  • Type: Sub-task
  • Component: core-libs
  • Sub-Component: java.util:collections
  • Affected Version: 17
  • Priority: P3
  • Status: Closed
  • Resolution: Delivered
  • Submitted: 2021-02-09
  • Updated: 2022-06-21
  • Resolved: 2021-12-05
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 15 JDK 16 JDK 17
15Resolved 16Resolved 17Resolved
Description
A bug has been fixed in enhancement JDK-8176894 that inadvertently introduced erroneous behavior in the `TreeMap.computeIfAbsent` method. The erroneous behavior was that, if the map contained an existing mapping whose value was null, the `computeIfAbsent` method would immediately return null. Other `TreeMap` methods modified by the enhancement were unaffected. To conform with the specification, `computeIfAbsent` now calls the mapping function and updates the map with the function's result.
Comments
This was a Known Issue in 15 and 16 that was fixed in 17. The Known Issue RN text for 15 and 16 is in the individual RN backports while the Fixed RN text is in the 17 RN subtask.
21-06-2022