RFR: JDK-8323760 putIfAbsent documentation conflicts with itself [v3]

Stuart Marks smarks at openjdk.org
Thu Mar 21 05:24:21 UTC 2024


On Wed, 14 Feb 2024 20:46:17 GMT, John Hendrikx <jhendrikx at openjdk.org> wrote:

>> Update the documentation for `@return` tag of `putIfAbsent` to match the main description. `putIfAbsent` uses the same wording as `put` for its `@return` tag, but that is incorrect.  `putIfAbsent` never returns the **previous** value, as the whole point of the method is not the replace the value if it was present.  As such, if it returns a value, it is the **current** value, and in all other cases it will return `null`.
>
> John Hendrikx has updated the pull request incrementally with one additional commit since the last revision:
> 
>   Use new suggestion and remove original clarification

Sorry for the delay.

The current wording looks fine.

I've changed the summary of the bug report to "clarify specification of Map::putIfAbsent return value" which I think is a better description. @hjohn please change the PR title to match.

I've taken the liberty of updating the CSR. While this is sort-of a borderline case for a CSR, it is a bit more than fixing a typo; it's rewording a bit of normative specification. The CSR doesn't need to say too much beyond documenting the change and the reason for it (which I've done, based on @hjohn's original draft). The CSR should be approved without difficulty. Please review it. (@pavelrappo please mark as reviewed if you get a chance, thanks.)

-------------

PR Comment: https://git.openjdk.org/jdk/pull/17438#issuecomment-2011242189


More information about the core-libs-dev mailing list