RFR: 8292955: Collections.checkedMap Map.merge does not properly check key and value
Guoxiong Li
gli at openjdk.org
Thu Mar 7 03:47:55 UTC 2024
On Wed, 6 Mar 2024 18:26:16 GMT, Korov <duke at openjdk.org> wrote:
> When the specified key did not associated with a value, should check the `key` and `value` type.
Good caught. A trivial suggestion.
test/jdk/java/util/Collections/CheckedMapBash.java line 192:
> 190: Map m = Collections.checkedMap(new HashMap<>(), Integer.class, Integer.class);
> 191: m.merge("key", "value", (v1, v2) -> null);
> 192: m.merge("key", 3, (v1, v2) -> v2);
May be better to seperate these two cases into two tests. Because if the first case fails, the latter can't be verified now.
-------------
Changes requested by gli (Committer).
PR Review: https://git.openjdk.org/jdk/pull/18141#pullrequestreview-1921381700
PR Review Comment: https://git.openjdk.org/jdk/pull/18141#discussion_r1515457837
More information about the core-libs-dev
mailing list