8292955: Collections.checkedMap Map.merge does not properly check key and value

Reviewed-by: gli, liach, pminborg
This commit is contained in:
Korov 2024-05-28 06:43:07 +00:00 committed by Per Minborg
parent 86eb5d9f3b
commit b5e1615c00
2 changed files with 12 additions and 3 deletions

View file

@ -1,5 +1,5 @@
/*
* Copyright (c) 1997, 2023, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 1997, 2024, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@ -4050,6 +4050,7 @@ public class Collections {
public V merge(K key, V value,
BiFunction<? super V, ? super V, ? extends V> remappingFunction) {
Objects.requireNonNull(remappingFunction);
typeCheck(key, value);
return m.merge(key, value, (v1, v2) -> {
V newValue = remappingFunction.apply(v1, v2);
typeCheck(null, newValue);