diff --git a/src/java.base/share/classes/java/util/Map.java b/src/java.base/share/classes/java/util/Map.java index 225046c738a3d..a4accc42e817e 100644 --- a/src/java.base/share/classes/java/util/Map.java +++ b/src/java.base/share/classes/java/util/Map.java @@ -1174,8 +1174,8 @@ default boolean replace(K key, V oldValue, V newValue) { * (optional) * @since 1.8 */ - default @PolyNull V computeIfPresent(K key, - BiFunction remappingFunction) { + default @Nullable V computeIfPresent(K key, + BiFunction remappingFunction) { Objects.requireNonNull(remappingFunction); V oldValue; if ((oldValue = get(key)) != null) { @@ -1260,8 +1260,8 @@ default boolean replace(K key, V oldValue, V newValue) { * (optional) * @since 1.8 */ - default @PolyNull V compute(K key, - BiFunction remappingFunction) { + default @Nullable V compute(K key, + BiFunction remappingFunction) { Objects.requireNonNull(remappingFunction); V oldValue = get(key); @@ -1358,12 +1358,8 @@ default boolean replace(K key, V oldValue, V newValue) { * null * @since 1.8 */ - @CFComment({ - "It would be more flexible to make the return type of remappingFunction be `@Nullable V`. A", - "remappingFunction that returns null is is probably rare, and these annotations accommodate", - "the majority of uses that don't return null."}) - default @PolyNull V merge(K key, @NonNull V value, - BiFunction remappingFunction) { + default @Nullable V merge(K key, @NonNull V value, + BiFunction remappingFunction) { Objects.requireNonNull(remappingFunction); Objects.requireNonNull(value); V oldValue = get(key);