aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorcpovirk <cpovirk@google.com>2023-07-07 07:11:04 -0700
committerGoogle Java Core Libraries <java-core-libraries-team+copybara@google.com>2023-07-07 07:13:19 -0700
commit74859ebe9b2ea79d32b1f3da04dbc494a51f9432 (patch)
treeec92b72f3a2a9b17ed455ff047d88ea139736a16
parentfa695a12ad865ab466dd61d0910dc989a2c3f22b (diff)
downloadguava-74859ebe9b2ea79d32b1f3da04dbc494a51f9432.tar.gz
Roll back J2KT `Map.merge` nullness annotations to the more flexible (if possibly less convenient) original version, updating Guava.
This is another annotation from the [On Leveraging Tests to Infer Nullable Annotations](https://github.com/google/guava/issues/6510) data. RELNOTES=n/a PiperOrigin-RevId: 546272042
-rw-r--r--guava/src/com/google/common/cache/LocalCache.java4
-rw-r--r--guava/src/com/google/common/collect/ImmutableMap.java3
-rw-r--r--guava/src/com/google/common/collect/Maps.java6
-rw-r--r--guava/src/com/google/common/collect/Synchronized.java3
4 files changed, 11 insertions, 5 deletions
diff --git a/guava/src/com/google/common/cache/LocalCache.java b/guava/src/com/google/common/cache/LocalCache.java
index 8206c8c8a..00fb43575 100644
--- a/guava/src/com/google/common/cache/LocalCache.java
+++ b/guava/src/com/google/common/cache/LocalCache.java
@@ -4277,7 +4277,9 @@ class LocalCache<K, V> extends AbstractMap<K, V> implements ConcurrentMap<K, V>
}
@Override
- public V merge(K key, V newValue, BiFunction<? super V, ? super V, ? extends V> function) {
+ @CheckForNull
+ public V merge(
+ K key, V newValue, BiFunction<? super V, ? super V, ? extends @Nullable V> function) {
checkNotNull(key);
checkNotNull(newValue);
checkNotNull(function);
diff --git a/guava/src/com/google/common/collect/ImmutableMap.java b/guava/src/com/google/common/collect/ImmutableMap.java
index d1b890a9d..c370e5248 100644
--- a/guava/src/com/google/common/collect/ImmutableMap.java
+++ b/guava/src/com/google/common/collect/ImmutableMap.java
@@ -873,8 +873,9 @@ public abstract class ImmutableMap<K, V> implements Map<K, V>, Serializable {
@Deprecated
@Override
@DoNotCall("Always throws UnsupportedOperationException")
+ @CheckForNull
public final V merge(
- K key, V value, BiFunction<? super V, ? super V, ? extends V> remappingFunction) {
+ K key, V value, BiFunction<? super V, ? super V, ? extends @Nullable V> function) {
throw new UnsupportedOperationException();
}
diff --git a/guava/src/com/google/common/collect/Maps.java b/guava/src/com/google/common/collect/Maps.java
index 3c1e9c03f..173447caf 100644
--- a/guava/src/com/google/common/collect/Maps.java
+++ b/guava/src/com/google/common/collect/Maps.java
@@ -1750,8 +1750,9 @@ public final class Maps {
}
@Override
+ @CheckForNull
public V merge(
- K key, V value, BiFunction<? super V, ? super V, ? extends V> remappingFunction) {
+ K key, V value, BiFunction<? super V, ? super V, ? extends @Nullable V> function) {
throw new UnsupportedOperationException();
}
@@ -3656,8 +3657,9 @@ public final class Maps {
}
@Override
+ @CheckForNull
public V merge(
- K key, V value, BiFunction<? super V, ? super V, ? extends V> remappingFunction) {
+ K key, V value, BiFunction<? super V, ? super V, ? extends @Nullable V> function) {
throw new UnsupportedOperationException();
}
diff --git a/guava/src/com/google/common/collect/Synchronized.java b/guava/src/com/google/common/collect/Synchronized.java
index 1274b04cd..b1422e316 100644
--- a/guava/src/com/google/common/collect/Synchronized.java
+++ b/guava/src/com/google/common/collect/Synchronized.java
@@ -1205,8 +1205,9 @@ final class Synchronized {
}
@Override
+ @CheckForNull
public V merge(
- K key, V value, BiFunction<? super V, ? super V, ? extends V> remappingFunction) {
+ K key, V value, BiFunction<? super V, ? super V, ? extends @Nullable V> remappingFunction) {
synchronized (mutex) {
return delegate().merge(key, value, remappingFunction);
}