RFR: 8308167: SequencedMap::firstEntry throws NPE when first entry has null key or value

Stuart Marks smarks at openjdk.org
Tue Jun 6 00:23:06 UTC 2023


On Mon, 5 Jun 2023 21:03:18 GMT, Brent Christian <bchristi at openjdk.org> wrote:

>> Create and use new NullableKeyValueHolder class to accommodate map entries whose key or value might be null.
>
> src/java.base/share/classes/jdk/internal/util/NullableKeyValueHolder.java line 65:
> 
>> 63:  * Map.of might still need to reject nulls, and so would Map.ofEntries) but allowing
>> 64:  * a Map.Entry itself to contain nulls seems beneficial in general. If this is done,
>> 65:  * merging KeyValueHolder and NullableKeyValueHolder should be reconsidered.
> 
> I think having this background and explanation in the docs for this internal class is fine.
> IMO, this information would also be useful to have in the bug report.

I'll add a note to the bug report pointing to this rationale.

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

PR Review Comment: https://git.openjdk.org/jdk/pull/14278#discussion_r1218735097


More information about the core-libs-dev mailing list