RFR: 8358015: Fix SequencedMap sequenced view method specifications [v2]
Jaikiran Pai
jpai at openjdk.org
Sat May 31 12:58:51 UTC 2025
On Sat, 31 May 2025 00:47:16 GMT, Stuart Marks <smarks at openjdk.org> wrote:
>> For a full explanation, see the bug report [JDK-8358015](https://bugs.openjdk.org/browse/JDK-8358015).
>>
>> This PR includes three related changes:
>> * New overrides in SequencedMap view collection implementations, which improve their behavior.
>> * Update to `@implSpec` clauses to reflect this behavior (which was previously ill-specified).
>> * Update to a test which relied on unspecified behavior.
>
> Stuart Marks has updated the pull request incrementally with one additional commit since the last revision:
>
> Tweak nsee() declaration; adjust specs per suggestion; update copyrights.
Hello Stuart, thank you for the updates. These look good to me.
As for the testing, you are right that behaviour testing where method A calls B and such isn't usually tested in the JDK. I think that's fine. I was unclear about what testing I was talking about in my previous comment. I was mostly curious whether we had tests to verify that the `getFirst()/getLast()` `EntrySet` returned through a `SequencedMap.sequencedEntrySet()` does indeed prevent a `setValue()` call.
I had a look at the existing `BasicMap.java` and it does appear that we already have tests to verify that behaviour (the method `checkUnmodifiableEntry()`). So I think this change has the necessary test coverage.
-------------
Marked as reviewed by jpai (Reviewer).
PR Review: https://git.openjdk.org/jdk/pull/25515#pullrequestreview-2884063760
More information about the core-libs-dev
mailing list