mirror of
https://github.com/openjdk/jdk.git
synced 2025-08-27 14:54:52 +02:00
8292955: Collections.checkedMap Map.merge does not properly check key and value
Reviewed-by: gli, liach, pminborg
This commit is contained in:
parent
86eb5d9f3b
commit
b5e1615c00
2 changed files with 12 additions and 3 deletions
|
@ -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);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue