RFR: 8358015: Fix SequencedMap sequenced view method specifications
Stuart Marks
smarks at openjdk.org
Fri May 30 22:42:55 UTC 2025
On Fri, 30 May 2025 02:33:27 GMT, Chen Liang <liach 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.
>
> src/java.base/share/classes/java/util/AbstractMap.java line 881:
>
>> 879: UnsupportedOperationException uoe() { return new UnsupportedOperationException(); }
>> 880: // convert null entry return values into NSEE
>> 881: <T> T nsee(T entry) {
>
> Suggestion:
>
> <T extends Map.Entry<?, ?>> T nsee(T entry) {
>
> So we don't accidentally use this on map keys or values.
Reasonable.
-------------
PR Review Comment: https://git.openjdk.org/jdk/pull/25515#discussion_r2116830360
More information about the core-libs-dev
mailing list