RFR: 8247402: Documentation for Map::compute contains confusing implementation requirements

Stuart Marks smarks at openjdk.java.net
Wed Nov 25 06:21:55 UTC 2020


On Tue, 24 Nov 2020 02:19:34 GMT, Pavel Rappo <prappo at openjdk.org> wrote:

> 2. Both the proposed pseudo-code and the existing pseudo-code deviate from the documented behaviour (written in prose) and the actual implementation.

Let me clarify something. The "documented behavior" is actually the API specification, the contract that applies to Map.compute and all its implementations. The pseudo-code is part of the "implementation requirements" section, whose primary responsibility is to specify what the default implementation actually does. (Of course, that implementation should also conform to the API spec.)

We've established that the pseudo-code -- either the existing or proposed version -- differs from the default implementation's actual behavior. It's thus failed its primary responsibility, and therefore that's the problem that needs to be fixed. I think it's pointless to clean up the pseudo-code if the result is still incorrect.

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

PR: https://git.openjdk.java.net/jdk/pull/714


More information about the core-libs-dev mailing list