mirror of
https://github.com/jlengrand/error-prone-support.git
synced 2026-03-10 08:11:25 +00:00
17511 lines
699 KiB
Diff
17511 lines
699 KiB
Diff
diff --git a/guava-testlib/src/com/google/common/collect/testing/AbstractCollectionTestSuiteBuilder.java b/guava-testlib/src/com/google/common/collect/testing/AbstractCollectionTestSuiteBuilder.java
|
|
index 02efe30663..081ddc220a 100644
|
|
--- a/guava-testlib/src/com/google/common/collect/testing/AbstractCollectionTestSuiteBuilder.java
|
|
+++ b/guava-testlib/src/com/google/common/collect/testing/AbstractCollectionTestSuiteBuilder.java
|
|
@@ -51,8 +51,8 @@ public abstract class AbstractCollectionTestSuiteBuilder<
|
|
B extends AbstractCollectionTestSuiteBuilder<B, E>, E>
|
|
extends PerCollectionSizeTestSuiteBuilder<B, TestCollectionGenerator<E>, Collection<E>, E> {
|
|
// Class parameters must be raw.
|
|
- @SuppressWarnings("unchecked")
|
|
@Override
|
|
+ @SuppressWarnings("unchecked")
|
|
protected List<Class<? extends AbstractTester>> getTesters() {
|
|
return Arrays.<Class<? extends AbstractTester>>asList(
|
|
CollectionAddAllTester.class,
|
|
diff --git a/guava-testlib/src/com/google/common/collect/testing/AbstractContainerTester.java b/guava-testlib/src/com/google/common/collect/testing/AbstractContainerTester.java
|
|
index b86ef1750d..6e228b3886 100644
|
|
--- a/guava-testlib/src/com/google/common/collect/testing/AbstractContainerTester.java
|
|
+++ b/guava-testlib/src/com/google/common/collect/testing/AbstractContainerTester.java
|
|
@@ -16,12 +16,13 @@
|
|
|
|
package com.google.common.collect.testing;
|
|
|
|
+import static java.util.Collections.unmodifiableList;
|
|
+
|
|
import com.google.common.annotations.GwtCompatible;
|
|
import com.google.errorprone.annotations.OverridingMethodsMustInvokeSuper;
|
|
import java.util.ArrayList;
|
|
import java.util.Arrays;
|
|
import java.util.Collection;
|
|
-import java.util.Collections;
|
|
import java.util.List;
|
|
import org.junit.Ignore;
|
|
|
|
@@ -215,7 +216,7 @@ public abstract class AbstractContainerTester<C, E>
|
|
for (E e : getSubjectGenerator().order(new ArrayList<E>(getSampleElements()))) {
|
|
list.add(e);
|
|
}
|
|
- return Collections.unmodifiableList(list);
|
|
+ return unmodifiableList(list);
|
|
}
|
|
|
|
/**
|
|
diff --git a/guava-testlib/src/com/google/common/collect/testing/AbstractIteratorTester.java b/guava-testlib/src/com/google/common/collect/testing/AbstractIteratorTester.java
|
|
index f1b8f86d1b..70f30f0c88 100644
|
|
--- a/guava-testlib/src/com/google/common/collect/testing/AbstractIteratorTester.java
|
|
+++ b/guava-testlib/src/com/google/common/collect/testing/AbstractIteratorTester.java
|
|
@@ -16,6 +16,7 @@
|
|
|
|
package com.google.common.collect.testing;
|
|
|
|
+import static java.util.Collections.frequency;
|
|
import static junit.framework.Assert.assertEquals;
|
|
import static junit.framework.Assert.fail;
|
|
|
|
@@ -23,7 +24,6 @@ import com.google.common.annotations.GwtCompatible;
|
|
import java.util.ArrayList;
|
|
import java.util.Arrays;
|
|
import java.util.Collection;
|
|
-import java.util.Collections;
|
|
import java.util.Iterator;
|
|
import java.util.List;
|
|
import java.util.ListIterator;
|
|
@@ -352,7 +352,7 @@ abstract class AbstractIteratorTester<E, I extends Iterator<E>> {
|
|
}
|
|
|
|
private void compareResultsForThisListOfStimuli() {
|
|
- int removes = Collections.frequency(Arrays.asList(stimuli), remove);
|
|
+ int removes = frequency(Arrays.asList(stimuli), remove);
|
|
if ((!features.contains(IteratorFeature.SUPPORTS_REMOVE) && removes > 1)
|
|
|| (stimuli.length >= 5 && removes > 2)) {
|
|
// removes are the most expensive thing to test, since they often throw exceptions with stack
|
|
diff --git a/guava-testlib/src/com/google/common/collect/testing/AbstractMapTester.java b/guava-testlib/src/com/google/common/collect/testing/AbstractMapTester.java
|
|
index 590c23be8c..51caab51b7 100644
|
|
--- a/guava-testlib/src/com/google/common/collect/testing/AbstractMapTester.java
|
|
+++ b/guava-testlib/src/com/google/common/collect/testing/AbstractMapTester.java
|
|
@@ -145,8 +145,8 @@ public abstract class AbstractMapTester<K, V>
|
|
}
|
|
}
|
|
|
|
- @SuppressWarnings("unchecked")
|
|
@Override
|
|
+ @SuppressWarnings("unchecked")
|
|
protected MinimalCollection<Entry<K, V>> createDisjointCollection() {
|
|
return MinimalCollection.of(e3(), e4());
|
|
}
|
|
diff --git a/guava-testlib/src/com/google/common/collect/testing/DerivedCollectionGenerators.java b/guava-testlib/src/com/google/common/collect/testing/DerivedCollectionGenerators.java
|
|
index a04d3ffe30..31e4ec7737 100644
|
|
--- a/guava-testlib/src/com/google/common/collect/testing/DerivedCollectionGenerators.java
|
|
+++ b/guava-testlib/src/com/google/common/collect/testing/DerivedCollectionGenerators.java
|
|
@@ -239,8 +239,7 @@ public final class DerivedCollectionGenerators {
|
|
@Override
|
|
public V[] createArray(int length) {
|
|
// noinspection UnnecessaryLocalVariable
|
|
- V[] vs = ((TestMapGenerator<K, V>) mapGenerator.getInnerGenerator()).createValueArray(length);
|
|
- return vs;
|
|
+ return ((TestMapGenerator<K, V>) mapGenerator.getInnerGenerator()).createValueArray(length);
|
|
}
|
|
|
|
@Override
|
|
diff --git a/guava-testlib/src/com/google/common/collect/testing/FeatureSpecificTestSuiteBuilder.java b/guava-testlib/src/com/google/common/collect/testing/FeatureSpecificTestSuiteBuilder.java
|
|
index db086aa307..5bc978a327 100644
|
|
--- a/guava-testlib/src/com/google/common/collect/testing/FeatureSpecificTestSuiteBuilder.java
|
|
+++ b/guava-testlib/src/com/google/common/collect/testing/FeatureSpecificTestSuiteBuilder.java
|
|
@@ -17,6 +17,7 @@
|
|
package com.google.common.collect.testing;
|
|
|
|
import static java.util.Collections.disjoint;
|
|
+import static java.util.Collections.unmodifiableSet;
|
|
import static java.util.logging.Level.FINER;
|
|
|
|
import com.google.common.annotations.GwtIncompatible;
|
|
@@ -28,7 +29,6 @@ import java.lang.reflect.Method;
|
|
import java.util.ArrayList;
|
|
import java.util.Arrays;
|
|
import java.util.Collection;
|
|
-import java.util.Collections;
|
|
import java.util.Enumeration;
|
|
import java.util.HashSet;
|
|
import java.util.LinkedHashSet;
|
|
@@ -114,7 +114,7 @@ public abstract class FeatureSpecificTestSuiteBuilder<
|
|
}
|
|
|
|
public Set<Feature<?>> getFeatures() {
|
|
- return Collections.unmodifiableSet(features);
|
|
+ return unmodifiableSet(features);
|
|
}
|
|
|
|
// Name
|
|
diff --git a/guava-testlib/src/com/google/common/collect/testing/Helpers.java b/guava-testlib/src/com/google/common/collect/testing/Helpers.java
|
|
index aac71cc4ef..a739f6e930 100644
|
|
--- a/guava-testlib/src/com/google/common/collect/testing/Helpers.java
|
|
+++ b/guava-testlib/src/com/google/common/collect/testing/Helpers.java
|
|
@@ -16,6 +16,7 @@
|
|
|
|
package com.google.common.collect.testing;
|
|
|
|
+import static java.util.Collections.singletonMap;
|
|
import static java.util.Collections.sort;
|
|
import static junit.framework.Assert.assertEquals;
|
|
import static junit.framework.Assert.assertFalse;
|
|
@@ -71,7 +72,7 @@ public class Helpers {
|
|
|
|
// Would use Maps.immutableEntry
|
|
public static <K, V> Entry<K, V> mapEntry(K key, V value) {
|
|
- return Collections.singletonMap(key, value).entrySet().iterator().next();
|
|
+ return singletonMap(key, value).entrySet().iterator().next();
|
|
}
|
|
|
|
private static boolean isEmpty(Iterable<?> iterable) {
|
|
@@ -380,8 +381,8 @@ public class Helpers {
|
|
throw new UnsupportedOperationException();
|
|
}
|
|
|
|
- @SuppressWarnings("unchecked")
|
|
@Override
|
|
+ @SuppressWarnings("unchecked")
|
|
public boolean equals(Object o) {
|
|
if (o instanceof Entry) {
|
|
Entry<K, V> e = (Entry<K, V>) o;
|
|
@@ -419,8 +420,8 @@ public class Helpers {
|
|
|
|
private static final Comparator<Comparable> NATURAL_ORDER =
|
|
new Comparator<Comparable>() {
|
|
- @SuppressWarnings("unchecked") // assume any Comparable is Comparable<Self>
|
|
- @Override
|
|
+ @Override // assume any Comparable is Comparable<Self>
|
|
+ @SuppressWarnings("unchecked")
|
|
public int compare(Comparable left, Comparable right) {
|
|
return left.compareTo(right);
|
|
}
|
|
diff --git a/guava-testlib/src/com/google/common/collect/testing/IteratorFeature.java b/guava-testlib/src/com/google/common/collect/testing/IteratorFeature.java
|
|
index c447e2922e..1a5dfb5a83 100644
|
|
--- a/guava-testlib/src/com/google/common/collect/testing/IteratorFeature.java
|
|
+++ b/guava-testlib/src/com/google/common/collect/testing/IteratorFeature.java
|
|
@@ -16,8 +16,10 @@
|
|
|
|
package com.google.common.collect.testing;
|
|
|
|
+import static java.util.Collections.emptySet;
|
|
+import static java.util.Collections.unmodifiableSet;
|
|
+
|
|
import com.google.common.annotations.GwtCompatible;
|
|
-import java.util.Collections;
|
|
import java.util.EnumSet;
|
|
import java.util.Iterator;
|
|
import java.util.ListIterator;
|
|
@@ -49,12 +51,12 @@ public enum IteratorFeature {
|
|
* A set containing none of the optional features of the {@link Iterator} or {@link ListIterator}
|
|
* interfaces.
|
|
*/
|
|
- public static final Set<IteratorFeature> UNMODIFIABLE = Collections.emptySet();
|
|
+ public static final Set<IteratorFeature> UNMODIFIABLE = emptySet();
|
|
|
|
/**
|
|
* A set containing all of the optional features of the {@link Iterator} and {@link ListIterator}
|
|
* interfaces.
|
|
*/
|
|
public static final Set<IteratorFeature> MODIFIABLE =
|
|
- Collections.unmodifiableSet(EnumSet.allOf(IteratorFeature.class));
|
|
+ unmodifiableSet(EnumSet.allOf(IteratorFeature.class));
|
|
}
|
|
diff --git a/guava-testlib/src/com/google/common/collect/testing/MapInterfaceTest.java b/guava-testlib/src/com/google/common/collect/testing/MapInterfaceTest.java
|
|
index 4849138785..890ad9eb59 100644
|
|
--- a/guava-testlib/src/com/google/common/collect/testing/MapInterfaceTest.java
|
|
+++ b/guava-testlib/src/com/google/common/collect/testing/MapInterfaceTest.java
|
|
@@ -16,12 +16,14 @@
|
|
|
|
package com.google.common.collect.testing;
|
|
|
|
+import static java.util.Collections.emptyMap;
|
|
+import static java.util.Collections.emptySet;
|
|
import static java.util.Collections.singleton;
|
|
+import static java.util.Collections.singletonMap;
|
|
|
|
import com.google.common.annotations.GwtCompatible;
|
|
import java.util.Arrays;
|
|
import java.util.Collection;
|
|
-import java.util.Collections;
|
|
import java.util.HashSet;
|
|
import java.util.Iterator;
|
|
import java.util.Map;
|
|
@@ -183,7 +185,7 @@ public abstract class MapInterfaceTest<K, V> extends TestCase {
|
|
assertTrue(map.containsKey(key));
|
|
assertTrue(map.containsValue(value));
|
|
assertTrue(valueCollection.contains(value));
|
|
- assertTrue(valueCollection.containsAll(Collections.singleton(value)));
|
|
+ assertTrue(valueCollection.containsAll(singleton(value)));
|
|
assertTrue(entrySet.contains(mapEntry(key, value)));
|
|
assertTrue(allowsNullKeys || (key != null));
|
|
}
|
|
@@ -847,7 +849,7 @@ public abstract class MapInterfaceTest<K, V> extends TestCase {
|
|
// Explicitly call `equals`; `assertEquals` might return fast
|
|
assertTrue(map.equals(map));
|
|
assertTrue(makePopulatedMap().equals(map));
|
|
- assertFalse(map.equals(Collections.emptyMap()));
|
|
+ assertFalse(map.equals(emptyMap()));
|
|
// no-inspection ObjectEqualsNull
|
|
assertFalse(map.equals(null));
|
|
}
|
|
@@ -899,8 +901,8 @@ public abstract class MapInterfaceTest<K, V> extends TestCase {
|
|
// Explicitly call `equals`; `assertEquals` might return fast
|
|
assertTrue(map.equals(map));
|
|
assertTrue(makeEmptyMap().equals(map));
|
|
- assertEquals(Collections.emptyMap(), map);
|
|
- assertFalse(map.equals(Collections.emptySet()));
|
|
+ assertEquals(emptyMap(), map);
|
|
+ assertFalse(map.equals(emptySet()));
|
|
// noinspection ObjectEqualsNull
|
|
assertFalse(map.equals(null));
|
|
}
|
|
@@ -1130,7 +1132,7 @@ public abstract class MapInterfaceTest<K, V> extends TestCase {
|
|
} catch (UnsupportedOperationException e) {
|
|
return;
|
|
}
|
|
- Map<K, V> mapToPut = Collections.singletonMap(keyToPut, valueToPut);
|
|
+ Map<K, V> mapToPut = singletonMap(keyToPut, valueToPut);
|
|
if (supportsPut) {
|
|
int initialSize = map.size();
|
|
map.putAll(mapToPut);
|
|
@@ -1159,7 +1161,7 @@ public abstract class MapInterfaceTest<K, V> extends TestCase {
|
|
return;
|
|
}
|
|
keyToPut = map.keySet().iterator().next();
|
|
- Map<K, V> mapToPut = Collections.singletonMap(keyToPut, valueToPut);
|
|
+ Map<K, V> mapToPut = singletonMap(keyToPut, valueToPut);
|
|
int initialSize = map.size();
|
|
if (supportsPut) {
|
|
map.putAll(mapToPut);
|
|
@@ -1267,12 +1269,12 @@ public abstract class MapInterfaceTest<K, V> extends TestCase {
|
|
K key = keys.iterator().next();
|
|
if (supportsRemove) {
|
|
int initialSize = map.size();
|
|
- assertTrue(keys.removeAll(Collections.singleton(key)));
|
|
+ assertTrue(keys.removeAll(singleton(key)));
|
|
assertEquals(initialSize - 1, map.size());
|
|
assertFalse(map.containsKey(key));
|
|
} else {
|
|
try {
|
|
- keys.removeAll(Collections.singleton(key));
|
|
+ keys.removeAll(singleton(key));
|
|
fail("Expected UnsupportedOperationException.");
|
|
} catch (UnsupportedOperationException expected) {
|
|
}
|
|
@@ -1291,12 +1293,12 @@ public abstract class MapInterfaceTest<K, V> extends TestCase {
|
|
Set<K> keys = map.keySet();
|
|
K key = keys.iterator().next();
|
|
if (supportsRemove) {
|
|
- keys.retainAll(Collections.singleton(key));
|
|
+ keys.retainAll(singleton(key));
|
|
assertEquals(1, map.size());
|
|
assertTrue(map.containsKey(key));
|
|
} else {
|
|
try {
|
|
- keys.retainAll(Collections.singleton(key));
|
|
+ keys.retainAll(singleton(key));
|
|
fail("Expected UnsupportedOperationException.");
|
|
} catch (UnsupportedOperationException expected) {
|
|
}
|
|
@@ -1617,6 +1619,6 @@ public abstract class MapInterfaceTest<K, V> extends TestCase {
|
|
}
|
|
|
|
static <K, V> Entry<K, V> mapEntry(K key, V value) {
|
|
- return Collections.singletonMap(key, value).entrySet().iterator().next();
|
|
+ return singletonMap(key, value).entrySet().iterator().next();
|
|
}
|
|
}
|
|
diff --git a/guava-testlib/src/com/google/common/collect/testing/MapTestSuiteBuilder.java b/guava-testlib/src/com/google/common/collect/testing/MapTestSuiteBuilder.java
|
|
index d1ce3413dd..e628c81287 100644
|
|
--- a/guava-testlib/src/com/google/common/collect/testing/MapTestSuiteBuilder.java
|
|
+++ b/guava-testlib/src/com/google/common/collect/testing/MapTestSuiteBuilder.java
|
|
@@ -73,8 +73,8 @@ public class MapTestSuiteBuilder<K, V>
|
|
return new MapTestSuiteBuilder<K, V>().usingGenerator(generator);
|
|
}
|
|
|
|
- @SuppressWarnings("unchecked") // Class parameters must be raw.
|
|
- @Override
|
|
+ @Override // Class parameters must be raw.
|
|
+ @SuppressWarnings("unchecked")
|
|
protected List<Class<? extends AbstractTester>> getTesters() {
|
|
return Arrays.<Class<? extends AbstractTester>>asList(
|
|
MapClearTester.class,
|
|
diff --git a/guava-testlib/src/com/google/common/collect/testing/NavigableSetTestSuiteBuilder.java b/guava-testlib/src/com/google/common/collect/testing/NavigableSetTestSuiteBuilder.java
|
|
index 4c86ab4620..7f30d422fa 100644
|
|
--- a/guava-testlib/src/com/google/common/collect/testing/NavigableSetTestSuiteBuilder.java
|
|
+++ b/guava-testlib/src/com/google/common/collect/testing/NavigableSetTestSuiteBuilder.java
|
|
@@ -18,6 +18,7 @@ package com.google.common.collect.testing;
|
|
|
|
import static com.google.common.collect.testing.features.CollectionFeature.DESCENDING_VIEW;
|
|
import static com.google.common.collect.testing.features.CollectionFeature.SUBSET_VIEW;
|
|
+import static java.util.Collections.reverse;
|
|
|
|
import com.google.common.annotations.GwtIncompatible;
|
|
import com.google.common.collect.testing.DerivedCollectionGenerators.Bound;
|
|
@@ -26,7 +27,6 @@ import com.google.common.collect.testing.features.Feature;
|
|
import com.google.common.collect.testing.testers.NavigableSetNavigationTester;
|
|
import java.util.ArrayList;
|
|
import java.util.Collection;
|
|
-import java.util.Collections;
|
|
import java.util.List;
|
|
import java.util.NavigableSet;
|
|
import java.util.Set;
|
|
@@ -127,7 +127,7 @@ public final class NavigableSetTestSuiteBuilder<E> extends SortedSetTestSuiteBui
|
|
for (E e : delegate.order(insertionOrder)) {
|
|
list.add(e);
|
|
}
|
|
- Collections.reverse(list);
|
|
+ reverse(list);
|
|
return list;
|
|
}
|
|
|
|
diff --git a/guava-testlib/src/com/google/common/collect/testing/SafeTreeMap.java b/guava-testlib/src/com/google/common/collect/testing/SafeTreeMap.java
|
|
index 5856e3b543..4d8ecac0e1 100644
|
|
--- a/guava-testlib/src/com/google/common/collect/testing/SafeTreeMap.java
|
|
+++ b/guava-testlib/src/com/google/common/collect/testing/SafeTreeMap.java
|
|
@@ -89,8 +89,8 @@ public final class SafeTreeMap<K, V> implements Serializable, NavigableMap<K, V>
|
|
delegate.clear();
|
|
}
|
|
|
|
- @SuppressWarnings("unchecked")
|
|
@Override
|
|
+ @SuppressWarnings("unchecked")
|
|
public Comparator<? super K> comparator() {
|
|
Comparator<? super K> comparator = delegate.comparator();
|
|
if (comparator == null) {
|
|
diff --git a/guava-testlib/src/com/google/common/collect/testing/SafeTreeSet.java b/guava-testlib/src/com/google/common/collect/testing/SafeTreeSet.java
|
|
index 91d9fd9f75..d5e21a01cd 100644
|
|
--- a/guava-testlib/src/com/google/common/collect/testing/SafeTreeSet.java
|
|
+++ b/guava-testlib/src/com/google/common/collect/testing/SafeTreeSet.java
|
|
@@ -90,8 +90,8 @@ public final class SafeTreeSet<E> implements Serializable, NavigableSet<E> {
|
|
delegate.clear();
|
|
}
|
|
|
|
- @SuppressWarnings("unchecked")
|
|
@Override
|
|
+ @SuppressWarnings("unchecked")
|
|
public Comparator<? super E> comparator() {
|
|
Comparator<? super E> comparator = delegate.comparator();
|
|
if (comparator == null) {
|
|
diff --git a/guava-testlib/src/com/google/common/collect/testing/SortedMapTestSuiteBuilder.java b/guava-testlib/src/com/google/common/collect/testing/SortedMapTestSuiteBuilder.java
|
|
index 7944aaa6a0..d43238afa5 100644
|
|
--- a/guava-testlib/src/com/google/common/collect/testing/SortedMapTestSuiteBuilder.java
|
|
+++ b/guava-testlib/src/com/google/common/collect/testing/SortedMapTestSuiteBuilder.java
|
|
@@ -17,6 +17,7 @@
|
|
package com.google.common.collect.testing;
|
|
|
|
import static com.google.common.collect.testing.features.CollectionFeature.KNOWN_ORDER;
|
|
+import static java.util.Collections.emptySet;
|
|
|
|
import com.google.common.annotations.GwtIncompatible;
|
|
import com.google.common.collect.testing.DerivedCollectionGenerators.Bound;
|
|
@@ -24,7 +25,6 @@ import com.google.common.collect.testing.DerivedCollectionGenerators.SortedMapSu
|
|
import com.google.common.collect.testing.features.Feature;
|
|
import com.google.common.collect.testing.testers.SortedMapNavigationTester;
|
|
import java.util.ArrayList;
|
|
-import java.util.Collections;
|
|
import java.util.List;
|
|
import java.util.Map;
|
|
import java.util.Map.Entry;
|
|
@@ -94,7 +94,7 @@ public class SortedMapTestSuiteBuilder<K, V> extends MapTestSuiteBuilder<K, V> {
|
|
|
|
@Override
|
|
public Set<Feature<? super Void>> getImpliedFeatures() {
|
|
- return Collections.emptySet();
|
|
+ return emptySet();
|
|
}
|
|
}
|
|
|
|
diff --git a/guava-testlib/src/com/google/common/collect/testing/TestsForListsInJavaUtil.java b/guava-testlib/src/com/google/common/collect/testing/TestsForListsInJavaUtil.java
|
|
index e8eae2c252..d109b0c178 100644
|
|
--- a/guava-testlib/src/com/google/common/collect/testing/TestsForListsInJavaUtil.java
|
|
+++ b/guava-testlib/src/com/google/common/collect/testing/TestsForListsInJavaUtil.java
|
|
@@ -23,6 +23,11 @@ import static com.google.common.collect.testing.testers.ListSubListTester.getSub
|
|
import static com.google.common.collect.testing.testers.ListSubListTester.getSubListOriginalListSetAffectsSubListMethod;
|
|
import static com.google.common.collect.testing.testers.ListSubListTester.getSubListSubListRemoveAffectsOriginalLargeListMethod;
|
|
import static java.util.Arrays.asList;
|
|
+import static java.util.Collections.checkedList;
|
|
+import static java.util.Collections.emptyList;
|
|
+import static java.util.Collections.emptySet;
|
|
+import static java.util.Collections.singletonList;
|
|
+import static java.util.Collections.unmodifiableList;
|
|
|
|
import com.google.common.annotations.GwtIncompatible;
|
|
import com.google.common.collect.testing.features.CollectionFeature;
|
|
@@ -72,23 +77,23 @@ public class TestsForListsInJavaUtil {
|
|
}
|
|
|
|
protected Collection<Method> suppressForEmptyList() {
|
|
- return Collections.emptySet();
|
|
+ return emptySet();
|
|
}
|
|
|
|
protected Collection<Method> suppressForSingletonList() {
|
|
- return Collections.emptySet();
|
|
+ return emptySet();
|
|
}
|
|
|
|
protected Collection<Method> suppressForArraysAsList() {
|
|
- return Collections.emptySet();
|
|
+ return emptySet();
|
|
}
|
|
|
|
protected Collection<Method> suppressForArrayList() {
|
|
- return Collections.emptySet();
|
|
+ return emptySet();
|
|
}
|
|
|
|
protected Collection<Method> suppressForLinkedList() {
|
|
- return Collections.emptySet();
|
|
+ return emptySet();
|
|
}
|
|
|
|
protected Collection<Method> suppressForCopyOnWriteArrayList() {
|
|
@@ -102,23 +107,23 @@ public class TestsForListsInJavaUtil {
|
|
}
|
|
|
|
protected Collection<Method> suppressForUnmodifiableList() {
|
|
- return Collections.emptySet();
|
|
+ return emptySet();
|
|
}
|
|
|
|
protected Collection<Method> suppressForCheckedList() {
|
|
- return Collections.emptySet();
|
|
+ return emptySet();
|
|
}
|
|
|
|
protected Collection<Method> suppressForAbstractList() {
|
|
- return Collections.emptySet();
|
|
+ return emptySet();
|
|
}
|
|
|
|
protected Collection<Method> suppressForAbstractSequentialList() {
|
|
- return Collections.emptySet();
|
|
+ return emptySet();
|
|
}
|
|
|
|
protected Collection<Method> suppressForVector() {
|
|
- return Collections.emptySet();
|
|
+ return emptySet();
|
|
}
|
|
|
|
public Test testsForEmptyList() {
|
|
@@ -126,7 +131,7 @@ public class TestsForListsInJavaUtil {
|
|
new TestStringListGenerator() {
|
|
@Override
|
|
public List<String> create(String[] elements) {
|
|
- return Collections.emptyList();
|
|
+ return emptyList();
|
|
}
|
|
})
|
|
.named("emptyList")
|
|
@@ -140,7 +145,7 @@ public class TestsForListsInJavaUtil {
|
|
new TestStringListGenerator() {
|
|
@Override
|
|
public List<String> create(String[] elements) {
|
|
- return Collections.singletonList(elements[0]);
|
|
+ return singletonList(elements[0]);
|
|
}
|
|
})
|
|
.named("singletonList")
|
|
@@ -237,7 +242,7 @@ public class TestsForListsInJavaUtil {
|
|
public List<String> create(String[] elements) {
|
|
List<String> innerList = new ArrayList<>();
|
|
Collections.addAll(innerList, elements);
|
|
- return Collections.unmodifiableList(innerList);
|
|
+ return unmodifiableList(innerList);
|
|
}
|
|
})
|
|
.named("unmodifiableList/ArrayList")
|
|
@@ -256,7 +261,7 @@ public class TestsForListsInJavaUtil {
|
|
public List<String> create(String[] elements) {
|
|
List<String> innerList = new ArrayList<>();
|
|
Collections.addAll(innerList, elements);
|
|
- return Collections.checkedList(innerList, String.class);
|
|
+ return checkedList(innerList, String.class);
|
|
}
|
|
})
|
|
.named("checkedList/ArrayList")
|
|
diff --git a/guava-testlib/src/com/google/common/collect/testing/TestsForMapsInJavaUtil.java b/guava-testlib/src/com/google/common/collect/testing/TestsForMapsInJavaUtil.java
|
|
index fed059c399..5dfd095eeb 100644
|
|
--- a/guava-testlib/src/com/google/common/collect/testing/TestsForMapsInJavaUtil.java
|
|
+++ b/guava-testlib/src/com/google/common/collect/testing/TestsForMapsInJavaUtil.java
|
|
@@ -17,6 +17,18 @@
|
|
package com.google.common.collect.testing;
|
|
|
|
import static java.util.Arrays.asList;
|
|
+import static java.util.Collections.checkedMap;
|
|
+import static java.util.Collections.checkedNavigableMap;
|
|
+import static java.util.Collections.checkedSortedMap;
|
|
+import static java.util.Collections.emptyMap;
|
|
+import static java.util.Collections.emptyNavigableMap;
|
|
+import static java.util.Collections.emptySet;
|
|
+import static java.util.Collections.emptySortedMap;
|
|
+import static java.util.Collections.singletonMap;
|
|
+import static java.util.Collections.synchronizedNavigableMap;
|
|
+import static java.util.Collections.unmodifiableMap;
|
|
+import static java.util.Collections.unmodifiableNavigableMap;
|
|
+import static java.util.Collections.unmodifiableSortedMap;
|
|
|
|
import com.google.common.annotations.GwtIncompatible;
|
|
import com.google.common.collect.testing.features.CollectionFeature;
|
|
@@ -26,7 +38,6 @@ import com.google.common.collect.testing.testers.MapEntrySetTester;
|
|
import java.io.Serializable;
|
|
import java.lang.reflect.Method;
|
|
import java.util.Collection;
|
|
-import java.util.Collections;
|
|
import java.util.Comparator;
|
|
import java.util.EnumMap;
|
|
import java.util.HashMap;
|
|
@@ -81,75 +92,75 @@ public class TestsForMapsInJavaUtil {
|
|
}
|
|
|
|
protected Collection<Method> suppressForCheckedMap() {
|
|
- return Collections.emptySet();
|
|
+ return emptySet();
|
|
}
|
|
|
|
protected Collection<Method> suppressForCheckedNavigableMap() {
|
|
- return Collections.emptySet();
|
|
+ return emptySet();
|
|
}
|
|
|
|
protected Collection<Method> suppressForCheckedSortedMap() {
|
|
- return Collections.emptySet();
|
|
+ return emptySet();
|
|
}
|
|
|
|
protected Collection<Method> suppressForEmptyMap() {
|
|
- return Collections.emptySet();
|
|
+ return emptySet();
|
|
}
|
|
|
|
private Collection<Method> suppressForEmptyNavigableMap() {
|
|
- return Collections.emptySet();
|
|
+ return emptySet();
|
|
}
|
|
|
|
private Collection<Method> suppressForEmptySortedMap() {
|
|
- return Collections.emptySet();
|
|
+ return emptySet();
|
|
}
|
|
|
|
protected Collection<Method> suppressForSingletonMap() {
|
|
- return Collections.emptySet();
|
|
+ return emptySet();
|
|
}
|
|
|
|
protected Collection<Method> suppressForHashMap() {
|
|
- return Collections.emptySet();
|
|
+ return emptySet();
|
|
}
|
|
|
|
protected Collection<Method> suppressForHashtable() {
|
|
- return Collections.emptySet();
|
|
+ return emptySet();
|
|
}
|
|
|
|
protected Collection<Method> suppressForLinkedHashMap() {
|
|
- return Collections.emptySet();
|
|
+ return emptySet();
|
|
}
|
|
|
|
protected Collection<Method> suppressForSynchronizedNavigableMap() {
|
|
- return Collections.emptySet();
|
|
+ return emptySet();
|
|
}
|
|
|
|
protected Collection<Method> suppressForTreeMapNatural() {
|
|
- return Collections.emptySet();
|
|
+ return emptySet();
|
|
}
|
|
|
|
protected Collection<Method> suppressForTreeMapWithComparator() {
|
|
- return Collections.emptySet();
|
|
+ return emptySet();
|
|
}
|
|
|
|
protected Collection<Method> suppressForUnmodifiableMap() {
|
|
- return Collections.emptySet();
|
|
+ return emptySet();
|
|
}
|
|
|
|
protected Collection<Method> suppressForUnmodifiableNavigableMap() {
|
|
- return Collections.emptySet();
|
|
+ return emptySet();
|
|
}
|
|
|
|
protected Collection<Method> suppressForUnmodifiableSortedMap() {
|
|
- return Collections.emptySet();
|
|
+ return emptySet();
|
|
}
|
|
|
|
protected Collection<Method> suppressForEnumMap() {
|
|
- return Collections.emptySet();
|
|
+ return emptySet();
|
|
}
|
|
|
|
protected Collection<Method> suppressForConcurrentHashMap() {
|
|
- return Collections.emptySet();
|
|
+ return emptySet();
|
|
}
|
|
|
|
protected Collection<Method> suppressForConcurrentSkipListMap() {
|
|
@@ -165,7 +176,7 @@ public class TestsForMapsInJavaUtil {
|
|
@Override
|
|
protected Map<String, String> create(Entry<String, String>[] entries) {
|
|
Map<String, String> map = populate(new HashMap<String, String>(), entries);
|
|
- return Collections.checkedMap(map, String.class, String.class);
|
|
+ return checkedMap(map, String.class, String.class);
|
|
}
|
|
})
|
|
.named("checkedMap/HashMap")
|
|
@@ -190,7 +201,7 @@ public class TestsForMapsInJavaUtil {
|
|
@Override
|
|
protected NavigableMap<String, String> create(Entry<String, String>[] entries) {
|
|
NavigableMap<String, String> map = populate(new TreeMap<String, String>(), entries);
|
|
- return Collections.checkedNavigableMap(map, String.class, String.class);
|
|
+ return checkedNavigableMap(map, String.class, String.class);
|
|
}
|
|
})
|
|
.named("checkedNavigableMap/TreeMap, natural")
|
|
@@ -214,7 +225,7 @@ public class TestsForMapsInJavaUtil {
|
|
@Override
|
|
protected SortedMap<String, String> create(Entry<String, String>[] entries) {
|
|
SortedMap<String, String> map = populate(new TreeMap<String, String>(), entries);
|
|
- return Collections.checkedSortedMap(map, String.class, String.class);
|
|
+ return checkedSortedMap(map, String.class, String.class);
|
|
}
|
|
})
|
|
.named("checkedSortedMap/TreeMap, natural")
|
|
@@ -237,7 +248,7 @@ public class TestsForMapsInJavaUtil {
|
|
new TestStringMapGenerator() {
|
|
@Override
|
|
protected Map<String, String> create(Entry<String, String>[] entries) {
|
|
- return Collections.emptyMap();
|
|
+ return emptyMap();
|
|
}
|
|
})
|
|
.named("emptyMap")
|
|
@@ -251,7 +262,7 @@ public class TestsForMapsInJavaUtil {
|
|
new TestStringSortedMapGenerator() {
|
|
@Override
|
|
protected NavigableMap<String, String> create(Entry<String, String>[] entries) {
|
|
- return Collections.emptyNavigableMap();
|
|
+ return emptyNavigableMap();
|
|
}
|
|
})
|
|
.named("emptyNavigableMap")
|
|
@@ -265,7 +276,7 @@ public class TestsForMapsInJavaUtil {
|
|
new TestStringSortedMapGenerator() {
|
|
@Override
|
|
protected SortedMap<String, String> create(Entry<String, String>[] entries) {
|
|
- return Collections.emptySortedMap();
|
|
+ return emptySortedMap();
|
|
}
|
|
})
|
|
.named("emptySortedMap")
|
|
@@ -279,7 +290,7 @@ public class TestsForMapsInJavaUtil {
|
|
new TestStringMapGenerator() {
|
|
@Override
|
|
protected Map<String, String> create(Entry<String, String>[] entries) {
|
|
- return Collections.singletonMap(entries[0].getKey(), entries[0].getValue());
|
|
+ return singletonMap(entries[0].getKey(), entries[0].getValue());
|
|
}
|
|
})
|
|
.named("singletonMap")
|
|
@@ -371,7 +382,7 @@ public class TestsForMapsInJavaUtil {
|
|
@Override
|
|
protected SortedMap<String, String> create(Entry<String, String>[] entries) {
|
|
NavigableMap<String, String> delegate = populate(new TreeMap<>(), entries);
|
|
- return Collections.synchronizedNavigableMap(delegate);
|
|
+ return synchronizedNavigableMap(delegate);
|
|
}
|
|
})
|
|
.named("synchronizedNavigableMap/TreeMap, natural")
|
|
@@ -441,7 +452,7 @@ public class TestsForMapsInJavaUtil {
|
|
new TestStringMapGenerator() {
|
|
@Override
|
|
protected Map<String, String> create(Entry<String, String>[] entries) {
|
|
- return Collections.unmodifiableMap(toHashMap(entries));
|
|
+ return unmodifiableMap(toHashMap(entries));
|
|
}
|
|
})
|
|
.named("unmodifiableMap/HashMap")
|
|
@@ -460,7 +471,7 @@ public class TestsForMapsInJavaUtil {
|
|
new TestStringSortedMapGenerator() {
|
|
@Override
|
|
protected NavigableMap<String, String> create(Entry<String, String>[] entries) {
|
|
- return Collections.unmodifiableNavigableMap(populate(new TreeMap<>(), entries));
|
|
+ return unmodifiableNavigableMap(populate(new TreeMap<>(), entries));
|
|
}
|
|
})
|
|
.named("unmodifiableNavigableMap/TreeMap, natural")
|
|
@@ -479,7 +490,7 @@ public class TestsForMapsInJavaUtil {
|
|
@Override
|
|
protected SortedMap<String, String> create(Entry<String, String>[] entries) {
|
|
SortedMap<String, String> map = populate(new TreeMap<String, String>(), entries);
|
|
- return Collections.unmodifiableSortedMap(map);
|
|
+ return unmodifiableSortedMap(map);
|
|
}
|
|
})
|
|
.named("unmodifiableSortedMap/TreeMap, natural")
|
|
diff --git a/guava-testlib/src/com/google/common/collect/testing/TestsForQueuesInJavaUtil.java b/guava-testlib/src/com/google/common/collect/testing/TestsForQueuesInJavaUtil.java
|
|
index 1a9870daf6..c15d6603af 100644
|
|
--- a/guava-testlib/src/com/google/common/collect/testing/TestsForQueuesInJavaUtil.java
|
|
+++ b/guava-testlib/src/com/google/common/collect/testing/TestsForQueuesInJavaUtil.java
|
|
@@ -16,13 +16,15 @@
|
|
|
|
package com.google.common.collect.testing;
|
|
|
|
+import static java.util.Collections.checkedQueue;
|
|
+import static java.util.Collections.emptySet;
|
|
+
|
|
import com.google.common.annotations.GwtIncompatible;
|
|
import com.google.common.collect.testing.features.CollectionFeature;
|
|
import com.google.common.collect.testing.features.CollectionSize;
|
|
import java.lang.reflect.Method;
|
|
import java.util.ArrayDeque;
|
|
import java.util.Collection;
|
|
-import java.util.Collections;
|
|
import java.util.LinkedList;
|
|
import java.util.PriorityQueue;
|
|
import java.util.Queue;
|
|
@@ -63,43 +65,43 @@ public class TestsForQueuesInJavaUtil {
|
|
}
|
|
|
|
protected Collection<Method> suppressForCheckedQueue() {
|
|
- return Collections.emptySet();
|
|
+ return emptySet();
|
|
}
|
|
|
|
protected Collection<Method> suppressForArrayDeque() {
|
|
- return Collections.emptySet();
|
|
+ return emptySet();
|
|
}
|
|
|
|
protected Collection<Method> suppressForLinkedList() {
|
|
- return Collections.emptySet();
|
|
+ return emptySet();
|
|
}
|
|
|
|
protected Collection<Method> suppressForArrayBlockingQueue() {
|
|
- return Collections.emptySet();
|
|
+ return emptySet();
|
|
}
|
|
|
|
protected Collection<Method> suppressForConcurrentLinkedDeque() {
|
|
- return Collections.emptySet();
|
|
+ return emptySet();
|
|
}
|
|
|
|
protected Collection<Method> suppressForConcurrentLinkedQueue() {
|
|
- return Collections.emptySet();
|
|
+ return emptySet();
|
|
}
|
|
|
|
protected Collection<Method> suppressForLinkedBlockingDeque() {
|
|
- return Collections.emptySet();
|
|
+ return emptySet();
|
|
}
|
|
|
|
protected Collection<Method> suppressForLinkedBlockingQueue() {
|
|
- return Collections.emptySet();
|
|
+ return emptySet();
|
|
}
|
|
|
|
protected Collection<Method> suppressForPriorityBlockingQueue() {
|
|
- return Collections.emptySet();
|
|
+ return emptySet();
|
|
}
|
|
|
|
protected Collection<Method> suppressForPriorityQueue() {
|
|
- return Collections.emptySet();
|
|
+ return emptySet();
|
|
}
|
|
|
|
public Test testsForCheckedQueue() {
|
|
@@ -108,7 +110,7 @@ public class TestsForQueuesInJavaUtil {
|
|
@Override
|
|
public Queue<String> create(String[] elements) {
|
|
Queue<String> queue = new LinkedList<>(MinimalCollection.of(elements));
|
|
- return Collections.checkedQueue(queue, String.class);
|
|
+ return checkedQueue(queue, String.class);
|
|
}
|
|
})
|
|
.named("checkedQueue/LinkedList")
|
|
diff --git a/guava-testlib/src/com/google/common/collect/testing/TestsForSetsInJavaUtil.java b/guava-testlib/src/com/google/common/collect/testing/TestsForSetsInJavaUtil.java
|
|
index 0141d8daf4..fcf5e98379 100644
|
|
--- a/guava-testlib/src/com/google/common/collect/testing/TestsForSetsInJavaUtil.java
|
|
+++ b/guava-testlib/src/com/google/common/collect/testing/TestsForSetsInJavaUtil.java
|
|
@@ -19,6 +19,16 @@ package com.google.common.collect.testing;
|
|
import static com.google.common.collect.testing.testers.CollectionSpliteratorTester.getSpliteratorNotImmutableCollectionAllowsAddMethod;
|
|
import static com.google.common.collect.testing.testers.CollectionSpliteratorTester.getSpliteratorNotImmutableCollectionAllowsRemoveMethod;
|
|
import static java.util.Arrays.asList;
|
|
+import static java.util.Collections.checkedNavigableSet;
|
|
+import static java.util.Collections.checkedSet;
|
|
+import static java.util.Collections.checkedSortedSet;
|
|
+import static java.util.Collections.emptyNavigableSet;
|
|
+import static java.util.Collections.emptySet;
|
|
+import static java.util.Collections.emptySortedSet;
|
|
+import static java.util.Collections.singleton;
|
|
+import static java.util.Collections.synchronizedNavigableSet;
|
|
+import static java.util.Collections.unmodifiableNavigableSet;
|
|
+import static java.util.Collections.unmodifiableSet;
|
|
|
|
import com.google.common.annotations.GwtIncompatible;
|
|
import com.google.common.collect.testing.features.CollectionFeature;
|
|
@@ -82,47 +92,47 @@ public class TestsForSetsInJavaUtil {
|
|
}
|
|
|
|
protected Collection<Method> suppressForCheckedNavigableSet() {
|
|
- return Collections.emptySet();
|
|
+ return emptySet();
|
|
}
|
|
|
|
protected Collection<Method> suppressForEmptySet() {
|
|
- return Collections.emptySet();
|
|
+ return emptySet();
|
|
}
|
|
|
|
protected Collection<Method> suppressForEmptyNavigableSet() {
|
|
- return Collections.emptySet();
|
|
+ return emptySet();
|
|
}
|
|
|
|
protected Collection<Method> suppressForEmptySortedSet() {
|
|
- return Collections.emptySet();
|
|
+ return emptySet();
|
|
}
|
|
|
|
protected Collection<Method> suppressForSingletonSet() {
|
|
- return Collections.emptySet();
|
|
+ return emptySet();
|
|
}
|
|
|
|
protected Collection<Method> suppressForHashSet() {
|
|
- return Collections.emptySet();
|
|
+ return emptySet();
|
|
}
|
|
|
|
protected Collection<Method> suppressForLinkedHashSet() {
|
|
- return Collections.emptySet();
|
|
+ return emptySet();
|
|
}
|
|
|
|
protected Collection<Method> suppressForEnumSet() {
|
|
- return Collections.emptySet();
|
|
+ return emptySet();
|
|
}
|
|
|
|
protected Collection<Method> suppressForSynchronizedNavigableSet() {
|
|
- return Collections.emptySet();
|
|
+ return emptySet();
|
|
}
|
|
|
|
protected Collection<Method> suppressForTreeSetNatural() {
|
|
- return Collections.emptySet();
|
|
+ return emptySet();
|
|
}
|
|
|
|
protected Collection<Method> suppressForTreeSetWithComparator() {
|
|
- return Collections.emptySet();
|
|
+ return emptySet();
|
|
}
|
|
|
|
protected Collection<Method> suppressForCopyOnWriteArraySet() {
|
|
@@ -132,31 +142,31 @@ public class TestsForSetsInJavaUtil {
|
|
}
|
|
|
|
protected Collection<Method> suppressForUnmodifiableSet() {
|
|
- return Collections.emptySet();
|
|
+ return emptySet();
|
|
}
|
|
|
|
protected Collection<Method> suppressForUnmodifiableNavigableSet() {
|
|
- return Collections.emptySet();
|
|
+ return emptySet();
|
|
}
|
|
|
|
protected Collection<Method> suppressForCheckedSet() {
|
|
- return Collections.emptySet();
|
|
+ return emptySet();
|
|
}
|
|
|
|
protected Collection<Method> suppressForCheckedSortedSet() {
|
|
- return Collections.emptySet();
|
|
+ return emptySet();
|
|
}
|
|
|
|
protected Collection<Method> suppressForAbstractSet() {
|
|
- return Collections.emptySet();
|
|
+ return emptySet();
|
|
}
|
|
|
|
protected Collection<Method> suppressForConcurrentSkipListSetNatural() {
|
|
- return Collections.emptySet();
|
|
+ return emptySet();
|
|
}
|
|
|
|
protected Collection<Method> suppressForConcurrentSkipListSetWithComparator() {
|
|
- return Collections.emptySet();
|
|
+ return emptySet();
|
|
}
|
|
|
|
public Test testsForCheckedNavigableSet() {
|
|
@@ -166,7 +176,7 @@ public class TestsForSetsInJavaUtil {
|
|
public NavigableSet<String> create(String[] elements) {
|
|
NavigableSet<String> innerSet = new TreeSet<>();
|
|
Collections.addAll(innerSet, elements);
|
|
- return Collections.checkedNavigableSet(innerSet, String.class);
|
|
+ return checkedNavigableSet(innerSet, String.class);
|
|
}
|
|
})
|
|
.named("checkedNavigableSet/TreeSet, natural")
|
|
@@ -186,7 +196,7 @@ public class TestsForSetsInJavaUtil {
|
|
new TestStringSetGenerator() {
|
|
@Override
|
|
public Set<String> create(String[] elements) {
|
|
- return Collections.emptySet();
|
|
+ return emptySet();
|
|
}
|
|
})
|
|
.named("emptySet")
|
|
@@ -200,7 +210,7 @@ public class TestsForSetsInJavaUtil {
|
|
new TestStringSortedSetGenerator() {
|
|
@Override
|
|
public NavigableSet<String> create(String[] elements) {
|
|
- return Collections.emptyNavigableSet();
|
|
+ return emptyNavigableSet();
|
|
}
|
|
})
|
|
.named("emptyNavigableSet")
|
|
@@ -214,7 +224,7 @@ public class TestsForSetsInJavaUtil {
|
|
new TestStringSortedSetGenerator() {
|
|
@Override
|
|
public SortedSet<String> create(String[] elements) {
|
|
- return Collections.emptySortedSet();
|
|
+ return emptySortedSet();
|
|
}
|
|
})
|
|
.named("emptySortedSet")
|
|
@@ -228,7 +238,7 @@ public class TestsForSetsInJavaUtil {
|
|
new TestStringSetGenerator() {
|
|
@Override
|
|
public Set<String> create(String[] elements) {
|
|
- return Collections.singleton(elements[0]);
|
|
+ return singleton(elements[0]);
|
|
}
|
|
})
|
|
.named("singleton")
|
|
@@ -310,7 +320,7 @@ public class TestsForSetsInJavaUtil {
|
|
@Override
|
|
public SortedSet<String> create(String[] elements) {
|
|
NavigableSet<String> delegate = new TreeSet<>(MinimalCollection.of(elements));
|
|
- return Collections.synchronizedNavigableSet(delegate);
|
|
+ return synchronizedNavigableSet(delegate);
|
|
}
|
|
})
|
|
.named("synchronizedNavigableSet/TreeSet, natural")
|
|
@@ -392,7 +402,7 @@ public class TestsForSetsInJavaUtil {
|
|
public Set<String> create(String[] elements) {
|
|
Set<String> innerSet = new HashSet<>();
|
|
Collections.addAll(innerSet, elements);
|
|
- return Collections.unmodifiableSet(innerSet);
|
|
+ return unmodifiableSet(innerSet);
|
|
}
|
|
})
|
|
.named("unmodifiableSet/HashSet")
|
|
@@ -412,7 +422,7 @@ public class TestsForSetsInJavaUtil {
|
|
public NavigableSet<String> create(String[] elements) {
|
|
NavigableSet<String> innerSet = new TreeSet<>();
|
|
Collections.addAll(innerSet, elements);
|
|
- return Collections.unmodifiableNavigableSet(innerSet);
|
|
+ return unmodifiableNavigableSet(innerSet);
|
|
}
|
|
})
|
|
.named("unmodifiableNavigableSet/TreeSet, natural")
|
|
@@ -432,7 +442,7 @@ public class TestsForSetsInJavaUtil {
|
|
public Set<String> create(String[] elements) {
|
|
Set<String> innerSet = new HashSet<>();
|
|
Collections.addAll(innerSet, elements);
|
|
- return Collections.checkedSet(innerSet, String.class);
|
|
+ return checkedSet(innerSet, String.class);
|
|
}
|
|
})
|
|
.named("checkedSet/HashSet")
|
|
@@ -453,7 +463,7 @@ public class TestsForSetsInJavaUtil {
|
|
public SortedSet<String> create(String[] elements) {
|
|
SortedSet<String> innerSet = new TreeSet<>();
|
|
Collections.addAll(innerSet, elements);
|
|
- return Collections.checkedSortedSet(innerSet, String.class);
|
|
+ return checkedSortedSet(innerSet, String.class);
|
|
}
|
|
})
|
|
.named("checkedSortedSet/TreeSet, natural")
|
|
diff --git a/guava-testlib/src/com/google/common/collect/testing/features/CollectionSize.java b/guava-testlib/src/com/google/common/collect/testing/features/CollectionSize.java
|
|
index 6203e51486..04fccf9430 100644
|
|
--- a/guava-testlib/src/com/google/common/collect/testing/features/CollectionSize.java
|
|
+++ b/guava-testlib/src/com/google/common/collect/testing/features/CollectionSize.java
|
|
@@ -16,13 +16,14 @@
|
|
|
|
package com.google.common.collect.testing.features;
|
|
|
|
+import static java.util.Collections.emptySet;
|
|
+
|
|
import com.google.common.annotations.GwtCompatible;
|
|
import com.google.common.collect.testing.Helpers;
|
|
import java.lang.annotation.Inherited;
|
|
import java.lang.annotation.Retention;
|
|
import java.lang.annotation.RetentionPolicy;
|
|
import java.util.Collection;
|
|
-import java.util.Collections;
|
|
import java.util.Set;
|
|
|
|
/**
|
|
@@ -62,7 +63,7 @@ public enum CollectionSize implements Feature<Collection>, Comparable<Collection
|
|
private final Integer numElements;
|
|
|
|
CollectionSize(int numElements) {
|
|
- this.implied = Collections.emptySet();
|
|
+ this.implied = emptySet();
|
|
this.numElements = numElements;
|
|
}
|
|
|
|
diff --git a/guava-testlib/src/com/google/common/collect/testing/features/FeatureUtil.java b/guava-testlib/src/com/google/common/collect/testing/features/FeatureUtil.java
|
|
index 2d11a08634..d661bc8df6 100644
|
|
--- a/guava-testlib/src/com/google/common/collect/testing/features/FeatureUtil.java
|
|
+++ b/guava-testlib/src/com/google/common/collect/testing/features/FeatureUtil.java
|
|
@@ -16,6 +16,9 @@
|
|
|
|
package com.google.common.collect.testing.features;
|
|
|
|
+import static java.util.Collections.disjoint;
|
|
+import static java.util.Collections.unmodifiableList;
|
|
+
|
|
import com.google.common.annotations.GwtIncompatible;
|
|
import com.google.common.collect.testing.Helpers;
|
|
import java.lang.annotation.Annotation;
|
|
@@ -23,7 +26,6 @@ import java.lang.reflect.AnnotatedElement;
|
|
import java.lang.reflect.Method;
|
|
import java.util.ArrayDeque;
|
|
import java.util.ArrayList;
|
|
-import java.util.Collections;
|
|
import java.util.HashMap;
|
|
import java.util.LinkedHashSet;
|
|
import java.util.List;
|
|
@@ -188,7 +190,7 @@ public class FeatureUtil {
|
|
addImpliedFeatures(Helpers.<Feature<?>>copyToSet(presentFeatures));
|
|
Set<Feature<?>> allAbsentFeatures =
|
|
addImpliedFeatures(Helpers.<Feature<?>>copyToSet(absentFeatures));
|
|
- if (!Collections.disjoint(allPresentFeatures, allAbsentFeatures)) {
|
|
+ if (!disjoint(allPresentFeatures, allAbsentFeatures)) {
|
|
throw new ConflictingRequirementsException(
|
|
"Annotation explicitly or "
|
|
+ "implicitly requires one or more features to be both present "
|
|
@@ -237,7 +239,7 @@ public class FeatureUtil {
|
|
annotations.add(a);
|
|
}
|
|
}
|
|
- annotations = Collections.unmodifiableList(annotations);
|
|
+ annotations = unmodifiableList(annotations);
|
|
annotationCache.put(classOrMethod, annotations);
|
|
}
|
|
return annotations;
|
|
@@ -276,7 +278,7 @@ public class FeatureUtil {
|
|
Set<Feature<?>> newFeatures,
|
|
Object source)
|
|
throws ConflictingRequirementsException {
|
|
- if (!Collections.disjoint(newFeatures, earlierFeatures)) {
|
|
+ if (!disjoint(newFeatures, earlierFeatures)) {
|
|
throw new ConflictingRequirementsException(
|
|
String.format(
|
|
Locale.ROOT,
|
|
diff --git a/guava-testlib/src/com/google/common/collect/testing/features/TesterAnnotation.java b/guava-testlib/src/com/google/common/collect/testing/features/TesterAnnotation.java
|
|
index 1831e417f0..02c900c07c 100644
|
|
--- a/guava-testlib/src/com/google/common/collect/testing/features/TesterAnnotation.java
|
|
+++ b/guava-testlib/src/com/google/common/collect/testing/features/TesterAnnotation.java
|
|
@@ -29,8 +29,8 @@ import java.lang.annotation.Target;
|
|
*
|
|
* @author George van den Driessche
|
|
*/
|
|
-@Target(value = {java.lang.annotation.ElementType.ANNOTATION_TYPE})
|
|
-@Retention(value = RetentionPolicy.RUNTIME)
|
|
+@Target(java.lang.annotation.ElementType.ANNOTATION_TYPE)
|
|
+@Retention(RetentionPolicy.RUNTIME)
|
|
@Documented
|
|
@GwtCompatible
|
|
public @interface TesterAnnotation {}
|
|
diff --git a/guava-testlib/src/com/google/common/collect/testing/google/AbstractMultisetSetCountTester.java b/guava-testlib/src/com/google/common/collect/testing/google/AbstractMultisetSetCountTester.java
|
|
index a72fd9fba5..bdcffa19f2 100644
|
|
--- a/guava-testlib/src/com/google/common/collect/testing/google/AbstractMultisetSetCountTester.java
|
|
+++ b/guava-testlib/src/com/google/common/collect/testing/google/AbstractMultisetSetCountTester.java
|
|
@@ -137,20 +137,20 @@ public abstract class AbstractMultisetSetCountTester<E> extends AbstractMultiset
|
|
}
|
|
}
|
|
|
|
- @CollectionSize.Require(absent = ZERO)
|
|
@CollectionFeature.Require(SUPPORTS_ADD)
|
|
+ @CollectionSize.Require(absent = ZERO)
|
|
public void testSetCount_oneToOne_addSupported() {
|
|
assertOneToOne();
|
|
}
|
|
|
|
- @CollectionSize.Require(absent = ZERO)
|
|
@CollectionFeature.Require(SUPPORTS_REMOVE)
|
|
+ @CollectionSize.Require(absent = ZERO)
|
|
public void testSetCount_oneToOne_removeSupported() {
|
|
assertOneToOne();
|
|
}
|
|
|
|
- @CollectionSize.Require(absent = ZERO)
|
|
@CollectionFeature.Require(absent = {SUPPORTS_ADD, SUPPORTS_REMOVE})
|
|
+ @CollectionSize.Require(absent = ZERO)
|
|
public void testSetCount_oneToOne_unsupported() {
|
|
try {
|
|
assertOneToOne();
|
|
@@ -158,20 +158,20 @@ public abstract class AbstractMultisetSetCountTester<E> extends AbstractMultiset
|
|
}
|
|
}
|
|
|
|
- @CollectionSize.Require(SEVERAL)
|
|
@CollectionFeature.Require(SUPPORTS_ADD)
|
|
+ @CollectionSize.Require(SEVERAL)
|
|
public void testSetCount_threeToThree_addSupported() {
|
|
assertThreeToThree();
|
|
}
|
|
|
|
- @CollectionSize.Require(SEVERAL)
|
|
@CollectionFeature.Require(SUPPORTS_REMOVE)
|
|
+ @CollectionSize.Require(SEVERAL)
|
|
public void testSetCount_threeToThree_removeSupported() {
|
|
assertThreeToThree();
|
|
}
|
|
|
|
- @CollectionSize.Require(SEVERAL)
|
|
@CollectionFeature.Require(absent = {SUPPORTS_ADD, SUPPORTS_REMOVE})
|
|
+ @CollectionSize.Require(SEVERAL)
|
|
public void testSetCount_threeToThree_unsupported() {
|
|
try {
|
|
assertThreeToThree();
|
|
@@ -186,7 +186,7 @@ public abstract class AbstractMultisetSetCountTester<E> extends AbstractMultiset
|
|
assertSetCount(e3(), 1);
|
|
}
|
|
|
|
- @CollectionFeature.Require({SUPPORTS_ADD, FAILS_FAST_ON_CONCURRENT_MODIFICATION})
|
|
+ @CollectionFeature.Require({FAILS_FAST_ON_CONCURRENT_MODIFICATION, SUPPORTS_ADD})
|
|
public void testSetCountZeroToOneConcurrentWithIteration() {
|
|
try {
|
|
Iterator<E> iterator = collection.iterator();
|
|
@@ -198,7 +198,7 @@ public abstract class AbstractMultisetSetCountTester<E> extends AbstractMultiset
|
|
}
|
|
}
|
|
|
|
- @CollectionFeature.Require({SUPPORTS_ADD, FAILS_FAST_ON_CONCURRENT_MODIFICATION})
|
|
+ @CollectionFeature.Require({FAILS_FAST_ON_CONCURRENT_MODIFICATION, SUPPORTS_ADD})
|
|
public void testSetCountZeroToOneConcurrentWithEntrySetIteration() {
|
|
try {
|
|
Iterator<Entry<E>> iterator = getMultiset().entrySet().iterator();
|
|
@@ -215,8 +215,8 @@ public abstract class AbstractMultisetSetCountTester<E> extends AbstractMultiset
|
|
assertSetCount(e3(), 3);
|
|
}
|
|
|
|
- @CollectionSize.Require(absent = ZERO)
|
|
@CollectionFeature.Require(SUPPORTS_ADD)
|
|
+ @CollectionSize.Require(absent = ZERO)
|
|
public void testSetCount_oneToThree_supported() {
|
|
assertSetCount(e0(), 3);
|
|
}
|
|
@@ -231,21 +231,21 @@ public abstract class AbstractMultisetSetCountTester<E> extends AbstractMultiset
|
|
assertSetCountIncreasingFailure(e3(), 3);
|
|
}
|
|
|
|
- @CollectionSize.Require(absent = ZERO)
|
|
@CollectionFeature.Require(absent = SUPPORTS_ADD)
|
|
+ @CollectionSize.Require(absent = ZERO)
|
|
public void testSetCount_oneToThree_unsupported() {
|
|
assertSetCountIncreasingFailure(e3(), 3);
|
|
}
|
|
|
|
// Unconditional setCount size decreases:
|
|
|
|
- @CollectionSize.Require(absent = ZERO)
|
|
@CollectionFeature.Require(SUPPORTS_REMOVE)
|
|
+ @CollectionSize.Require(absent = ZERO)
|
|
public void testSetCount_oneToZero_supported() {
|
|
assertSetCount(e0(), 0);
|
|
}
|
|
|
|
- @CollectionFeature.Require({SUPPORTS_REMOVE, FAILS_FAST_ON_CONCURRENT_MODIFICATION})
|
|
+ @CollectionFeature.Require({FAILS_FAST_ON_CONCURRENT_MODIFICATION, SUPPORTS_REMOVE})
|
|
@CollectionSize.Require(absent = ZERO)
|
|
public void testSetCountOneToZeroConcurrentWithIteration() {
|
|
try {
|
|
@@ -258,7 +258,7 @@ public abstract class AbstractMultisetSetCountTester<E> extends AbstractMultiset
|
|
}
|
|
}
|
|
|
|
- @CollectionFeature.Require({SUPPORTS_REMOVE, FAILS_FAST_ON_CONCURRENT_MODIFICATION})
|
|
+ @CollectionFeature.Require({FAILS_FAST_ON_CONCURRENT_MODIFICATION, SUPPORTS_REMOVE})
|
|
@CollectionSize.Require(absent = ZERO)
|
|
public void testSetCountOneToZeroConcurrentWithEntrySetIteration() {
|
|
try {
|
|
@@ -271,35 +271,35 @@ public abstract class AbstractMultisetSetCountTester<E> extends AbstractMultiset
|
|
}
|
|
}
|
|
|
|
- @CollectionSize.Require(SEVERAL)
|
|
@CollectionFeature.Require(SUPPORTS_REMOVE)
|
|
+ @CollectionSize.Require(SEVERAL)
|
|
public void testSetCount_threeToZero_supported() {
|
|
initThreeCopies();
|
|
assertSetCount(e0(), 0);
|
|
}
|
|
|
|
- @CollectionSize.Require(SEVERAL)
|
|
@CollectionFeature.Require(SUPPORTS_REMOVE)
|
|
+ @CollectionSize.Require(SEVERAL)
|
|
public void testSetCount_threeToOne_supported() {
|
|
initThreeCopies();
|
|
assertSetCount(e0(), 1);
|
|
}
|
|
|
|
- @CollectionSize.Require(absent = ZERO)
|
|
@CollectionFeature.Require(absent = SUPPORTS_REMOVE)
|
|
+ @CollectionSize.Require(absent = ZERO)
|
|
public void testSetCount_oneToZero_unsupported() {
|
|
assertSetCountDecreasingFailure(e0(), 0);
|
|
}
|
|
|
|
- @CollectionSize.Require(SEVERAL)
|
|
@CollectionFeature.Require(absent = SUPPORTS_REMOVE)
|
|
+ @CollectionSize.Require(SEVERAL)
|
|
public void testSetCount_threeToZero_unsupported() {
|
|
initThreeCopies();
|
|
assertSetCountDecreasingFailure(e0(), 0);
|
|
}
|
|
|
|
- @CollectionSize.Require(SEVERAL)
|
|
@CollectionFeature.Require(absent = SUPPORTS_REMOVE)
|
|
+ @CollectionSize.Require(SEVERAL)
|
|
public void testSetCount_threeToOne_unsupported() {
|
|
initThreeCopies();
|
|
assertSetCountDecreasingFailure(e0(), 1);
|
|
@@ -307,15 +307,15 @@ public abstract class AbstractMultisetSetCountTester<E> extends AbstractMultiset
|
|
|
|
// setCount with nulls:
|
|
|
|
+ @CollectionFeature.Require({ALLOWS_NULL_VALUES, SUPPORTS_REMOVE})
|
|
@CollectionSize.Require(absent = ZERO)
|
|
- @CollectionFeature.Require({SUPPORTS_REMOVE, ALLOWS_NULL_VALUES})
|
|
public void testSetCount_removeNull_nullSupported() {
|
|
initCollectionWithNullElement();
|
|
assertSetCount(null, 0);
|
|
}
|
|
|
|
@CollectionFeature.Require(
|
|
- value = {SUPPORTS_ADD, ALLOWS_NULL_VALUES},
|
|
+ value = {ALLOWS_NULL_VALUES, SUPPORTS_ADD},
|
|
absent = RESTRICTS_ELEMENTS)
|
|
public void testSetCount_addNull_nullSupported() {
|
|
assertSetCount(null, 1);
|
|
@@ -346,8 +346,8 @@ public abstract class AbstractMultisetSetCountTester<E> extends AbstractMultiset
|
|
}
|
|
}
|
|
|
|
- @CollectionSize.Require(absent = ZERO)
|
|
@CollectionFeature.Require(ALLOWS_NULL_VALUES)
|
|
+ @CollectionSize.Require(absent = ZERO)
|
|
public void testSetCount_existingNoNopNull_nullSupported() {
|
|
initCollectionWithNullElement();
|
|
try {
|
|
diff --git a/guava-testlib/src/com/google/common/collect/testing/google/BiMapEntrySetTester.java b/guava-testlib/src/com/google/common/collect/testing/google/BiMapEntrySetTester.java
|
|
index 5c9a47989b..f23146406b 100644
|
|
--- a/guava-testlib/src/com/google/common/collect/testing/google/BiMapEntrySetTester.java
|
|
+++ b/guava-testlib/src/com/google/common/collect/testing/google/BiMapEntrySetTester.java
|
|
@@ -31,8 +31,8 @@ import org.junit.Ignore;
|
|
@GwtCompatible
|
|
@Ignore // Affects only Android test runner, which respects JUnit 4 annotations on JUnit 3 tests.
|
|
public class BiMapEntrySetTester<K, V> extends AbstractBiMapTester<K, V> {
|
|
- @MapFeature.Require(SUPPORTS_PUT)
|
|
@CollectionSize.Require(absent = ZERO)
|
|
+ @MapFeature.Require(SUPPORTS_PUT)
|
|
public void testSetValue_valueAbsent() {
|
|
for (Entry<K, V> entry : getMap().entrySet()) {
|
|
if (entry.getKey().equals(k0())) {
|
|
@@ -42,8 +42,8 @@ public class BiMapEntrySetTester<K, V> extends AbstractBiMapTester<K, V> {
|
|
expectReplacement(entry(k0(), v3()));
|
|
}
|
|
|
|
- @MapFeature.Require(SUPPORTS_PUT)
|
|
@CollectionSize.Require(SEVERAL)
|
|
+ @MapFeature.Require(SUPPORTS_PUT)
|
|
public void testSetValue_valuePresent() {
|
|
for (Entry<K, V> entry : getMap().entrySet()) {
|
|
if (entry.getKey().equals(k0())) {
|
|
@@ -57,8 +57,8 @@ public class BiMapEntrySetTester<K, V> extends AbstractBiMapTester<K, V> {
|
|
expectUnchanged();
|
|
}
|
|
|
|
- @MapFeature.Require(value = SUPPORTS_PUT, absent = ALLOWS_NULL_VALUES)
|
|
@CollectionSize.Require(absent = ZERO)
|
|
+ @MapFeature.Require(value = SUPPORTS_PUT, absent = ALLOWS_NULL_VALUES)
|
|
public void testSetValueNullUnsupported() {
|
|
for (Entry<K, V> entry : getMap().entrySet()) {
|
|
try {
|
|
@@ -70,8 +70,8 @@ public class BiMapEntrySetTester<K, V> extends AbstractBiMapTester<K, V> {
|
|
}
|
|
}
|
|
|
|
- @MapFeature.Require({SUPPORTS_PUT, ALLOWS_NULL_VALUES})
|
|
@CollectionSize.Require(absent = ZERO)
|
|
+ @MapFeature.Require({ALLOWS_NULL_VALUES, SUPPORTS_PUT})
|
|
public void testSetValueNullSupported() {
|
|
for (Entry<K, V> entry : getMap().entrySet()) {
|
|
if (entry.getKey().equals(k0())) {
|
|
diff --git a/guava-testlib/src/com/google/common/collect/testing/google/BiMapInverseTester.java b/guava-testlib/src/com/google/common/collect/testing/google/BiMapInverseTester.java
|
|
index 984558e2b7..460df42e9b 100644
|
|
--- a/guava-testlib/src/com/google/common/collect/testing/google/BiMapInverseTester.java
|
|
+++ b/guava-testlib/src/com/google/common/collect/testing/google/BiMapInverseTester.java
|
|
@@ -17,6 +17,7 @@
|
|
package com.google.common.collect.testing.google;
|
|
|
|
import static com.google.common.collect.testing.features.CollectionFeature.SERIALIZABLE;
|
|
+import static java.util.Collections.singletonList;
|
|
|
|
import com.google.common.annotations.GwtCompatible;
|
|
import com.google.common.annotations.GwtIncompatible;
|
|
@@ -26,7 +27,6 @@ import com.google.common.collect.testing.features.CollectionFeature;
|
|
import com.google.common.testing.SerializableTester;
|
|
import java.io.Serializable;
|
|
import java.lang.reflect.Method;
|
|
-import java.util.Collections;
|
|
import java.util.List;
|
|
import org.junit.Ignore;
|
|
|
|
@@ -74,7 +74,7 @@ public class BiMapInverseTester<K, V> extends AbstractBiMapTester<K, V> {
|
|
*/
|
|
@GwtIncompatible // reflection
|
|
public static List<Method> getInverseSameAfterSerializingMethods() {
|
|
- return Collections.singletonList(getMethod("testInverseSerialization"));
|
|
+ return singletonList(getMethod("testInverseSerialization"));
|
|
}
|
|
|
|
@GwtIncompatible // reflection
|
|
diff --git a/guava-testlib/src/com/google/common/collect/testing/google/BiMapPutTester.java b/guava-testlib/src/com/google/common/collect/testing/google/BiMapPutTester.java
|
|
index 4bb72a2f38..23728e4aa9 100644
|
|
--- a/guava-testlib/src/com/google/common/collect/testing/google/BiMapPutTester.java
|
|
+++ b/guava-testlib/src/com/google/common/collect/testing/google/BiMapPutTester.java
|
|
@@ -34,9 +34,9 @@ import org.junit.Ignore;
|
|
@Ignore // Affects only Android test runner, which respects JUnit 4 annotations on JUnit 3 tests.
|
|
public class BiMapPutTester<K, V> extends AbstractBiMapTester<K, V> {
|
|
|
|
- @SuppressWarnings("unchecked")
|
|
- @MapFeature.Require(SUPPORTS_PUT)
|
|
@CollectionSize.Require(ZERO)
|
|
+ @MapFeature.Require(SUPPORTS_PUT)
|
|
+ @SuppressWarnings("unchecked")
|
|
public void testPutWithSameValueFails() {
|
|
getMap().put(k0(), v0());
|
|
try {
|
|
@@ -49,9 +49,9 @@ public class BiMapPutTester<K, V> extends AbstractBiMapTester<K, V> {
|
|
expectAdded(e0());
|
|
}
|
|
|
|
- @SuppressWarnings("unchecked")
|
|
- @MapFeature.Require(SUPPORTS_PUT)
|
|
@CollectionSize.Require(ZERO)
|
|
+ @MapFeature.Require(SUPPORTS_PUT)
|
|
+ @SuppressWarnings("unchecked")
|
|
public void testPutPresentKeyDifferentValue() {
|
|
getMap().put(k0(), v0());
|
|
getMap().put(k0(), v1());
|
|
@@ -60,18 +60,18 @@ public class BiMapPutTester<K, V> extends AbstractBiMapTester<K, V> {
|
|
expectContents(Helpers.mapEntry(k0(), v1()));
|
|
}
|
|
|
|
- @SuppressWarnings("unchecked")
|
|
- @MapFeature.Require(SUPPORTS_PUT)
|
|
@CollectionSize.Require(ZERO)
|
|
+ @MapFeature.Require(SUPPORTS_PUT)
|
|
+ @SuppressWarnings("unchecked")
|
|
public void putDistinctKeysDistinctValues() {
|
|
getMap().put(k0(), v0());
|
|
getMap().put(k1(), v1());
|
|
expectAdded(e0(), e1());
|
|
}
|
|
|
|
- @SuppressWarnings("unchecked")
|
|
- @MapFeature.Require(SUPPORTS_PUT)
|
|
@CollectionSize.Require(ONE)
|
|
+ @MapFeature.Require(SUPPORTS_PUT)
|
|
+ @SuppressWarnings("unchecked")
|
|
public void testForcePutKeyPresent() {
|
|
getMap().forcePut(k0(), v1());
|
|
expectContents(Helpers.mapEntry(k0(), v1()));
|
|
@@ -81,9 +81,9 @@ public class BiMapPutTester<K, V> extends AbstractBiMapTester<K, V> {
|
|
assertTrue(getMap().containsKey(k0()));
|
|
}
|
|
|
|
- @SuppressWarnings("unchecked")
|
|
- @MapFeature.Require(SUPPORTS_PUT)
|
|
@CollectionSize.Require(ONE)
|
|
+ @MapFeature.Require(SUPPORTS_PUT)
|
|
+ @SuppressWarnings("unchecked")
|
|
public void testForcePutValuePresent() {
|
|
getMap().forcePut(k1(), v0());
|
|
expectContents(Helpers.mapEntry(k1(), v0()));
|
|
@@ -92,9 +92,9 @@ public class BiMapPutTester<K, V> extends AbstractBiMapTester<K, V> {
|
|
assertFalse(getMap().containsKey(k0()));
|
|
}
|
|
|
|
- @SuppressWarnings("unchecked")
|
|
- @MapFeature.Require(SUPPORTS_PUT)
|
|
@CollectionSize.Require(SEVERAL)
|
|
+ @MapFeature.Require(SUPPORTS_PUT)
|
|
+ @SuppressWarnings("unchecked")
|
|
public void testForcePutKeyAndValuePresent() {
|
|
getMap().forcePut(k0(), v1());
|
|
expectContents(Helpers.mapEntry(k0(), v1()), Helpers.mapEntry(k2(), v2()));
|
|
@@ -103,9 +103,9 @@ public class BiMapPutTester<K, V> extends AbstractBiMapTester<K, V> {
|
|
assertFalse(getMap().containsValue(v0()));
|
|
}
|
|
|
|
- @SuppressWarnings("unchecked")
|
|
- @MapFeature.Require({SUPPORTS_PUT, ALLOWS_NULL_KEYS})
|
|
@CollectionSize.Require(ONE)
|
|
+ @MapFeature.Require({ALLOWS_NULL_KEYS, SUPPORTS_PUT})
|
|
+ @SuppressWarnings("unchecked")
|
|
public void testForcePutNullKeyPresent() {
|
|
initMapWithNullKey();
|
|
|
|
@@ -122,9 +122,9 @@ public class BiMapPutTester<K, V> extends AbstractBiMapTester<K, V> {
|
|
assertEquals(1, getMap().size());
|
|
}
|
|
|
|
- @SuppressWarnings("unchecked")
|
|
- @MapFeature.Require({SUPPORTS_PUT, ALLOWS_NULL_VALUES})
|
|
@CollectionSize.Require(ONE)
|
|
+ @MapFeature.Require({ALLOWS_NULL_VALUES, SUPPORTS_PUT})
|
|
+ @SuppressWarnings("unchecked")
|
|
public void testForcePutNullValuePresent() {
|
|
initMapWithNullValue();
|
|
|
|
@@ -143,9 +143,9 @@ public class BiMapPutTester<K, V> extends AbstractBiMapTester<K, V> {
|
|
|
|
// nb: inverse is run through its own entire suite
|
|
|
|
- @SuppressWarnings("unchecked")
|
|
- @MapFeature.Require(SUPPORTS_PUT)
|
|
@CollectionSize.Require(ZERO)
|
|
+ @MapFeature.Require(SUPPORTS_PUT)
|
|
+ @SuppressWarnings("unchecked")
|
|
public void testInversePut() {
|
|
getMap().put(k0(), v0());
|
|
getMap().inverse().put(v1(), k1());
|
|
diff --git a/guava-testlib/src/com/google/common/collect/testing/google/BiMapRemoveTester.java b/guava-testlib/src/com/google/common/collect/testing/google/BiMapRemoveTester.java
|
|
index e54256ad86..65cb0f1cf2 100644
|
|
--- a/guava-testlib/src/com/google/common/collect/testing/google/BiMapRemoveTester.java
|
|
+++ b/guava-testlib/src/com/google/common/collect/testing/google/BiMapRemoveTester.java
|
|
@@ -35,49 +35,49 @@ import org.junit.Ignore;
|
|
@GwtCompatible
|
|
@Ignore // Affects only Android test runner, which respects JUnit 4 annotations on JUnit 3 tests.
|
|
public class BiMapRemoveTester<K, V> extends AbstractBiMapTester<K, V> {
|
|
- @SuppressWarnings("unchecked")
|
|
- @MapFeature.Require(SUPPORTS_REMOVE)
|
|
@CollectionSize.Require(absent = ZERO)
|
|
+ @MapFeature.Require(SUPPORTS_REMOVE)
|
|
+ @SuppressWarnings("unchecked")
|
|
public void testRemoveKeyRemovesFromInverse() {
|
|
getMap().remove(k0());
|
|
expectMissing(e0());
|
|
}
|
|
|
|
- @SuppressWarnings("unchecked")
|
|
- @MapFeature.Require(SUPPORTS_REMOVE)
|
|
@CollectionSize.Require(absent = ZERO)
|
|
+ @MapFeature.Require(SUPPORTS_REMOVE)
|
|
+ @SuppressWarnings("unchecked")
|
|
public void testRemoveKeyFromKeySetRemovesFromInverse() {
|
|
getMap().keySet().remove(k0());
|
|
expectMissing(e0());
|
|
}
|
|
|
|
- @SuppressWarnings("unchecked")
|
|
- @MapFeature.Require(SUPPORTS_REMOVE)
|
|
@CollectionSize.Require(absent = ZERO)
|
|
+ @MapFeature.Require(SUPPORTS_REMOVE)
|
|
+ @SuppressWarnings("unchecked")
|
|
public void testRemoveFromValuesRemovesFromInverse() {
|
|
getMap().values().remove(v0());
|
|
expectMissing(e0());
|
|
}
|
|
|
|
- @SuppressWarnings("unchecked")
|
|
- @MapFeature.Require(SUPPORTS_REMOVE)
|
|
@CollectionSize.Require(absent = ZERO)
|
|
+ @MapFeature.Require(SUPPORTS_REMOVE)
|
|
+ @SuppressWarnings("unchecked")
|
|
public void testRemoveFromInverseRemovesFromForward() {
|
|
getMap().inverse().remove(v0());
|
|
expectMissing(e0());
|
|
}
|
|
|
|
- @SuppressWarnings("unchecked")
|
|
- @MapFeature.Require(SUPPORTS_REMOVE)
|
|
@CollectionSize.Require(absent = ZERO)
|
|
+ @MapFeature.Require(SUPPORTS_REMOVE)
|
|
+ @SuppressWarnings("unchecked")
|
|
public void testRemoveFromInverseKeySetRemovesFromForward() {
|
|
getMap().inverse().keySet().remove(v0());
|
|
expectMissing(e0());
|
|
}
|
|
|
|
- @SuppressWarnings("unchecked")
|
|
- @MapFeature.Require(SUPPORTS_REMOVE)
|
|
@CollectionSize.Require(absent = ZERO)
|
|
+ @MapFeature.Require(SUPPORTS_REMOVE)
|
|
+ @SuppressWarnings("unchecked")
|
|
public void testRemoveFromInverseValuesRemovesFromInverse() {
|
|
getMap().inverse().values().remove(k0());
|
|
expectMissing(e0());
|
|
diff --git a/guava-testlib/src/com/google/common/collect/testing/google/BiMapTestSuiteBuilder.java b/guava-testlib/src/com/google/common/collect/testing/google/BiMapTestSuiteBuilder.java
|
|
index 0821fb0b55..d3c40afc6d 100644
|
|
--- a/guava-testlib/src/com/google/common/collect/testing/google/BiMapTestSuiteBuilder.java
|
|
+++ b/guava-testlib/src/com/google/common/collect/testing/google/BiMapTestSuiteBuilder.java
|
|
@@ -16,6 +16,8 @@
|
|
|
|
package com.google.common.collect.testing.google;
|
|
|
|
+import static java.util.Collections.emptySet;
|
|
+
|
|
import com.google.common.annotations.GwtIncompatible;
|
|
import com.google.common.collect.BiMap;
|
|
import com.google.common.collect.testing.AbstractTester;
|
|
@@ -32,7 +34,6 @@ import com.google.common.collect.testing.google.DerivedGoogleCollectionGenerator
|
|
import com.google.common.collect.testing.google.DerivedGoogleCollectionGenerators.MapGenerator;
|
|
import com.google.common.collect.testing.testers.SetCreationTester;
|
|
import java.util.ArrayList;
|
|
-import java.util.Collections;
|
|
import java.util.HashSet;
|
|
import java.util.List;
|
|
import java.util.Map.Entry;
|
|
@@ -69,7 +70,7 @@ public class BiMapTestSuiteBuilder<K, V>
|
|
|
|
@Override
|
|
public Set<Feature<? super Void>> getImpliedFeatures() {
|
|
- return Collections.emptySet();
|
|
+ return emptySet();
|
|
}
|
|
}
|
|
|
|
diff --git a/guava-testlib/src/com/google/common/collect/testing/google/DerivedGoogleCollectionGenerators.java b/guava-testlib/src/com/google/common/collect/testing/google/DerivedGoogleCollectionGenerators.java
|
|
index 35579a01d7..0545fab220 100644
|
|
--- a/guava-testlib/src/com/google/common/collect/testing/google/DerivedGoogleCollectionGenerators.java
|
|
+++ b/guava-testlib/src/com/google/common/collect/testing/google/DerivedGoogleCollectionGenerators.java
|
|
@@ -69,14 +69,14 @@ public final class DerivedGoogleCollectionGenerators {
|
|
return generator.order(insertionOrder);
|
|
}
|
|
|
|
- @SuppressWarnings("unchecked")
|
|
@Override
|
|
+ @SuppressWarnings("unchecked")
|
|
public K[] createKeyArray(int length) {
|
|
return (K[]) new Object[length];
|
|
}
|
|
|
|
- @SuppressWarnings("unchecked")
|
|
@Override
|
|
+ @SuppressWarnings("unchecked")
|
|
public V[] createValueArray(int length) {
|
|
return (V[]) new Object[length];
|
|
}
|
|
@@ -112,8 +112,8 @@ public final class DerivedGoogleCollectionGenerators {
|
|
return Helpers.mapEntry(entry.getValue(), entry.getKey());
|
|
}
|
|
|
|
- @SuppressWarnings("unchecked")
|
|
@Override
|
|
+ @SuppressWarnings("unchecked")
|
|
public BiMap<V, K> create(Object... elements) {
|
|
Entry<?, ?>[] entries = new Entry<?, ?>[elements.length];
|
|
for (int i = 0; i < elements.length; i++) {
|
|
@@ -122,8 +122,8 @@ public final class DerivedGoogleCollectionGenerators {
|
|
return generator.create((Object[]) entries).inverse();
|
|
}
|
|
|
|
- @SuppressWarnings("unchecked")
|
|
@Override
|
|
+ @SuppressWarnings("unchecked")
|
|
public Entry<V, K>[] createArray(int length) {
|
|
return new Entry[length];
|
|
}
|
|
@@ -133,14 +133,14 @@ public final class DerivedGoogleCollectionGenerators {
|
|
return insertionOrder;
|
|
}
|
|
|
|
- @SuppressWarnings("unchecked")
|
|
@Override
|
|
+ @SuppressWarnings("unchecked")
|
|
public V[] createKeyArray(int length) {
|
|
return (V[]) new Object[length];
|
|
}
|
|
|
|
- @SuppressWarnings("unchecked")
|
|
@Override
|
|
+ @SuppressWarnings("unchecked")
|
|
public K[] createValueArray(int length) {
|
|
return (K[]) new Object[length];
|
|
}
|
|
@@ -194,9 +194,7 @@ public final class DerivedGoogleCollectionGenerators {
|
|
|
|
@Override
|
|
public V[] createArray(int length) {
|
|
- V[] vs =
|
|
- ((TestBiMapGenerator<K, V>) mapGenerator.getInnerGenerator()).createValueArray(length);
|
|
- return vs;
|
|
+ return ((TestBiMapGenerator<K, V>) mapGenerator.getInnerGenerator()).createValueArray(length);
|
|
}
|
|
|
|
@Override
|
|
diff --git a/guava-testlib/src/com/google/common/collect/testing/google/ListGenerators.java b/guava-testlib/src/com/google/common/collect/testing/google/ListGenerators.java
|
|
index 0839f09188..5a03acd60c 100644
|
|
--- a/guava-testlib/src/com/google/common/collect/testing/google/ListGenerators.java
|
|
+++ b/guava-testlib/src/com/google/common/collect/testing/google/ListGenerators.java
|
|
@@ -17,6 +17,7 @@
|
|
package com.google.common.collect.testing.google;
|
|
|
|
import static java.util.Arrays.asList;
|
|
+import static java.util.Collections.reverse;
|
|
|
|
import com.google.common.annotations.GwtCompatible;
|
|
import com.google.common.collect.ImmutableList;
|
|
@@ -28,7 +29,6 @@ import com.google.common.collect.testing.TestUnhashableCollectionGenerator;
|
|
import com.google.common.collect.testing.UnhashableObject;
|
|
import com.google.common.primitives.Chars;
|
|
import java.util.Arrays;
|
|
-import java.util.Collections;
|
|
import java.util.List;
|
|
|
|
/**
|
|
@@ -70,7 +70,7 @@ public final class ListGenerators {
|
|
@Override
|
|
protected List<String> create(String[] elements) {
|
|
List<String> list = asList(elements);
|
|
- Collections.reverse(list);
|
|
+ reverse(list);
|
|
return ImmutableList.copyOf(list).reverse();
|
|
}
|
|
}
|
|
diff --git a/guava-testlib/src/com/google/common/collect/testing/google/ListMultimapAsMapTester.java b/guava-testlib/src/com/google/common/collect/testing/google/ListMultimapAsMapTester.java
|
|
index ca6f21af2c..9b6fa118eb 100644
|
|
--- a/guava-testlib/src/com/google/common/collect/testing/google/ListMultimapAsMapTester.java
|
|
+++ b/guava-testlib/src/com/google/common/collect/testing/google/ListMultimapAsMapTester.java
|
|
@@ -16,6 +16,8 @@ package com.google.common.collect.testing.google;
|
|
|
|
import static com.google.common.collect.testing.features.CollectionSize.SEVERAL;
|
|
import static com.google.common.collect.testing.features.MapFeature.SUPPORTS_REMOVE;
|
|
+import static java.util.Collections.singletonList;
|
|
+import static java.util.Collections.singletonMap;
|
|
|
|
import com.google.common.annotations.GwtCompatible;
|
|
import com.google.common.collect.Lists;
|
|
@@ -27,7 +29,6 @@ import com.google.common.collect.testing.features.MapFeature;
|
|
import com.google.common.testing.EqualsTester;
|
|
import java.util.ArrayList;
|
|
import java.util.Collection;
|
|
-import java.util.Collections;
|
|
import java.util.List;
|
|
import java.util.Map;
|
|
import java.util.Map.Entry;
|
|
@@ -90,9 +91,8 @@ public class ListMultimapAsMapTester<K, V> extends AbstractListMultimapTester<K,
|
|
public void testValuesRemove() {
|
|
resetContainer(
|
|
Helpers.mapEntry(k0(), v0()), Helpers.mapEntry(k1(), v0()), Helpers.mapEntry(k0(), v3()));
|
|
- assertTrue(multimap().asMap().values().remove(Collections.singletonList(v0())));
|
|
+ assertTrue(multimap().asMap().values().remove(singletonList(v0())));
|
|
assertEquals(2, multimap().size());
|
|
- assertEquals(
|
|
- Collections.singletonMap(k0(), Lists.newArrayList(v0(), v3())), multimap().asMap());
|
|
+ assertEquals(singletonMap(k0(), Lists.newArrayList(v0(), v3())), multimap().asMap());
|
|
}
|
|
}
|
|
diff --git a/guava-testlib/src/com/google/common/collect/testing/google/ListMultimapPutTester.java b/guava-testlib/src/com/google/common/collect/testing/google/ListMultimapPutTester.java
|
|
index c459496825..c80b5b062a 100644
|
|
--- a/guava-testlib/src/com/google/common/collect/testing/google/ListMultimapPutTester.java
|
|
+++ b/guava-testlib/src/com/google/common/collect/testing/google/ListMultimapPutTester.java
|
|
@@ -55,8 +55,8 @@ public class ListMultimapPutTester<K, V> extends AbstractListMultimapTester<K, V
|
|
}
|
|
}
|
|
|
|
- @MapFeature.Require(SUPPORTS_PUT)
|
|
@CollectionSize.Require(absent = ZERO)
|
|
+ @MapFeature.Require(SUPPORTS_PUT)
|
|
public void testPutDuplicateValue() {
|
|
List<Entry<K, V>> entries = copyToList(multimap().entries());
|
|
|
|
diff --git a/guava-testlib/src/com/google/common/collect/testing/google/ListMultimapRemoveTester.java b/guava-testlib/src/com/google/common/collect/testing/google/ListMultimapRemoveTester.java
|
|
index 04ac0a2bc5..154150ccfc 100644
|
|
--- a/guava-testlib/src/com/google/common/collect/testing/google/ListMultimapRemoveTester.java
|
|
+++ b/guava-testlib/src/com/google/common/collect/testing/google/ListMultimapRemoveTester.java
|
|
@@ -38,9 +38,9 @@ import org.junit.Ignore;
|
|
@GwtCompatible
|
|
@Ignore // Affects only Android test runner, which respects JUnit 4 annotations on JUnit 3 tests.
|
|
public class ListMultimapRemoveTester<K, V> extends AbstractListMultimapTester<K, V> {
|
|
- @SuppressWarnings("unchecked")
|
|
- @MapFeature.Require(SUPPORTS_REMOVE)
|
|
@CollectionSize.Require(SEVERAL)
|
|
+ @MapFeature.Require(SUPPORTS_REMOVE)
|
|
+ @SuppressWarnings("unchecked")
|
|
public void testMultimapRemoveDeletesFirstOccurrence() {
|
|
resetContainer(mapEntry(k0(), v0()), mapEntry(k0(), v1()), mapEntry(k0(), v0()));
|
|
|
|
@@ -49,9 +49,9 @@ public class ListMultimapRemoveTester<K, V> extends AbstractListMultimapTester<K
|
|
assertContentsInOrder(list, v1(), v0());
|
|
}
|
|
|
|
- @SuppressWarnings("unchecked")
|
|
- @MapFeature.Require(SUPPORTS_REMOVE)
|
|
@CollectionSize.Require(SEVERAL)
|
|
+ @MapFeature.Require(SUPPORTS_REMOVE)
|
|
+ @SuppressWarnings("unchecked")
|
|
public void testRemoveAtIndexFromGetPropagates() {
|
|
List<V> values = Arrays.asList(v0(), v1(), v0());
|
|
|
|
@@ -66,9 +66,9 @@ public class ListMultimapRemoveTester<K, V> extends AbstractListMultimapTester<K
|
|
}
|
|
}
|
|
|
|
- @SuppressWarnings("unchecked")
|
|
- @MapFeature.Require(SUPPORTS_REMOVE)
|
|
@CollectionSize.Require(SEVERAL)
|
|
+ @MapFeature.Require(SUPPORTS_REMOVE)
|
|
+ @SuppressWarnings("unchecked")
|
|
public void testRemoveAtIndexFromAsMapPropagates() {
|
|
List<V> values = Arrays.asList(v0(), v1(), v0());
|
|
|
|
@@ -84,9 +84,9 @@ public class ListMultimapRemoveTester<K, V> extends AbstractListMultimapTester<K
|
|
}
|
|
}
|
|
|
|
- @SuppressWarnings("unchecked")
|
|
- @MapFeature.Require(SUPPORTS_REMOVE)
|
|
@CollectionSize.Require(SEVERAL)
|
|
+ @MapFeature.Require(SUPPORTS_REMOVE)
|
|
+ @SuppressWarnings("unchecked")
|
|
public void testRemoveAtIndexFromAsMapEntrySetPropagates() {
|
|
List<V> values = Arrays.asList(v0(), v1(), v0());
|
|
|
|
diff --git a/guava-testlib/src/com/google/common/collect/testing/google/ListMultimapTestSuiteBuilder.java b/guava-testlib/src/com/google/common/collect/testing/google/ListMultimapTestSuiteBuilder.java
|
|
index b55c7d648f..1c7cfb3f90 100644
|
|
--- a/guava-testlib/src/com/google/common/collect/testing/google/ListMultimapTestSuiteBuilder.java
|
|
+++ b/guava-testlib/src/com/google/common/collect/testing/google/ListMultimapTestSuiteBuilder.java
|
|
@@ -16,6 +16,8 @@
|
|
|
|
package com.google.common.collect.testing.google;
|
|
|
|
+import static java.util.Collections.disjoint;
|
|
+
|
|
import com.google.common.annotations.GwtIncompatible;
|
|
import com.google.common.collect.ListMultimap;
|
|
import com.google.common.collect.testing.AbstractTester;
|
|
@@ -28,7 +30,6 @@ import com.google.common.collect.testing.features.CollectionFeature;
|
|
import com.google.common.collect.testing.features.CollectionSize;
|
|
import com.google.common.collect.testing.features.Feature;
|
|
import com.google.common.collect.testing.features.ListFeature;
|
|
-import java.util.Collections;
|
|
import java.util.EnumSet;
|
|
import java.util.List;
|
|
import java.util.Map.Entry;
|
|
@@ -83,7 +84,7 @@ public class ListMultimapTestSuiteBuilder<K, V>
|
|
?, ? extends OneSizeTestContainerGenerator<ListMultimap<K, V>, Entry<K, V>>>
|
|
parentBuilder) {
|
|
Set<Feature<?>> features = computeMultimapAsMapGetFeatures(parentBuilder.getFeatures());
|
|
- if (Collections.disjoint(features, EnumSet.allOf(CollectionSize.class))) {
|
|
+ if (disjoint(features, EnumSet.allOf(CollectionSize.class))) {
|
|
return new TestSuite();
|
|
} else {
|
|
return ListTestSuiteBuilder.using(
|
|
diff --git a/guava-testlib/src/com/google/common/collect/testing/google/MapGenerators.java b/guava-testlib/src/com/google/common/collect/testing/google/MapGenerators.java
|
|
index 3f445ca116..ad4c08939e 100644
|
|
--- a/guava-testlib/src/com/google/common/collect/testing/google/MapGenerators.java
|
|
+++ b/guava-testlib/src/com/google/common/collect/testing/google/MapGenerators.java
|
|
@@ -127,8 +127,8 @@ public class MapGenerators {
|
|
mapEntry("toaster", -2));
|
|
}
|
|
|
|
- @SuppressWarnings("unchecked")
|
|
@Override
|
|
+ @SuppressWarnings("unchecked")
|
|
public Entry<String, Integer>[] createArray(int length) {
|
|
return new Entry[length];
|
|
}
|
|
@@ -217,7 +217,7 @@ public class MapGenerators {
|
|
}
|
|
|
|
@Override
|
|
- @SuppressWarnings({"unchecked", "rawtypes"}) // needed for arrays
|
|
+ @SuppressWarnings({"rawtypes", "unchecked"}) // needed for arrays
|
|
public Entry<String, Collection<Integer>>[] createArray(int length) {
|
|
return new Entry[length];
|
|
}
|
|
@@ -234,7 +234,7 @@ public class MapGenerators {
|
|
}
|
|
|
|
@Override
|
|
- @SuppressWarnings({"unchecked", "rawtypes"}) // needed for arrays
|
|
+ @SuppressWarnings({"rawtypes", "unchecked"}) // needed for arrays
|
|
public ImmutableSet<Integer>[] createValueArray(int length) {
|
|
return new ImmutableSet[length];
|
|
}
|
|
diff --git a/guava-testlib/src/com/google/common/collect/testing/google/MultimapAsMapGetTester.java b/guava-testlib/src/com/google/common/collect/testing/google/MultimapAsMapGetTester.java
|
|
index dadb9a3245..38abbba69a 100644
|
|
--- a/guava-testlib/src/com/google/common/collect/testing/google/MultimapAsMapGetTester.java
|
|
+++ b/guava-testlib/src/com/google/common/collect/testing/google/MultimapAsMapGetTester.java
|
|
@@ -71,7 +71,7 @@ public class MultimapAsMapGetTester<K, V> extends AbstractMultimapTester<K, V, M
|
|
}
|
|
|
|
@CollectionSize.Require(absent = ZERO)
|
|
- @MapFeature.Require({SUPPORTS_PUT, ALLOWS_NULL_VALUES})
|
|
+ @MapFeature.Require({ALLOWS_NULL_VALUES, SUPPORTS_PUT})
|
|
public void testAddNullValue() {
|
|
Collection<V> result = multimap().asMap().get(k0());
|
|
assertTrue(result.add(null));
|
|
@@ -79,7 +79,7 @@ public class MultimapAsMapGetTester<K, V> extends AbstractMultimapTester<K, V, M
|
|
}
|
|
|
|
@CollectionSize.Require(absent = ZERO)
|
|
- @MapFeature.Require({SUPPORTS_REMOVE, ALLOWS_NULL_VALUE_QUERIES})
|
|
+ @MapFeature.Require({ALLOWS_NULL_VALUE_QUERIES, SUPPORTS_REMOVE})
|
|
public void testRemoveNullValue() {
|
|
Collection<V> result = multimap().asMap().get(k0());
|
|
assertFalse(result.remove(null));
|
|
@@ -105,7 +105,7 @@ public class MultimapAsMapGetTester<K, V> extends AbstractMultimapTester<K, V, M
|
|
}
|
|
|
|
@CollectionSize.Require(absent = ZERO)
|
|
- @MapFeature.Require({SUPPORTS_REMOVE, SUPPORTS_PUT})
|
|
+ @MapFeature.Require({SUPPORTS_PUT, SUPPORTS_REMOVE})
|
|
public void testPropagatesRemoveThenAddToMultimap() {
|
|
int oldSize = getNumElements();
|
|
|
|
diff --git a/guava-testlib/src/com/google/common/collect/testing/google/MultimapAsMapTester.java b/guava-testlib/src/com/google/common/collect/testing/google/MultimapAsMapTester.java
|
|
index 23b2351672..0ca0aa0634 100644
|
|
--- a/guava-testlib/src/com/google/common/collect/testing/google/MultimapAsMapTester.java
|
|
+++ b/guava-testlib/src/com/google/common/collect/testing/google/MultimapAsMapTester.java
|
|
@@ -129,8 +129,8 @@ public class MultimapAsMapTester<K, V> extends AbstractMultimapTester<K, V, Mult
|
|
assertContentsInOrder(multimap().keySet(), k1());
|
|
}
|
|
|
|
- @CollectionSize.Require(SEVERAL)
|
|
@CollectionFeature.Require(SUPPORTS_ITERATOR_REMOVE)
|
|
+ @CollectionSize.Require(SEVERAL)
|
|
public void testAsMapEntrySetIteratorRemovePropagatesToMultimap() {
|
|
resetContainer(Helpers.mapEntry(k0(), v0()), Helpers.mapEntry(k0(), v3()));
|
|
Set<Entry<K, Collection<V>>> asMapEntrySet = multimap().asMap().entrySet();
|
|
diff --git a/guava-testlib/src/com/google/common/collect/testing/google/MultimapClearTester.java b/guava-testlib/src/com/google/common/collect/testing/google/MultimapClearTester.java
|
|
index 6ce9907c14..8fd692b610 100644
|
|
--- a/guava-testlib/src/com/google/common/collect/testing/google/MultimapClearTester.java
|
|
+++ b/guava-testlib/src/com/google/common/collect/testing/google/MultimapClearTester.java
|
|
@@ -98,8 +98,8 @@ public class MultimapClearTester<K, V> extends AbstractMultimapTester<K, V, Mult
|
|
assertCleared();
|
|
}
|
|
|
|
- @MapFeature.Require(SUPPORTS_REMOVE)
|
|
@CollectionSize.Require(absent = ZERO)
|
|
+ @MapFeature.Require(SUPPORTS_REMOVE)
|
|
public void testClearPropagatesToGet() {
|
|
for (K key : sampleKeys()) {
|
|
resetContainer();
|
|
@@ -109,8 +109,8 @@ public class MultimapClearTester<K, V> extends AbstractMultimapTester<K, V, Mult
|
|
}
|
|
}
|
|
|
|
- @MapFeature.Require(SUPPORTS_REMOVE)
|
|
@CollectionSize.Require(absent = ZERO)
|
|
+ @MapFeature.Require(SUPPORTS_REMOVE)
|
|
public void testClearPropagatesToAsMapGet() {
|
|
for (K key : sampleKeys()) {
|
|
resetContainer();
|
|
diff --git a/guava-testlib/src/com/google/common/collect/testing/google/MultimapContainsKeyTester.java b/guava-testlib/src/com/google/common/collect/testing/google/MultimapContainsKeyTester.java
|
|
index a7dcd6626e..49dce23d06 100644
|
|
--- a/guava-testlib/src/com/google/common/collect/testing/google/MultimapContainsKeyTester.java
|
|
+++ b/guava-testlib/src/com/google/common/collect/testing/google/MultimapContainsKeyTester.java
|
|
@@ -67,8 +67,8 @@ public class MultimapContainsKeyTester<K, V> extends AbstractMultimapTester<K, V
|
|
}
|
|
}
|
|
|
|
- @MapFeature.Require(ALLOWS_NULL_KEYS)
|
|
@CollectionSize.Require(absent = ZERO)
|
|
+ @MapFeature.Require(ALLOWS_NULL_KEYS)
|
|
public void testContainsKeyNullPresent() {
|
|
initMultimapWithNullKey();
|
|
assertTrue(multimap().containsKey(null));
|
|
diff --git a/guava-testlib/src/com/google/common/collect/testing/google/MultimapContainsValueTester.java b/guava-testlib/src/com/google/common/collect/testing/google/MultimapContainsValueTester.java
|
|
index 00ca12ad51..862443304b 100644
|
|
--- a/guava-testlib/src/com/google/common/collect/testing/google/MultimapContainsValueTester.java
|
|
+++ b/guava-testlib/src/com/google/common/collect/testing/google/MultimapContainsValueTester.java
|
|
@@ -44,8 +44,8 @@ public class MultimapContainsValueTester<K, V>
|
|
assertFalse(multimap().containsValue(v3()));
|
|
}
|
|
|
|
- @MapFeature.Require(ALLOWS_NULL_VALUES)
|
|
@CollectionSize.Require(absent = ZERO)
|
|
+ @MapFeature.Require(ALLOWS_NULL_VALUES)
|
|
public void testContainsNullValueYes() {
|
|
initMultimapWithNullValue();
|
|
assertTrue(multimap().containsValue(null));
|
|
diff --git a/guava-testlib/src/com/google/common/collect/testing/google/MultimapEntriesTester.java b/guava-testlib/src/com/google/common/collect/testing/google/MultimapEntriesTester.java
|
|
index 9874b884cc..ef694f2359 100644
|
|
--- a/guava-testlib/src/com/google/common/collect/testing/google/MultimapEntriesTester.java
|
|
+++ b/guava-testlib/src/com/google/common/collect/testing/google/MultimapEntriesTester.java
|
|
@@ -24,6 +24,7 @@ import static com.google.common.collect.testing.features.MapFeature.ALLOWS_NULL_
|
|
import static com.google.common.collect.testing.features.MapFeature.ALLOWS_NULL_VALUES;
|
|
import static com.google.common.collect.testing.features.MapFeature.ALLOWS_NULL_VALUE_QUERIES;
|
|
import static com.google.common.collect.testing.features.MapFeature.SUPPORTS_REMOVE;
|
|
+import static java.util.Collections.singleton;
|
|
|
|
import com.google.common.annotations.GwtCompatible;
|
|
import com.google.common.collect.Multimap;
|
|
@@ -31,7 +32,6 @@ import com.google.common.collect.testing.Helpers;
|
|
import com.google.common.collect.testing.features.CollectionFeature;
|
|
import com.google.common.collect.testing.features.CollectionSize;
|
|
import com.google.common.collect.testing.features.MapFeature;
|
|
-import java.util.Collections;
|
|
import java.util.Iterator;
|
|
import java.util.Map.Entry;
|
|
import org.junit.Ignore;
|
|
@@ -84,7 +84,7 @@ public class MultimapEntriesTester<K, V> extends AbstractMultimapTester<K, V, Mu
|
|
@CollectionSize.Require(absent = ZERO)
|
|
@MapFeature.Require(SUPPORTS_REMOVE)
|
|
public void testRemoveAllPropagatesToMultimap() {
|
|
- assertTrue(multimap().entries().removeAll(Collections.singleton(Helpers.mapEntry(k0(), v0()))));
|
|
+ assertTrue(multimap().entries().removeAll(singleton(Helpers.mapEntry(k0(), v0()))));
|
|
expectMissing(Helpers.mapEntry(k0(), v0()));
|
|
assertEquals(getNumElements() - 1, multimap().size());
|
|
assertFalse(multimap().containsEntry(k0(), v0()));
|
|
@@ -93,14 +93,14 @@ public class MultimapEntriesTester<K, V> extends AbstractMultimapTester<K, V, Mu
|
|
@CollectionSize.Require(absent = ZERO)
|
|
@MapFeature.Require(SUPPORTS_REMOVE)
|
|
public void testRetainAllPropagatesToMultimap() {
|
|
- multimap().entries().retainAll(Collections.singleton(Helpers.mapEntry(k0(), v0())));
|
|
+ multimap().entries().retainAll(singleton(Helpers.mapEntry(k0(), v0())));
|
|
assertEquals(getSubjectGenerator().create(Helpers.mapEntry(k0(), v0())), multimap());
|
|
assertEquals(1, multimap().size());
|
|
assertTrue(multimap().containsEntry(k0(), v0()));
|
|
}
|
|
|
|
- @CollectionSize.Require(ONE)
|
|
@CollectionFeature.Require(SUPPORTS_ITERATOR_REMOVE)
|
|
+ @CollectionSize.Require(ONE)
|
|
public void testIteratorRemovePropagatesToMultimap() {
|
|
Iterator<Entry<K, V>> iterator = multimap().entries().iterator();
|
|
assertEquals(Helpers.mapEntry(k0(), v0()), iterator.next());
|
|
diff --git a/guava-testlib/src/com/google/common/collect/testing/google/MultimapGetTester.java b/guava-testlib/src/com/google/common/collect/testing/google/MultimapGetTester.java
|
|
index 6978473232..4fd6752e3d 100644
|
|
--- a/guava-testlib/src/com/google/common/collect/testing/google/MultimapGetTester.java
|
|
+++ b/guava-testlib/src/com/google/common/collect/testing/google/MultimapGetTester.java
|
|
@@ -25,6 +25,7 @@ import static com.google.common.collect.testing.features.MapFeature.ALLOWS_NULL_
|
|
import static com.google.common.collect.testing.features.MapFeature.ALLOWS_NULL_VALUES;
|
|
import static com.google.common.collect.testing.features.MapFeature.SUPPORTS_PUT;
|
|
import static com.google.common.collect.testing.features.MapFeature.SUPPORTS_REMOVE;
|
|
+import static java.util.Collections.singletonList;
|
|
|
|
import com.google.common.annotations.GwtCompatible;
|
|
import com.google.common.collect.Multimap;
|
|
@@ -32,7 +33,6 @@ import com.google.common.collect.testing.Helpers;
|
|
import com.google.common.collect.testing.features.CollectionSize;
|
|
import com.google.common.collect.testing.features.MapFeature;
|
|
import java.util.Collection;
|
|
-import java.util.Collections;
|
|
import org.junit.Ignore;
|
|
|
|
/**
|
|
@@ -98,14 +98,14 @@ public class MultimapGetTester<K, V> extends AbstractMultimapTester<K, V, Multim
|
|
@MapFeature.Require(SUPPORTS_PUT)
|
|
public void testPropagatesAddAllToMultimap() {
|
|
Collection<V> result = multimap().get(k0());
|
|
- assertTrue(result.addAll(Collections.singletonList(v3())));
|
|
+ assertTrue(result.addAll(singletonList(v3())));
|
|
assertTrue(multimap().containsKey(k0()));
|
|
assertEquals(getNumElements() + 1, multimap().size());
|
|
assertTrue(multimap().containsEntry(k0(), v3()));
|
|
}
|
|
|
|
@CollectionSize.Require(absent = ZERO)
|
|
- @MapFeature.Require({SUPPORTS_REMOVE, SUPPORTS_PUT})
|
|
+ @MapFeature.Require({SUPPORTS_PUT, SUPPORTS_REMOVE})
|
|
public void testPropagatesRemoveLastThenAddToMultimap() {
|
|
int oldSize = getNumElements();
|
|
|
|
@@ -127,8 +127,8 @@ public class MultimapGetTester<K, V> extends AbstractMultimapTester<K, V, Multim
|
|
assertEquals(oldSize + 1, multimap().size());
|
|
}
|
|
|
|
- @MapFeature.Require(ALLOWS_NULL_KEYS)
|
|
@CollectionSize.Require(absent = ZERO)
|
|
+ @MapFeature.Require(ALLOWS_NULL_KEYS)
|
|
public void testGetNullPresent() {
|
|
initMultimapWithNullKey();
|
|
assertContains(multimap().get(null), getValueForNullKey());
|
|
@@ -149,8 +149,8 @@ public class MultimapGetTester<K, V> extends AbstractMultimapTester<K, V, Multim
|
|
}
|
|
}
|
|
|
|
- @MapFeature.Require(ALLOWS_NULL_VALUES)
|
|
@CollectionSize.Require(absent = ZERO)
|
|
+ @MapFeature.Require(ALLOWS_NULL_VALUES)
|
|
public void testGetWithNullValue() {
|
|
initMultimapWithNullValue();
|
|
assertContains(multimap().get(getKeyForNullValue()), null);
|
|
diff --git a/guava-testlib/src/com/google/common/collect/testing/google/MultimapKeySetTester.java b/guava-testlib/src/com/google/common/collect/testing/google/MultimapKeySetTester.java
|
|
index 100b15bb76..afd5ffc997 100644
|
|
--- a/guava-testlib/src/com/google/common/collect/testing/google/MultimapKeySetTester.java
|
|
+++ b/guava-testlib/src/com/google/common/collect/testing/google/MultimapKeySetTester.java
|
|
@@ -63,8 +63,8 @@ public class MultimapKeySetTester<K, V> extends AbstractMultimapTester<K, V, Mul
|
|
assertGet(k0());
|
|
}
|
|
|
|
- @CollectionSize.Require(absent = ZERO)
|
|
@CollectionFeature.Require(SUPPORTS_ITERATOR_REMOVE)
|
|
+ @CollectionSize.Require(absent = ZERO)
|
|
public void testKeySetIteratorRemove() {
|
|
int key0Count = multimap().get(k0()).size();
|
|
Iterator<K> keyItr = multimap().keySet().iterator();
|
|
diff --git a/guava-testlib/src/com/google/common/collect/testing/google/MultimapKeysTester.java b/guava-testlib/src/com/google/common/collect/testing/google/MultimapKeysTester.java
|
|
index 6b2a93ca3d..00201c1beb 100644
|
|
--- a/guava-testlib/src/com/google/common/collect/testing/google/MultimapKeysTester.java
|
|
+++ b/guava-testlib/src/com/google/common/collect/testing/google/MultimapKeysTester.java
|
|
@@ -85,8 +85,8 @@ public class MultimapKeysTester<K, V> extends AbstractMultimapTester<K, V, Multi
|
|
assertEquals(Math.max(original - 1, 0), multimap().get(k0()).size());
|
|
}
|
|
|
|
- @CollectionSize.Require(ONE)
|
|
@CollectionFeature.Require(SUPPORTS_ITERATOR_REMOVE)
|
|
+ @CollectionSize.Require(ONE)
|
|
public void testKeysEntrySetIteratorRemove() {
|
|
Multiset<K> keys = multimap().keys();
|
|
Iterator<Multiset.Entry<K>> itr = keys.entrySet().iterator();
|
|
diff --git a/guava-testlib/src/com/google/common/collect/testing/google/MultimapPutAllMultimapTester.java b/guava-testlib/src/com/google/common/collect/testing/google/MultimapPutAllMultimapTester.java
|
|
index 92622933f8..418ea8cbce 100644
|
|
--- a/guava-testlib/src/com/google/common/collect/testing/google/MultimapPutAllMultimapTester.java
|
|
+++ b/guava-testlib/src/com/google/common/collect/testing/google/MultimapPutAllMultimapTester.java
|
|
@@ -62,14 +62,14 @@ public class MultimapPutAllMultimapTester<K, V>
|
|
assertTrue(multimap().containsEntry(k3(), v3()));
|
|
}
|
|
|
|
- @MapFeature.Require({SUPPORTS_PUT, ALLOWS_NULL_VALUES})
|
|
+ @MapFeature.Require({ALLOWS_NULL_VALUES, SUPPORTS_PUT})
|
|
public void testPutAllWithNullValue() {
|
|
Multimap<K, V> source = getSubjectGenerator().create(Helpers.mapEntry(k0(), null));
|
|
assertTrue(multimap().putAll(source));
|
|
assertTrue(multimap().containsEntry(k0(), null));
|
|
}
|
|
|
|
- @MapFeature.Require({SUPPORTS_PUT, ALLOWS_NULL_KEYS})
|
|
+ @MapFeature.Require({ALLOWS_NULL_KEYS, SUPPORTS_PUT})
|
|
public void testPutAllWithNullKey() {
|
|
Multimap<K, V> source = getSubjectGenerator().create(Helpers.mapEntry(null, v0()));
|
|
assertTrue(multimap().putAll(source));
|
|
diff --git a/guava-testlib/src/com/google/common/collect/testing/google/MultimapPutIterableTester.java b/guava-testlib/src/com/google/common/collect/testing/google/MultimapPutIterableTester.java
|
|
index b36037877a..d56c9de975 100644
|
|
--- a/guava-testlib/src/com/google/common/collect/testing/google/MultimapPutIterableTester.java
|
|
+++ b/guava-testlib/src/com/google/common/collect/testing/google/MultimapPutIterableTester.java
|
|
@@ -21,6 +21,7 @@ import static com.google.common.collect.testing.features.CollectionSize.ZERO;
|
|
import static com.google.common.collect.testing.features.MapFeature.ALLOWS_NULL_KEYS;
|
|
import static com.google.common.collect.testing.features.MapFeature.ALLOWS_NULL_VALUES;
|
|
import static com.google.common.collect.testing.features.MapFeature.SUPPORTS_PUT;
|
|
+import static java.util.Collections.singletonList;
|
|
|
|
import com.google.common.annotations.GwtCompatible;
|
|
import com.google.common.collect.ImmutableSet;
|
|
@@ -87,13 +88,13 @@ public class MultimapPutIterableTester<K, V> extends AbstractMultimapTester<K, V
|
|
}
|
|
|
|
@CollectionSize.Require(absent = ZERO)
|
|
- @MapFeature.Require({SUPPORTS_PUT, ALLOWS_NULL_VALUES})
|
|
+ @MapFeature.Require({ALLOWS_NULL_VALUES, SUPPORTS_PUT})
|
|
public void testPutAllNullValueOnPresentKey_supported() {
|
|
assertTrue(multimap().putAll(k0(), Lists.newArrayList(v3(), null)));
|
|
assertGet(k0(), v0(), v3(), null);
|
|
}
|
|
|
|
- @MapFeature.Require({SUPPORTS_PUT, ALLOWS_NULL_VALUES})
|
|
+ @MapFeature.Require({ALLOWS_NULL_VALUES, SUPPORTS_PUT})
|
|
public void testPutAllNullValueOnAbsentKey_supported() {
|
|
assertTrue(multimap().putAll(k3(), Lists.newArrayList(v3(), null)));
|
|
assertGet(k3(), v3(), null);
|
|
@@ -150,7 +151,7 @@ public class MultimapPutIterableTester<K, V> extends AbstractMultimapTester<K, V
|
|
assertEquals(size, multimap().size());
|
|
}
|
|
|
|
- @MapFeature.Require({SUPPORTS_PUT, ALLOWS_NULL_KEYS})
|
|
+ @MapFeature.Require({ALLOWS_NULL_KEYS, SUPPORTS_PUT})
|
|
public void testPutAllOnPresentNullKey() {
|
|
assertTrue(multimap().putAll(null, Lists.newArrayList(v3(), v4())));
|
|
assertGet(null, v3(), v4());
|
|
@@ -159,7 +160,7 @@ public class MultimapPutIterableTester<K, V> extends AbstractMultimapTester<K, V
|
|
@MapFeature.Require(absent = ALLOWS_NULL_KEYS)
|
|
public void testPutAllNullForbidden() {
|
|
try {
|
|
- multimap().putAll(null, Collections.singletonList(v3()));
|
|
+ multimap().putAll(null, singletonList(v3()));
|
|
fail("Expected NullPointerException");
|
|
} catch (NullPointerException expected) {
|
|
// success
|
|
diff --git a/guava-testlib/src/com/google/common/collect/testing/google/MultimapPutTester.java b/guava-testlib/src/com/google/common/collect/testing/google/MultimapPutTester.java
|
|
index c108e8525c..e40c53eea8 100644
|
|
--- a/guava-testlib/src/com/google/common/collect/testing/google/MultimapPutTester.java
|
|
+++ b/guava-testlib/src/com/google/common/collect/testing/google/MultimapPutTester.java
|
|
@@ -66,8 +66,8 @@ public class MultimapPutTester<K, V> extends AbstractMultimapTester<K, V, Multim
|
|
assertEquals(size + 1, multimap().size());
|
|
}
|
|
|
|
- @MapFeature.Require(SUPPORTS_PUT)
|
|
@CollectionSize.Require(absent = ZERO)
|
|
+ @MapFeature.Require(SUPPORTS_PUT)
|
|
public void testPutPresent() {
|
|
int size = getNumElements();
|
|
|
|
@@ -95,7 +95,7 @@ public class MultimapPutTester<K, V> extends AbstractMultimapTester<K, V, Multim
|
|
assertEquals(size + 2, multimap().size());
|
|
}
|
|
|
|
- @MapFeature.Require({SUPPORTS_PUT, ALLOWS_NULL_VALUES})
|
|
+ @MapFeature.Require({ALLOWS_NULL_VALUES, SUPPORTS_PUT})
|
|
public void testPutNullValue_supported() {
|
|
int size = getNumElements();
|
|
|
|
@@ -116,7 +116,7 @@ public class MultimapPutTester<K, V> extends AbstractMultimapTester<K, V, Multim
|
|
expectUnchanged();
|
|
}
|
|
|
|
- @MapFeature.Require({SUPPORTS_PUT, ALLOWS_NULL_KEYS})
|
|
+ @MapFeature.Require({ALLOWS_NULL_KEYS, SUPPORTS_PUT})
|
|
public void testPutNullKey() {
|
|
int size = getNumElements();
|
|
|
|
@@ -153,8 +153,8 @@ public class MultimapPutTester<K, V> extends AbstractMultimapTester<K, V, Multim
|
|
assertContains(entries, Helpers.mapEntry(k0(), v3()));
|
|
}
|
|
|
|
- @MapFeature.Require(SUPPORTS_PUT)
|
|
@CollectionSize.Require(absent = ZERO)
|
|
+ @MapFeature.Require(SUPPORTS_PUT)
|
|
public void testPutPresentKeyPropagatesToGet() {
|
|
List<K> keys = Helpers.copyToList(multimap().keySet());
|
|
for (K key : keys) {
|
|
@@ -172,8 +172,8 @@ public class MultimapPutTester<K, V> extends AbstractMultimapTester<K, V, Multim
|
|
}
|
|
}
|
|
|
|
- @MapFeature.Require(SUPPORTS_PUT)
|
|
@CollectionSize.Require(absent = ZERO)
|
|
+ @MapFeature.Require(SUPPORTS_PUT)
|
|
public void testPutPresentKeyPropagatesToAsMapGet() {
|
|
List<K> keys = Helpers.copyToList(multimap().keySet());
|
|
for (K key : keys) {
|
|
@@ -192,8 +192,8 @@ public class MultimapPutTester<K, V> extends AbstractMultimapTester<K, V, Multim
|
|
}
|
|
}
|
|
|
|
- @MapFeature.Require(SUPPORTS_PUT)
|
|
@CollectionSize.Require(absent = ZERO)
|
|
+ @MapFeature.Require(SUPPORTS_PUT)
|
|
public void testPutPresentKeyPropagatesToAsMapEntrySet() {
|
|
List<K> keys = Helpers.copyToList(multimap().keySet());
|
|
for (K key : keys) {
|
|
diff --git a/guava-testlib/src/com/google/common/collect/testing/google/MultimapRemoveAllTester.java b/guava-testlib/src/com/google/common/collect/testing/google/MultimapRemoveAllTester.java
|
|
index 185ba2c206..c8c55569c0 100644
|
|
--- a/guava-testlib/src/com/google/common/collect/testing/google/MultimapRemoveAllTester.java
|
|
+++ b/guava-testlib/src/com/google/common/collect/testing/google/MultimapRemoveAllTester.java
|
|
@@ -76,7 +76,7 @@ public class MultimapRemoveAllTester<K, V> extends AbstractMultimapTester<K, V,
|
|
}
|
|
|
|
@CollectionSize.Require(absent = ZERO)
|
|
- @MapFeature.Require({SUPPORTS_REMOVE, ALLOWS_NULL_KEYS})
|
|
+ @MapFeature.Require({ALLOWS_NULL_KEYS, SUPPORTS_REMOVE})
|
|
public void testRemoveAllNullKeyPresent() {
|
|
initMultimapWithNullKey();
|
|
|
|
@@ -85,7 +85,7 @@ public class MultimapRemoveAllTester<K, V> extends AbstractMultimapTester<K, V,
|
|
expectMissing(Helpers.mapEntry((K) null, getValueForNullKey()));
|
|
}
|
|
|
|
- @MapFeature.Require({SUPPORTS_REMOVE, ALLOWS_ANY_NULL_QUERIES})
|
|
+ @MapFeature.Require({ALLOWS_ANY_NULL_QUERIES, SUPPORTS_REMOVE})
|
|
public void testRemoveAllNullKeyAbsent() {
|
|
assertEmpty(multimap().removeAll(null));
|
|
expectUnchanged();
|
|
diff --git a/guava-testlib/src/com/google/common/collect/testing/google/MultimapRemoveEntryTester.java b/guava-testlib/src/com/google/common/collect/testing/google/MultimapRemoveEntryTester.java
|
|
index 250a691f3f..4606076e6c 100644
|
|
--- a/guava-testlib/src/com/google/common/collect/testing/google/MultimapRemoveEntryTester.java
|
|
+++ b/guava-testlib/src/com/google/common/collect/testing/google/MultimapRemoveEntryTester.java
|
|
@@ -62,7 +62,7 @@ public class MultimapRemoveEntryTester<K, V> extends AbstractMultimapTester<K, V
|
|
}
|
|
|
|
@CollectionSize.Require(absent = ZERO)
|
|
- @MapFeature.Require({SUPPORTS_REMOVE, ALLOWS_NULL_KEYS})
|
|
+ @MapFeature.Require({ALLOWS_NULL_KEYS, SUPPORTS_REMOVE})
|
|
public void testRemoveNullKeyPresent() {
|
|
initMultimapWithNullKey();
|
|
|
|
@@ -73,7 +73,7 @@ public class MultimapRemoveEntryTester<K, V> extends AbstractMultimapTester<K, V
|
|
}
|
|
|
|
@CollectionSize.Require(absent = ZERO)
|
|
- @MapFeature.Require({SUPPORTS_REMOVE, ALLOWS_NULL_VALUES})
|
|
+ @MapFeature.Require({ALLOWS_NULL_VALUES, SUPPORTS_REMOVE})
|
|
public void testRemoveNullValuePresent() {
|
|
initMultimapWithNullValue();
|
|
|
|
@@ -83,13 +83,13 @@ public class MultimapRemoveEntryTester<K, V> extends AbstractMultimapTester<K, V
|
|
assertGet(getKeyForNullValue(), ImmutableList.<V>of());
|
|
}
|
|
|
|
- @MapFeature.Require({SUPPORTS_REMOVE, ALLOWS_NULL_KEY_QUERIES})
|
|
+ @MapFeature.Require({ALLOWS_NULL_KEY_QUERIES, SUPPORTS_REMOVE})
|
|
public void testRemoveNullKeyAbsent() {
|
|
assertFalse(multimap().remove(null, v0()));
|
|
expectUnchanged();
|
|
}
|
|
|
|
- @MapFeature.Require({SUPPORTS_REMOVE, ALLOWS_NULL_VALUE_QUERIES})
|
|
+ @MapFeature.Require({ALLOWS_NULL_VALUE_QUERIES, SUPPORTS_REMOVE})
|
|
public void testRemoveNullValueAbsent() {
|
|
assertFalse(multimap().remove(k0(), null));
|
|
expectUnchanged();
|
|
@@ -117,8 +117,8 @@ public class MultimapRemoveEntryTester<K, V> extends AbstractMultimapTester<K, V
|
|
expectUnchanged();
|
|
}
|
|
|
|
- @MapFeature.Require(SUPPORTS_REMOVE)
|
|
@CollectionSize.Require(absent = ZERO)
|
|
+ @MapFeature.Require(SUPPORTS_REMOVE)
|
|
public void testRemovePropagatesToGet() {
|
|
List<Entry<K, V>> entries = Helpers.copyToList(multimap().entries());
|
|
for (Entry<K, V> entry : entries) {
|
|
@@ -138,8 +138,8 @@ public class MultimapRemoveEntryTester<K, V> extends AbstractMultimapTester<K, V
|
|
}
|
|
}
|
|
|
|
- @MapFeature.Require(SUPPORTS_REMOVE)
|
|
@CollectionSize.Require(absent = ZERO)
|
|
+ @MapFeature.Require(SUPPORTS_REMOVE)
|
|
public void testRemovePropagatesToAsMap() {
|
|
List<Entry<K, V>> entries = Helpers.copyToList(multimap().entries());
|
|
for (Entry<K, V> entry : entries) {
|
|
@@ -159,8 +159,8 @@ public class MultimapRemoveEntryTester<K, V> extends AbstractMultimapTester<K, V
|
|
}
|
|
}
|
|
|
|
- @MapFeature.Require(SUPPORTS_REMOVE)
|
|
@CollectionSize.Require(absent = ZERO)
|
|
+ @MapFeature.Require(SUPPORTS_REMOVE)
|
|
public void testRemovePropagatesToAsMapEntrySet() {
|
|
List<Entry<K, V>> entries = Helpers.copyToList(multimap().entries());
|
|
for (Entry<K, V> entry : entries) {
|
|
diff --git a/guava-testlib/src/com/google/common/collect/testing/google/MultimapReplaceValuesTester.java b/guava-testlib/src/com/google/common/collect/testing/google/MultimapReplaceValuesTester.java
|
|
index 3e2597d8db..5d5b1a7505 100644
|
|
--- a/guava-testlib/src/com/google/common/collect/testing/google/MultimapReplaceValuesTester.java
|
|
+++ b/guava-testlib/src/com/google/common/collect/testing/google/MultimapReplaceValuesTester.java
|
|
@@ -22,6 +22,8 @@ import static com.google.common.collect.testing.features.MapFeature.ALLOWS_NULL_
|
|
import static com.google.common.collect.testing.features.MapFeature.ALLOWS_NULL_VALUES;
|
|
import static com.google.common.collect.testing.features.MapFeature.SUPPORTS_PUT;
|
|
import static com.google.common.collect.testing.features.MapFeature.SUPPORTS_REMOVE;
|
|
+import static java.util.Collections.emptyList;
|
|
+import static java.util.Collections.singletonList;
|
|
|
|
import com.google.common.annotations.GwtCompatible;
|
|
import com.google.common.collect.Multimap;
|
|
@@ -31,7 +33,6 @@ import com.google.common.collect.testing.features.MapFeature;
|
|
import java.util.ArrayList;
|
|
import java.util.Arrays;
|
|
import java.util.Collection;
|
|
-import java.util.Collections;
|
|
import java.util.List;
|
|
import org.junit.Ignore;
|
|
|
|
@@ -45,7 +46,7 @@ import org.junit.Ignore;
|
|
public class MultimapReplaceValuesTester<K, V>
|
|
extends AbstractMultimapTester<K, V, Multimap<K, V>> {
|
|
|
|
- @MapFeature.Require({SUPPORTS_PUT, SUPPORTS_REMOVE, ALLOWS_NULL_VALUES})
|
|
+ @MapFeature.Require({ALLOWS_NULL_VALUES, SUPPORTS_PUT, SUPPORTS_REMOVE})
|
|
public void testReplaceValuesWithNullValue() {
|
|
@SuppressWarnings("unchecked")
|
|
List<V> values = Arrays.asList(v0(), null, v3());
|
|
@@ -53,7 +54,7 @@ public class MultimapReplaceValuesTester<K, V>
|
|
assertGet(k0(), values);
|
|
}
|
|
|
|
- @MapFeature.Require({SUPPORTS_PUT, SUPPORTS_REMOVE, ALLOWS_NULL_KEYS})
|
|
+ @MapFeature.Require({ALLOWS_NULL_KEYS, SUPPORTS_PUT, SUPPORTS_REMOVE})
|
|
public void testReplaceValuesWithNullKey() {
|
|
@SuppressWarnings("unchecked")
|
|
List<V> values = Arrays.asList(v0(), v2(), v3());
|
|
@@ -76,7 +77,7 @@ public class MultimapReplaceValuesTester<K, V>
|
|
int size = multimap().size();
|
|
List<V> oldValues = new ArrayList<>(multimap().get(k0()));
|
|
@SuppressWarnings("unchecked")
|
|
- List<V> values = Collections.emptyList();
|
|
+ List<V> values = emptyList();
|
|
assertEquals(oldValues, new ArrayList<V>(multimap().replaceValues(k0(), values)));
|
|
assertGet(k0());
|
|
assertEquals(size - oldValues.size(), multimap().size());
|
|
@@ -119,10 +120,10 @@ public class MultimapReplaceValuesTester<K, V>
|
|
assertContentsAnyOrder(getCollection, v0(), v2(), v3());
|
|
}
|
|
|
|
- @MapFeature.Require(absent = SUPPORTS_REMOVE)
|
|
@CollectionSize.Require(absent = ZERO)
|
|
+ @MapFeature.Require(absent = SUPPORTS_REMOVE)
|
|
public void testReplaceValuesRemoveNotSupported() {
|
|
- List<V> values = Collections.singletonList(v3());
|
|
+ List<V> values = singletonList(v3());
|
|
try {
|
|
multimap().replaceValues(k0(), values);
|
|
fail("Expected UnsupportedOperationException");
|
|
@@ -133,7 +134,7 @@ public class MultimapReplaceValuesTester<K, V>
|
|
|
|
@MapFeature.Require(absent = SUPPORTS_PUT)
|
|
public void testReplaceValuesPutNotSupported() {
|
|
- List<V> values = Collections.singletonList(v3());
|
|
+ List<V> values = singletonList(v3());
|
|
try {
|
|
multimap().replaceValues(k0(), values);
|
|
fail("Expected UnsupportedOperationException");
|
|
diff --git a/guava-testlib/src/com/google/common/collect/testing/google/MultimapTestSuiteBuilder.java b/guava-testlib/src/com/google/common/collect/testing/google/MultimapTestSuiteBuilder.java
|
|
index af9d261c32..c695687614 100644
|
|
--- a/guava-testlib/src/com/google/common/collect/testing/google/MultimapTestSuiteBuilder.java
|
|
+++ b/guava-testlib/src/com/google/common/collect/testing/google/MultimapTestSuiteBuilder.java
|
|
@@ -18,6 +18,8 @@ package com.google.common.collect.testing.google;
|
|
|
|
import static com.google.common.base.Preconditions.checkArgument;
|
|
import static com.google.common.collect.testing.Helpers.mapEntry;
|
|
+import static java.util.Collections.disjoint;
|
|
+import static java.util.Collections.singleton;
|
|
|
|
import com.google.common.annotations.GwtIncompatible;
|
|
import com.google.common.collect.ImmutableList;
|
|
@@ -44,7 +46,6 @@ import com.google.common.collect.testing.features.MapFeature;
|
|
import com.google.common.testing.SerializableTester;
|
|
import java.util.ArrayList;
|
|
import java.util.Collection;
|
|
-import java.util.Collections;
|
|
import java.util.EnumSet;
|
|
import java.util.HashMap;
|
|
import java.util.HashSet;
|
|
@@ -180,7 +181,7 @@ public class MultimapTestSuiteBuilder<K, V, M extends Multimap<K, V>>
|
|
FeatureSpecificTestSuiteBuilder<?, ? extends OneSizeTestContainerGenerator<M, Entry<K, V>>>
|
|
parentBuilder) {
|
|
Set<Feature<?>> features = computeMultimapAsMapGetFeatures(parentBuilder.getFeatures());
|
|
- if (Collections.disjoint(features, EnumSet.allOf(CollectionSize.class))) {
|
|
+ if (disjoint(features, EnumSet.allOf(CollectionSize.class))) {
|
|
return new TestSuite();
|
|
} else {
|
|
return CollectionTestSuiteBuilder.using(
|
|
@@ -325,7 +326,7 @@ public class MultimapTestSuiteBuilder<K, V, M extends Multimap<K, V>>
|
|
|
|
private Collection<V> createCollection(V v) {
|
|
return ((TestMultimapGenerator<K, V, M>) multimapGenerator.getInnerGenerator())
|
|
- .createCollection(Collections.singleton(v));
|
|
+ .createCollection(singleton(v));
|
|
}
|
|
|
|
@Override
|
|
@@ -357,8 +358,8 @@ public class MultimapTestSuiteBuilder<K, V, M extends Multimap<K, V>>
|
|
return multimapGenerator.create(builder.toArray()).asMap();
|
|
}
|
|
|
|
- @SuppressWarnings("unchecked")
|
|
@Override
|
|
+ @SuppressWarnings("unchecked")
|
|
public Entry<K, Collection<V>>[] createArray(int length) {
|
|
return new Entry[length];
|
|
}
|
|
@@ -387,8 +388,8 @@ public class MultimapTestSuiteBuilder<K, V, M extends Multimap<K, V>>
|
|
.createKeyArray(length);
|
|
}
|
|
|
|
- @SuppressWarnings("unchecked")
|
|
@Override
|
|
+ @SuppressWarnings("unchecked")
|
|
public Collection<V>[] createValueArray(int length) {
|
|
return new Collection[length];
|
|
}
|
|
@@ -417,8 +418,8 @@ public class MultimapTestSuiteBuilder<K, V, M extends Multimap<K, V>>
|
|
return multimapGenerator.create(elements).entries();
|
|
}
|
|
|
|
- @SuppressWarnings("unchecked")
|
|
@Override
|
|
+ @SuppressWarnings("unchecked")
|
|
public Entry<K, V>[] createArray(int length) {
|
|
return new Entry[length];
|
|
}
|
|
@@ -456,8 +457,8 @@ public class MultimapTestSuiteBuilder<K, V, M extends Multimap<K, V>>
|
|
return multimapGenerator.create((Object[]) entries).values();
|
|
}
|
|
|
|
- @SuppressWarnings("unchecked")
|
|
@Override
|
|
+ @SuppressWarnings("unchecked")
|
|
public V[] createArray(int length) {
|
|
return ((TestMultimapGenerator<K, V, M>) multimapGenerator.getInnerGenerator())
|
|
.createValueArray(length);
|
|
@@ -527,8 +528,8 @@ public class MultimapTestSuiteBuilder<K, V, M extends Multimap<K, V>>
|
|
.iterator();
|
|
}
|
|
|
|
- @SuppressWarnings("unchecked")
|
|
@Override
|
|
+ @SuppressWarnings("unchecked")
|
|
public K[] createArray(int length) {
|
|
return ((TestMultimapGenerator<K, V, M>) multimapGenerator.getInnerGenerator())
|
|
.createKeyArray(length);
|
|
diff --git a/guava-testlib/src/com/google/common/collect/testing/google/MultimapToStringTester.java b/guava-testlib/src/com/google/common/collect/testing/google/MultimapToStringTester.java
|
|
index 203f278b7f..6928ca8e9e 100644
|
|
--- a/guava-testlib/src/com/google/common/collect/testing/google/MultimapToStringTester.java
|
|
+++ b/guava-testlib/src/com/google/common/collect/testing/google/MultimapToStringTester.java
|
|
@@ -35,28 +35,28 @@ import org.junit.Ignore;
|
|
@GwtCompatible
|
|
@Ignore // Affects only Android test runner, which respects JUnit 4 annotations on JUnit 3 tests.
|
|
public class MultimapToStringTester<K, V> extends AbstractMultimapTester<K, V, Multimap<K, V>> {
|
|
- @CollectionSize.Require(ZERO)
|
|
@CollectionFeature.Require(absent = NON_STANDARD_TOSTRING)
|
|
+ @CollectionSize.Require(ZERO)
|
|
public void testToStringEmpty() {
|
|
assertEquals("{}", multimap().toString());
|
|
}
|
|
|
|
- @CollectionSize.Require(ONE)
|
|
@CollectionFeature.Require(absent = NON_STANDARD_TOSTRING)
|
|
+ @CollectionSize.Require(ONE)
|
|
public void testToStringSingleton() {
|
|
assertEquals("{" + k0() + "=[" + v0() + "]}", multimap().toString());
|
|
}
|
|
|
|
- @CollectionSize.Require(absent = ZERO)
|
|
@CollectionFeature.Require(absent = NON_STANDARD_TOSTRING)
|
|
+ @CollectionSize.Require(absent = ZERO)
|
|
@MapFeature.Require(ALLOWS_NULL_KEYS)
|
|
public void testToStringWithNullKey() {
|
|
initMultimapWithNullKey();
|
|
testToStringMatchesAsMap();
|
|
}
|
|
|
|
- @CollectionSize.Require(absent = ZERO)
|
|
@CollectionFeature.Require(absent = NON_STANDARD_TOSTRING)
|
|
+ @CollectionSize.Require(absent = ZERO)
|
|
@MapFeature.Require(ALLOWS_NULL_VALUES)
|
|
public void testToStringWithNullValue() {
|
|
initMultimapWithNullValue();
|
|
diff --git a/guava-testlib/src/com/google/common/collect/testing/google/MultisetCountTester.java b/guava-testlib/src/com/google/common/collect/testing/google/MultisetCountTester.java
|
|
index 7c07cd33d0..b5028ab81f 100644
|
|
--- a/guava-testlib/src/com/google/common/collect/testing/google/MultisetCountTester.java
|
|
+++ b/guava-testlib/src/com/google/common/collect/testing/google/MultisetCountTester.java
|
|
@@ -70,8 +70,8 @@ public class MultisetCountTester<E> extends AbstractMultisetTester<E> {
|
|
}
|
|
}
|
|
|
|
- @CollectionSize.Require(absent = ZERO)
|
|
@CollectionFeature.Require(ALLOWS_NULL_VALUES)
|
|
+ @CollectionSize.Require(absent = ZERO)
|
|
public void testCount_nullPresent() {
|
|
initCollectionWithNullElement();
|
|
assertEquals(1, getMultiset().count(null));
|
|
diff --git a/guava-testlib/src/com/google/common/collect/testing/google/MultisetElementSetTester.java b/guava-testlib/src/com/google/common/collect/testing/google/MultisetElementSetTester.java
|
|
index baa6071f84..3d01753014 100644
|
|
--- a/guava-testlib/src/com/google/common/collect/testing/google/MultisetElementSetTester.java
|
|
+++ b/guava-testlib/src/com/google/common/collect/testing/google/MultisetElementSetTester.java
|
|
@@ -21,6 +21,7 @@ import static com.google.common.collect.testing.features.CollectionFeature.SUPPO
|
|
import static com.google.common.collect.testing.features.CollectionFeature.SUPPORTS_REMOVE;
|
|
import static com.google.common.collect.testing.features.CollectionSize.SEVERAL;
|
|
import static com.google.common.collect.testing.features.CollectionSize.ZERO;
|
|
+import static java.util.Collections.singleton;
|
|
|
|
import com.google.common.annotations.GwtCompatible;
|
|
import com.google.common.annotations.GwtIncompatible;
|
|
@@ -29,7 +30,6 @@ import com.google.common.collect.testing.features.CollectionFeature;
|
|
import com.google.common.collect.testing.features.CollectionSize;
|
|
import java.lang.reflect.Method;
|
|
import java.util.Arrays;
|
|
-import java.util.Collections;
|
|
import java.util.List;
|
|
import java.util.Set;
|
|
import org.junit.Ignore;
|
|
@@ -50,17 +50,17 @@ public class MultisetElementSetTester<E> extends AbstractMultisetTester<E> {
|
|
assertTrue(elementSet.contains(e3()));
|
|
}
|
|
|
|
- @CollectionSize.Require(absent = ZERO)
|
|
@CollectionFeature.Require(SUPPORTS_REMOVE)
|
|
+ @CollectionSize.Require(absent = ZERO)
|
|
public void testElementSetReflectsRemove() {
|
|
Set<E> elementSet = getMultiset().elementSet();
|
|
assertTrue(elementSet.contains(e0()));
|
|
- getMultiset().removeAll(Collections.singleton(e0()));
|
|
+ getMultiset().removeAll(singleton(e0()));
|
|
assertFalse(elementSet.contains(e0()));
|
|
}
|
|
|
|
- @CollectionSize.Require(absent = ZERO)
|
|
@CollectionFeature.Require(SUPPORTS_REMOVE)
|
|
+ @CollectionSize.Require(absent = ZERO)
|
|
public void testElementSetRemovePropagatesToMultiset() {
|
|
Set<E> elementSet = getMultiset().elementSet();
|
|
int size = getNumElements();
|
|
@@ -70,8 +70,8 @@ public class MultisetElementSetTester<E> extends AbstractMultisetTester<E> {
|
|
assertEquals(expectedSize, getMultiset().size());
|
|
}
|
|
|
|
- @CollectionSize.Require(SEVERAL)
|
|
@CollectionFeature.Require(SUPPORTS_REMOVE)
|
|
+ @CollectionSize.Require(SEVERAL)
|
|
public void testElementSetRemoveDuplicatePropagatesToMultiset() {
|
|
initThreeCopies();
|
|
int size = getNumElements();
|
|
diff --git a/guava-testlib/src/com/google/common/collect/testing/google/MultisetEntrySetTester.java b/guava-testlib/src/com/google/common/collect/testing/google/MultisetEntrySetTester.java
|
|
index 3bec616aae..0dd7cbf5b2 100644
|
|
--- a/guava-testlib/src/com/google/common/collect/testing/google/MultisetEntrySetTester.java
|
|
+++ b/guava-testlib/src/com/google/common/collect/testing/google/MultisetEntrySetTester.java
|
|
@@ -23,6 +23,7 @@ import static com.google.common.collect.testing.features.CollectionSize.ONE;
|
|
import static com.google.common.collect.testing.features.CollectionSize.SEVERAL;
|
|
import static com.google.common.collect.testing.features.CollectionSize.ZERO;
|
|
import static com.google.common.collect.testing.google.MultisetFeature.ENTRIES_ARE_VIEWS;
|
|
+import static java.util.Collections.singleton;
|
|
|
|
import com.google.common.annotations.GwtCompatible;
|
|
import com.google.common.collect.Iterables;
|
|
@@ -30,7 +31,6 @@ import com.google.common.collect.Multiset;
|
|
import com.google.common.collect.Multisets;
|
|
import com.google.common.collect.testing.features.CollectionFeature;
|
|
import com.google.common.collect.testing.features.CollectionSize;
|
|
-import java.util.Collections;
|
|
import java.util.Iterator;
|
|
import org.junit.Ignore;
|
|
|
|
@@ -49,8 +49,8 @@ public class MultisetEntrySetTester<E> extends AbstractMultisetTester<E> {
|
|
assertTrue("multiset not empty after entrySet().clear()", getMultiset().isEmpty());
|
|
}
|
|
|
|
- @CollectionSize.Require(ONE)
|
|
@CollectionFeature.Require(SUPPORTS_ITERATOR_REMOVE)
|
|
+ @CollectionSize.Require(ONE)
|
|
public void testEntrySet_iteratorRemovePropagates() {
|
|
Iterator<Multiset.Entry<E>> iterator = getMultiset().entrySet().iterator();
|
|
assertTrue(
|
|
@@ -68,8 +68,8 @@ public class MultisetEntrySetTester<E> extends AbstractMultisetTester<E> {
|
|
getMultiset().isEmpty());
|
|
}
|
|
|
|
- @CollectionSize.Require(absent = ZERO)
|
|
@CollectionFeature.Require(SUPPORTS_REMOVE)
|
|
+ @CollectionSize.Require(absent = ZERO)
|
|
public void testEntrySet_removePresent() {
|
|
assertTrue(
|
|
"multiset.entrySet.remove(presentEntry) returned false",
|
|
@@ -77,8 +77,8 @@ public class MultisetEntrySetTester<E> extends AbstractMultisetTester<E> {
|
|
assertFalse("multiset contains element after removing its entry", getMultiset().contains(e0()));
|
|
}
|
|
|
|
- @CollectionSize.Require(absent = ZERO)
|
|
@CollectionFeature.Require(SUPPORTS_REMOVE)
|
|
+ @CollectionSize.Require(absent = ZERO)
|
|
public void testEntrySet_removeAbsent() {
|
|
assertFalse(
|
|
"multiset.entrySet.remove(missingEntry) returned true",
|
|
@@ -88,58 +88,50 @@ public class MultisetEntrySetTester<E> extends AbstractMultisetTester<E> {
|
|
getMultiset().contains(e0()));
|
|
}
|
|
|
|
- @CollectionSize.Require(absent = ZERO)
|
|
@CollectionFeature.Require(SUPPORTS_REMOVE)
|
|
+ @CollectionSize.Require(absent = ZERO)
|
|
public void testEntrySet_removeAllPresent() {
|
|
assertTrue(
|
|
"multiset.entrySet.removeAll(presentEntry) returned false",
|
|
- getMultiset()
|
|
- .entrySet()
|
|
- .removeAll(Collections.singleton(Multisets.immutableEntry(e0(), 1))));
|
|
+ getMultiset().entrySet().removeAll(singleton(Multisets.immutableEntry(e0(), 1))));
|
|
assertFalse("multiset contains element after removing its entry", getMultiset().contains(e0()));
|
|
}
|
|
|
|
- @CollectionSize.Require(absent = ZERO)
|
|
@CollectionFeature.Require(SUPPORTS_REMOVE)
|
|
+ @CollectionSize.Require(absent = ZERO)
|
|
public void testEntrySet_removeAllAbsent() {
|
|
assertFalse(
|
|
"multiset.entrySet.remove(missingEntry) returned true",
|
|
- getMultiset()
|
|
- .entrySet()
|
|
- .removeAll(Collections.singleton(Multisets.immutableEntry(e0(), 2))));
|
|
+ getMultiset().entrySet().removeAll(singleton(Multisets.immutableEntry(e0(), 2))));
|
|
assertTrue(
|
|
"multiset didn't contain element after removing a missing entry",
|
|
getMultiset().contains(e0()));
|
|
}
|
|
|
|
- @CollectionSize.Require(ONE)
|
|
@CollectionFeature.Require(SUPPORTS_REMOVE)
|
|
+ @CollectionSize.Require(ONE)
|
|
public void testEntrySet_retainAllPresent() {
|
|
assertFalse(
|
|
"multiset.entrySet.retainAll(presentEntry) returned false",
|
|
- getMultiset()
|
|
- .entrySet()
|
|
- .retainAll(Collections.singleton(Multisets.immutableEntry(e0(), 1))));
|
|
+ getMultiset().entrySet().retainAll(singleton(Multisets.immutableEntry(e0(), 1))));
|
|
assertTrue(
|
|
"multiset doesn't contains element after retaining its entry",
|
|
getMultiset().contains(e0()));
|
|
}
|
|
|
|
- @CollectionSize.Require(ONE)
|
|
@CollectionFeature.Require(SUPPORTS_REMOVE)
|
|
+ @CollectionSize.Require(ONE)
|
|
public void testEntrySet_retainAllAbsent() {
|
|
assertTrue(
|
|
"multiset.entrySet.retainAll(missingEntry) returned true",
|
|
- getMultiset()
|
|
- .entrySet()
|
|
- .retainAll(Collections.singleton(Multisets.immutableEntry(e0(), 2))));
|
|
+ getMultiset().entrySet().retainAll(singleton(Multisets.immutableEntry(e0(), 2))));
|
|
assertFalse(
|
|
"multiset contains element after retaining a different entry",
|
|
getMultiset().contains(e0()));
|
|
}
|
|
|
|
- @CollectionSize.Require(SEVERAL)
|
|
@CollectionFeature.Require(SUPPORTS_REMOVE)
|
|
+ @CollectionSize.Require(SEVERAL)
|
|
@MultisetFeature.Require(ENTRIES_ARE_VIEWS)
|
|
public void testEntryViewReflectsRemove() {
|
|
initThreeCopies();
|
|
@@ -152,8 +144,8 @@ public class MultisetEntrySetTester<E> extends AbstractMultisetTester<E> {
|
|
assertEquals(0, entry.getCount());
|
|
}
|
|
|
|
- @CollectionSize.Require(SEVERAL)
|
|
@CollectionFeature.Require(SUPPORTS_ITERATOR_REMOVE)
|
|
+ @CollectionSize.Require(SEVERAL)
|
|
@MultisetFeature.Require(ENTRIES_ARE_VIEWS)
|
|
public void testEntryReflectsIteratorRemove() {
|
|
initThreeCopies();
|
|
@@ -171,8 +163,8 @@ public class MultisetEntrySetTester<E> extends AbstractMultisetTester<E> {
|
|
assertEquals(0, entry.getCount());
|
|
}
|
|
|
|
- @CollectionSize.Require(SEVERAL)
|
|
@CollectionFeature.Require(SUPPORTS_REMOVE)
|
|
+ @CollectionSize.Require(SEVERAL)
|
|
@MultisetFeature.Require(ENTRIES_ARE_VIEWS)
|
|
public void testEntryReflectsClear() {
|
|
initThreeCopies();
|
|
@@ -183,8 +175,8 @@ public class MultisetEntrySetTester<E> extends AbstractMultisetTester<E> {
|
|
assertEquals(0, entry.getCount());
|
|
}
|
|
|
|
- @CollectionSize.Require(SEVERAL)
|
|
@CollectionFeature.Require(SUPPORTS_REMOVE)
|
|
+ @CollectionSize.Require(SEVERAL)
|
|
@MultisetFeature.Require(ENTRIES_ARE_VIEWS)
|
|
public void testEntryReflectsEntrySetClear() {
|
|
initThreeCopies();
|
|
@@ -195,8 +187,8 @@ public class MultisetEntrySetTester<E> extends AbstractMultisetTester<E> {
|
|
assertEquals(0, entry.getCount());
|
|
}
|
|
|
|
- @CollectionSize.Require(SEVERAL)
|
|
@CollectionFeature.Require(SUPPORTS_ITERATOR_REMOVE)
|
|
+ @CollectionSize.Require(SEVERAL)
|
|
@MultisetFeature.Require(ENTRIES_ARE_VIEWS)
|
|
public void testEntryReflectsEntrySetIteratorRemove() {
|
|
initThreeCopies();
|
|
@@ -207,8 +199,8 @@ public class MultisetEntrySetTester<E> extends AbstractMultisetTester<E> {
|
|
assertEquals(0, entry.getCount());
|
|
}
|
|
|
|
- @CollectionSize.Require(SEVERAL)
|
|
@CollectionFeature.Require(SUPPORTS_REMOVE)
|
|
+ @CollectionSize.Require(SEVERAL)
|
|
@MultisetFeature.Require(ENTRIES_ARE_VIEWS)
|
|
public void testEntryReflectsElementSetClear() {
|
|
initThreeCopies();
|
|
@@ -219,8 +211,8 @@ public class MultisetEntrySetTester<E> extends AbstractMultisetTester<E> {
|
|
assertEquals(0, entry.getCount());
|
|
}
|
|
|
|
- @CollectionSize.Require(SEVERAL)
|
|
@CollectionFeature.Require(SUPPORTS_ITERATOR_REMOVE)
|
|
+ @CollectionSize.Require(SEVERAL)
|
|
@MultisetFeature.Require(ENTRIES_ARE_VIEWS)
|
|
public void testEntryReflectsElementSetIteratorRemove() {
|
|
initThreeCopies();
|
|
@@ -233,8 +225,8 @@ public class MultisetEntrySetTester<E> extends AbstractMultisetTester<E> {
|
|
assertEquals(0, entry.getCount());
|
|
}
|
|
|
|
+ @CollectionFeature.Require({SUPPORTS_ADD, SUPPORTS_REMOVE})
|
|
@CollectionSize.Require(SEVERAL)
|
|
- @CollectionFeature.Require({SUPPORTS_REMOVE, SUPPORTS_ADD})
|
|
@MultisetFeature.Require(ENTRIES_ARE_VIEWS)
|
|
public void testEntryReflectsRemoveThenAdd() {
|
|
initThreeCopies();
|
|
diff --git a/guava-testlib/src/com/google/common/collect/testing/google/MultisetEqualsTester.java b/guava-testlib/src/com/google/common/collect/testing/google/MultisetEqualsTester.java
|
|
index 9d9fee0a1a..48a65e3eb7 100644
|
|
--- a/guava-testlib/src/com/google/common/collect/testing/google/MultisetEqualsTester.java
|
|
+++ b/guava-testlib/src/com/google/common/collect/testing/google/MultisetEqualsTester.java
|
|
@@ -50,8 +50,8 @@ public class MultisetEqualsTester<E> extends AbstractMultisetTester<E> {
|
|
assertEquals(getMultiset().entrySet().hashCode(), getMultiset().hashCode());
|
|
}
|
|
|
|
- @CollectionSize.Require(absent = ZERO)
|
|
@CollectionFeature.Require(ALLOWS_NULL_VALUES)
|
|
+ @CollectionSize.Require(absent = ZERO)
|
|
public void testEqualsMultisetWithNullValue() {
|
|
new EqualsTester()
|
|
.addEqualityGroup(getMultiset())
|
|
diff --git a/guava-testlib/src/com/google/common/collect/testing/google/MultisetFeature.java b/guava-testlib/src/com/google/common/collect/testing/google/MultisetFeature.java
|
|
index d05c560021..8d741e91d5 100644
|
|
--- a/guava-testlib/src/com/google/common/collect/testing/google/MultisetFeature.java
|
|
+++ b/guava-testlib/src/com/google/common/collect/testing/google/MultisetFeature.java
|
|
@@ -16,6 +16,8 @@
|
|
|
|
package com.google.common.collect.testing.google;
|
|
|
|
+import static java.util.Collections.emptySet;
|
|
+
|
|
import com.google.common.annotations.GwtCompatible;
|
|
import com.google.common.collect.Multiset;
|
|
import com.google.common.collect.testing.features.Feature;
|
|
@@ -23,7 +25,6 @@ import com.google.common.collect.testing.features.TesterAnnotation;
|
|
import java.lang.annotation.Inherited;
|
|
import java.lang.annotation.Retention;
|
|
import java.lang.annotation.RetentionPolicy;
|
|
-import java.util.Collections;
|
|
import java.util.Set;
|
|
|
|
/**
|
|
@@ -41,7 +42,7 @@ public enum MultisetFeature implements Feature<Multiset> {
|
|
|
|
@Override
|
|
public Set<Feature<? super Multiset>> getImpliedFeatures() {
|
|
- return Collections.emptySet();
|
|
+ return emptySet();
|
|
}
|
|
|
|
@Retention(RetentionPolicy.RUNTIME)
|
|
diff --git a/guava-testlib/src/com/google/common/collect/testing/google/MultisetForEachEntryTester.java b/guava-testlib/src/com/google/common/collect/testing/google/MultisetForEachEntryTester.java
|
|
index 50c2ad507a..16ba9472ef 100644
|
|
--- a/guava-testlib/src/com/google/common/collect/testing/google/MultisetForEachEntryTester.java
|
|
+++ b/guava-testlib/src/com/google/common/collect/testing/google/MultisetForEachEntryTester.java
|
|
@@ -17,6 +17,7 @@
|
|
package com.google.common.collect.testing.google;
|
|
|
|
import static com.google.common.collect.testing.features.CollectionFeature.KNOWN_ORDER;
|
|
+import static java.util.Collections.singletonList;
|
|
|
|
import com.google.common.annotations.GwtCompatible;
|
|
import com.google.common.annotations.GwtIncompatible;
|
|
@@ -27,7 +28,6 @@ import com.google.common.collect.testing.features.CollectionFeature;
|
|
import java.lang.reflect.Method;
|
|
import java.util.ArrayList;
|
|
import java.util.Arrays;
|
|
-import java.util.Collections;
|
|
import java.util.List;
|
|
import org.junit.Ignore;
|
|
|
|
@@ -58,7 +58,7 @@ public class MultisetForEachEntryTester<E> extends AbstractMultisetTester<E> {
|
|
|
|
public void testForEachEntryDuplicates() {
|
|
initThreeCopies();
|
|
- List<Entry<E>> expected = Collections.singletonList(Multisets.immutableEntry(e0(), 3));
|
|
+ List<Entry<E>> expected = singletonList(Multisets.immutableEntry(e0(), 3));
|
|
List<Entry<E>> actual = new ArrayList<>();
|
|
getMultiset()
|
|
.forEachEntry((element, count) -> actual.add(Multisets.immutableEntry(element, count)));
|
|
diff --git a/guava-testlib/src/com/google/common/collect/testing/google/MultisetIteratorTester.java b/guava-testlib/src/com/google/common/collect/testing/google/MultisetIteratorTester.java
|
|
index 34a8c72585..7940da3f37 100644
|
|
--- a/guava-testlib/src/com/google/common/collect/testing/google/MultisetIteratorTester.java
|
|
+++ b/guava-testlib/src/com/google/common/collect/testing/google/MultisetIteratorTester.java
|
|
@@ -39,8 +39,8 @@ import org.junit.Ignore;
|
|
@GwtCompatible(emulated = true)
|
|
@Ignore // Affects only Android test runner, which respects JUnit 4 annotations on JUnit 3 tests.
|
|
public class MultisetIteratorTester<E> extends AbstractMultisetTester<E> {
|
|
+ @CollectionFeature.Require({KNOWN_ORDER, SUPPORTS_ITERATOR_REMOVE})
|
|
@SuppressWarnings("unchecked")
|
|
- @CollectionFeature.Require({SUPPORTS_ITERATOR_REMOVE, KNOWN_ORDER})
|
|
public void testRemovingIteratorKnownOrder() {
|
|
new IteratorTester<E>(
|
|
4,
|
|
@@ -54,8 +54,8 @@ public class MultisetIteratorTester<E> extends AbstractMultisetTester<E> {
|
|
}.test();
|
|
}
|
|
|
|
- @SuppressWarnings("unchecked")
|
|
@CollectionFeature.Require(value = SUPPORTS_ITERATOR_REMOVE, absent = KNOWN_ORDER)
|
|
+ @SuppressWarnings("unchecked")
|
|
public void testRemovingIteratorUnknownOrder() {
|
|
new IteratorTester<E>(
|
|
4,
|
|
@@ -69,8 +69,8 @@ public class MultisetIteratorTester<E> extends AbstractMultisetTester<E> {
|
|
}.test();
|
|
}
|
|
|
|
- @SuppressWarnings("unchecked")
|
|
@CollectionFeature.Require(value = KNOWN_ORDER, absent = SUPPORTS_ITERATOR_REMOVE)
|
|
+ @SuppressWarnings("unchecked")
|
|
public void testIteratorKnownOrder() {
|
|
new IteratorTester<E>(
|
|
4,
|
|
@@ -84,8 +84,8 @@ public class MultisetIteratorTester<E> extends AbstractMultisetTester<E> {
|
|
}.test();
|
|
}
|
|
|
|
+ @CollectionFeature.Require(absent = {KNOWN_ORDER, SUPPORTS_ITERATOR_REMOVE})
|
|
@SuppressWarnings("unchecked")
|
|
- @CollectionFeature.Require(absent = {SUPPORTS_ITERATOR_REMOVE, KNOWN_ORDER})
|
|
public void testIteratorUnknownOrder() {
|
|
new IteratorTester<E>(
|
|
4,
|
|
diff --git a/guava-testlib/src/com/google/common/collect/testing/google/MultisetNavigationTester.java b/guava-testlib/src/com/google/common/collect/testing/google/MultisetNavigationTester.java
|
|
index ce8e283a9c..07949eb72a 100644
|
|
--- a/guava-testlib/src/com/google/common/collect/testing/google/MultisetNavigationTester.java
|
|
+++ b/guava-testlib/src/com/google/common/collect/testing/google/MultisetNavigationTester.java
|
|
@@ -22,6 +22,8 @@ import static com.google.common.collect.testing.features.CollectionFeature.SUPPO
|
|
import static com.google.common.collect.testing.features.CollectionSize.ONE;
|
|
import static com.google.common.collect.testing.features.CollectionSize.SEVERAL;
|
|
import static com.google.common.collect.testing.features.CollectionSize.ZERO;
|
|
+import static java.util.Collections.reverse;
|
|
+import static java.util.Collections.singletonList;
|
|
|
|
import com.google.common.annotations.GwtCompatible;
|
|
import com.google.common.collect.BoundType;
|
|
@@ -167,9 +169,9 @@ public class MultisetNavigationTester<E> extends AbstractMultisetTester<E> {
|
|
assertEquals(a, sortedMultiset.firstEntry());
|
|
}
|
|
|
|
- @SuppressWarnings("unchecked")
|
|
@CollectionFeature.Require(SUPPORTS_REMOVE)
|
|
@CollectionSize.Require(SEVERAL)
|
|
+ @SuppressWarnings("unchecked")
|
|
public void testPollFirst() {
|
|
assertEquals(a, sortedMultiset.pollFirstEntry());
|
|
assertEquals(Arrays.asList(b, c), copyToList(sortedMultiset.entrySet()));
|
|
@@ -222,9 +224,9 @@ public class MultisetNavigationTester<E> extends AbstractMultisetTester<E> {
|
|
assertEquals(c, sortedMultiset.lastEntry());
|
|
}
|
|
|
|
- @SuppressWarnings("unchecked")
|
|
@CollectionFeature.Require(SUPPORTS_REMOVE)
|
|
@CollectionSize.Require(SEVERAL)
|
|
+ @SuppressWarnings("unchecked")
|
|
public void testPollLast() {
|
|
assertEquals(c, sortedMultiset.pollLastEntry());
|
|
assertEquals(Arrays.asList(a, b), copyToList(sortedMultiset.entrySet()));
|
|
@@ -246,7 +248,7 @@ public class MultisetNavigationTester<E> extends AbstractMultisetTester<E> {
|
|
Iterators.addAll(ascending, sortedMultiset.entrySet().iterator());
|
|
List<Entry<E>> descending = new ArrayList<>();
|
|
Iterators.addAll(descending, sortedMultiset.descendingMultiset().entrySet().iterator());
|
|
- Collections.reverse(descending);
|
|
+ reverse(descending);
|
|
assertEquals(ascending, descending);
|
|
}
|
|
|
|
@@ -264,7 +266,7 @@ public class MultisetNavigationTester<E> extends AbstractMultisetTester<E> {
|
|
}
|
|
|
|
try {
|
|
- multiset.addAll(Collections.singletonList(entry.getElement()));
|
|
+ multiset.addAll(singletonList(entry.getElement()));
|
|
fail("Expected IllegalArgumentException");
|
|
} catch (IllegalArgumentException expected) {
|
|
}
|
|
@@ -288,14 +290,14 @@ public class MultisetNavigationTester<E> extends AbstractMultisetTester<E> {
|
|
}
|
|
}
|
|
|
|
- @CollectionSize.Require(ONE)
|
|
@CollectionFeature.Require(SUPPORTS_ADD)
|
|
+ @CollectionSize.Require(ONE)
|
|
public void testAddOutOfTailBoundsOne() {
|
|
expectAddFailure(sortedMultiset.tailMultiset(a.getElement(), OPEN), a);
|
|
}
|
|
|
|
- @CollectionSize.Require(SEVERAL)
|
|
@CollectionFeature.Require(SUPPORTS_ADD)
|
|
+ @CollectionSize.Require(SEVERAL)
|
|
public void testAddOutOfTailBoundsSeveral() {
|
|
expectAddFailure(sortedMultiset.tailMultiset(a.getElement(), OPEN), a);
|
|
expectAddFailure(sortedMultiset.tailMultiset(b.getElement(), CLOSED), a);
|
|
@@ -308,14 +310,14 @@ public class MultisetNavigationTester<E> extends AbstractMultisetTester<E> {
|
|
expectAddFailure(sortedMultiset.tailMultiset(c.getElement(), OPEN), c);
|
|
}
|
|
|
|
- @CollectionSize.Require(ONE)
|
|
@CollectionFeature.Require(SUPPORTS_ADD)
|
|
+ @CollectionSize.Require(ONE)
|
|
public void testAddOutOfHeadBoundsOne() {
|
|
expectAddFailure(sortedMultiset.headMultiset(a.getElement(), OPEN), a);
|
|
}
|
|
|
|
- @CollectionSize.Require(SEVERAL)
|
|
@CollectionFeature.Require(SUPPORTS_ADD)
|
|
+ @CollectionSize.Require(SEVERAL)
|
|
public void testAddOutOfHeadBoundsSeveral() {
|
|
expectAddFailure(sortedMultiset.headMultiset(c.getElement(), OPEN), c);
|
|
expectAddFailure(sortedMultiset.headMultiset(b.getElement(), CLOSED), c);
|
|
@@ -328,14 +330,14 @@ public class MultisetNavigationTester<E> extends AbstractMultisetTester<E> {
|
|
expectAddFailure(sortedMultiset.headMultiset(a.getElement(), OPEN), a);
|
|
}
|
|
|
|
- @CollectionSize.Require(ONE)
|
|
@CollectionFeature.Require(SUPPORTS_REMOVE)
|
|
+ @CollectionSize.Require(ONE)
|
|
public void testRemoveOutOfTailBoundsOne() {
|
|
expectRemoveZero(sortedMultiset.tailMultiset(a.getElement(), OPEN), a);
|
|
}
|
|
|
|
- @CollectionSize.Require(SEVERAL)
|
|
@CollectionFeature.Require(SUPPORTS_REMOVE)
|
|
+ @CollectionSize.Require(SEVERAL)
|
|
public void testRemoveOutOfTailBoundsSeveral() {
|
|
expectRemoveZero(sortedMultiset.tailMultiset(a.getElement(), OPEN), a);
|
|
expectRemoveZero(sortedMultiset.tailMultiset(b.getElement(), CLOSED), a);
|
|
@@ -348,14 +350,14 @@ public class MultisetNavigationTester<E> extends AbstractMultisetTester<E> {
|
|
expectRemoveZero(sortedMultiset.tailMultiset(c.getElement(), OPEN), c);
|
|
}
|
|
|
|
- @CollectionSize.Require(ONE)
|
|
@CollectionFeature.Require(SUPPORTS_REMOVE)
|
|
+ @CollectionSize.Require(ONE)
|
|
public void testRemoveOutOfHeadBoundsOne() {
|
|
expectRemoveZero(sortedMultiset.headMultiset(a.getElement(), OPEN), a);
|
|
}
|
|
|
|
- @CollectionSize.Require(SEVERAL)
|
|
@CollectionFeature.Require(SUPPORTS_REMOVE)
|
|
+ @CollectionSize.Require(SEVERAL)
|
|
public void testRemoveOutOfHeadBoundsSeveral() {
|
|
expectRemoveZero(sortedMultiset.headMultiset(c.getElement(), OPEN), c);
|
|
expectRemoveZero(sortedMultiset.headMultiset(b.getElement(), CLOSED), c);
|
|
@@ -368,14 +370,14 @@ public class MultisetNavigationTester<E> extends AbstractMultisetTester<E> {
|
|
expectRemoveZero(sortedMultiset.headMultiset(a.getElement(), OPEN), a);
|
|
}
|
|
|
|
- @CollectionSize.Require(ONE)
|
|
@CollectionFeature.Require({SUPPORTS_ADD, SUPPORTS_REMOVE})
|
|
+ @CollectionSize.Require(ONE)
|
|
public void testSetCountOutOfTailBoundsOne() {
|
|
expectSetCountFailure(sortedMultiset.tailMultiset(a.getElement(), OPEN), a);
|
|
}
|
|
|
|
- @CollectionSize.Require(SEVERAL)
|
|
@CollectionFeature.Require({SUPPORTS_ADD, SUPPORTS_REMOVE})
|
|
+ @CollectionSize.Require(SEVERAL)
|
|
public void testSetCountOutOfTailBoundsSeveral() {
|
|
expectSetCountFailure(sortedMultiset.tailMultiset(a.getElement(), OPEN), a);
|
|
expectSetCountFailure(sortedMultiset.tailMultiset(b.getElement(), CLOSED), a);
|
|
@@ -388,14 +390,14 @@ public class MultisetNavigationTester<E> extends AbstractMultisetTester<E> {
|
|
expectSetCountFailure(sortedMultiset.tailMultiset(c.getElement(), OPEN), c);
|
|
}
|
|
|
|
- @CollectionSize.Require(ONE)
|
|
@CollectionFeature.Require({SUPPORTS_ADD, SUPPORTS_REMOVE})
|
|
+ @CollectionSize.Require(ONE)
|
|
public void testSetCountOutOfHeadBoundsOne() {
|
|
expectSetCountFailure(sortedMultiset.headMultiset(a.getElement(), OPEN), a);
|
|
}
|
|
|
|
- @CollectionSize.Require(SEVERAL)
|
|
@CollectionFeature.Require({SUPPORTS_ADD, SUPPORTS_REMOVE})
|
|
+ @CollectionSize.Require(SEVERAL)
|
|
public void testSetCountOutOfHeadBoundsSeveral() {
|
|
expectSetCountFailure(sortedMultiset.headMultiset(c.getElement(), OPEN), c);
|
|
expectSetCountFailure(sortedMultiset.headMultiset(b.getElement(), CLOSED), c);
|
|
@@ -408,8 +410,8 @@ public class MultisetNavigationTester<E> extends AbstractMultisetTester<E> {
|
|
expectSetCountFailure(sortedMultiset.headMultiset(a.getElement(), OPEN), a);
|
|
}
|
|
|
|
- @CollectionSize.Require(SEVERAL)
|
|
@CollectionFeature.Require(SUPPORTS_ADD)
|
|
+ @CollectionSize.Require(SEVERAL)
|
|
public void testAddWithConflictingBounds() {
|
|
testEmptyRangeSubMultisetSupportingAdd(
|
|
sortedMultiset.subMultiset(a.getElement(), CLOSED, a.getElement(), OPEN));
|
|
@@ -425,8 +427,8 @@ public class MultisetNavigationTester<E> extends AbstractMultisetTester<E> {
|
|
sortedMultiset.subMultiset(b.getElement(), OPEN, a.getElement(), OPEN));
|
|
}
|
|
|
|
- @CollectionSize.Require(SEVERAL)
|
|
@CollectionFeature.Require(SUPPORTS_ADD)
|
|
+ @CollectionSize.Require(SEVERAL)
|
|
public void testConflictingBounds() {
|
|
testEmptyRangeSubMultiset(
|
|
sortedMultiset.subMultiset(a.getElement(), CLOSED, a.getElement(), OPEN));
|
|
@@ -600,8 +602,8 @@ public class MultisetNavigationTester<E> extends AbstractMultisetTester<E> {
|
|
testSubMultisetDistinctElements(SubMultisetSpec.HEAD_OPEN);
|
|
}
|
|
|
|
- @CollectionSize.Require(SEVERAL)
|
|
@CollectionFeature.Require(SUPPORTS_REMOVE)
|
|
+ @CollectionSize.Require(SEVERAL)
|
|
public void testClearTailOpen() {
|
|
List<Entry<E>> expected =
|
|
copyToList(sortedMultiset.headMultiset(b.getElement(), CLOSED).entrySet());
|
|
@@ -609,8 +611,8 @@ public class MultisetNavigationTester<E> extends AbstractMultisetTester<E> {
|
|
assertEquals(expected, copyToList(sortedMultiset.entrySet()));
|
|
}
|
|
|
|
- @CollectionSize.Require(SEVERAL)
|
|
@CollectionFeature.Require(SUPPORTS_REMOVE)
|
|
+ @CollectionSize.Require(SEVERAL)
|
|
public void testClearTailOpenEntrySet() {
|
|
List<Entry<E>> expected =
|
|
copyToList(sortedMultiset.headMultiset(b.getElement(), CLOSED).entrySet());
|
|
@@ -618,8 +620,8 @@ public class MultisetNavigationTester<E> extends AbstractMultisetTester<E> {
|
|
assertEquals(expected, copyToList(sortedMultiset.entrySet()));
|
|
}
|
|
|
|
- @CollectionSize.Require(SEVERAL)
|
|
@CollectionFeature.Require(SUPPORTS_REMOVE)
|
|
+ @CollectionSize.Require(SEVERAL)
|
|
public void testClearTailClosed() {
|
|
List<Entry<E>> expected =
|
|
copyToList(sortedMultiset.headMultiset(b.getElement(), OPEN).entrySet());
|
|
@@ -627,8 +629,8 @@ public class MultisetNavigationTester<E> extends AbstractMultisetTester<E> {
|
|
assertEquals(expected, copyToList(sortedMultiset.entrySet()));
|
|
}
|
|
|
|
- @CollectionSize.Require(SEVERAL)
|
|
@CollectionFeature.Require(SUPPORTS_REMOVE)
|
|
+ @CollectionSize.Require(SEVERAL)
|
|
public void testClearTailClosedEntrySet() {
|
|
List<Entry<E>> expected =
|
|
copyToList(sortedMultiset.headMultiset(b.getElement(), OPEN).entrySet());
|
|
@@ -636,8 +638,8 @@ public class MultisetNavigationTester<E> extends AbstractMultisetTester<E> {
|
|
assertEquals(expected, copyToList(sortedMultiset.entrySet()));
|
|
}
|
|
|
|
- @CollectionSize.Require(SEVERAL)
|
|
@CollectionFeature.Require(SUPPORTS_REMOVE)
|
|
+ @CollectionSize.Require(SEVERAL)
|
|
public void testClearHeadOpen() {
|
|
List<Entry<E>> expected =
|
|
copyToList(sortedMultiset.tailMultiset(b.getElement(), CLOSED).entrySet());
|
|
@@ -645,8 +647,8 @@ public class MultisetNavigationTester<E> extends AbstractMultisetTester<E> {
|
|
assertEquals(expected, copyToList(sortedMultiset.entrySet()));
|
|
}
|
|
|
|
- @CollectionSize.Require(SEVERAL)
|
|
@CollectionFeature.Require(SUPPORTS_REMOVE)
|
|
+ @CollectionSize.Require(SEVERAL)
|
|
public void testClearHeadOpenEntrySet() {
|
|
List<Entry<E>> expected =
|
|
copyToList(sortedMultiset.tailMultiset(b.getElement(), CLOSED).entrySet());
|
|
@@ -654,8 +656,8 @@ public class MultisetNavigationTester<E> extends AbstractMultisetTester<E> {
|
|
assertEquals(expected, copyToList(sortedMultiset.entrySet()));
|
|
}
|
|
|
|
- @CollectionSize.Require(SEVERAL)
|
|
@CollectionFeature.Require(SUPPORTS_REMOVE)
|
|
+ @CollectionSize.Require(SEVERAL)
|
|
public void testClearHeadClosed() {
|
|
List<Entry<E>> expected =
|
|
copyToList(sortedMultiset.tailMultiset(b.getElement(), OPEN).entrySet());
|
|
@@ -663,8 +665,8 @@ public class MultisetNavigationTester<E> extends AbstractMultisetTester<E> {
|
|
assertEquals(expected, copyToList(sortedMultiset.entrySet()));
|
|
}
|
|
|
|
- @CollectionSize.Require(SEVERAL)
|
|
@CollectionFeature.Require(SUPPORTS_REMOVE)
|
|
+ @CollectionSize.Require(SEVERAL)
|
|
public void testClearHeadClosedEntrySet() {
|
|
List<Entry<E>> expected =
|
|
copyToList(sortedMultiset.tailMultiset(b.getElement(), OPEN).entrySet());
|
|
diff --git a/guava-testlib/src/com/google/common/collect/testing/google/MultisetRemoveTester.java b/guava-testlib/src/com/google/common/collect/testing/google/MultisetRemoveTester.java
|
|
index e6594c18a2..97258d8694 100644
|
|
--- a/guava-testlib/src/com/google/common/collect/testing/google/MultisetRemoveTester.java
|
|
+++ b/guava-testlib/src/com/google/common/collect/testing/google/MultisetRemoveTester.java
|
|
@@ -22,6 +22,7 @@ import static com.google.common.collect.testing.features.CollectionFeature.ALLOW
|
|
import static com.google.common.collect.testing.features.CollectionFeature.SUPPORTS_REMOVE;
|
|
import static com.google.common.collect.testing.features.CollectionSize.SEVERAL;
|
|
import static com.google.common.collect.testing.features.CollectionSize.ZERO;
|
|
+import static java.util.Collections.singleton;
|
|
|
|
import com.google.common.annotations.GwtCompatible;
|
|
import com.google.common.annotations.GwtIncompatible;
|
|
@@ -31,7 +32,6 @@ import com.google.common.collect.testing.features.CollectionFeature;
|
|
import com.google.common.collect.testing.features.CollectionSize;
|
|
import java.lang.reflect.Method;
|
|
import java.util.Arrays;
|
|
-import java.util.Collections;
|
|
import java.util.List;
|
|
import org.junit.Ignore;
|
|
|
|
@@ -70,8 +70,8 @@ public class MultisetRemoveTester<E> extends AbstractMultisetTester<E> {
|
|
expectUnchanged();
|
|
}
|
|
|
|
- @CollectionSize.Require(absent = ZERO)
|
|
@CollectionFeature.Require(SUPPORTS_REMOVE)
|
|
+ @CollectionSize.Require(absent = ZERO)
|
|
public void testRemove_occurrences_present() {
|
|
assertEquals(
|
|
"multiset.remove(present, 2) didn't return the old count",
|
|
@@ -83,8 +83,8 @@ public class MultisetRemoveTester<E> extends AbstractMultisetTester<E> {
|
|
assertEquals(0, getMultiset().count(e0()));
|
|
}
|
|
|
|
- @CollectionSize.Require(SEVERAL)
|
|
@CollectionFeature.Require(SUPPORTS_REMOVE)
|
|
+ @CollectionSize.Require(SEVERAL)
|
|
public void testRemove_some_occurrences_present() {
|
|
initThreeCopies();
|
|
assertEquals(
|
|
@@ -142,8 +142,8 @@ public class MultisetRemoveTester<E> extends AbstractMultisetTester<E> {
|
|
getMultiset().remove(WrongType.VALUE, 1));
|
|
}
|
|
|
|
+ @CollectionFeature.Require({ALLOWS_NULL_VALUES, SUPPORTS_REMOVE})
|
|
@CollectionSize.Require(absent = ZERO)
|
|
- @CollectionFeature.Require({SUPPORTS_REMOVE, ALLOWS_NULL_VALUES})
|
|
public void testRemove_nullPresent() {
|
|
initCollectionWithNullElement();
|
|
assertEquals(1, getMultiset().remove(null, 2));
|
|
@@ -153,7 +153,7 @@ public class MultisetRemoveTester<E> extends AbstractMultisetTester<E> {
|
|
assertEquals(0, getMultiset().count(null));
|
|
}
|
|
|
|
- @CollectionFeature.Require({SUPPORTS_REMOVE, ALLOWS_NULL_QUERIES})
|
|
+ @CollectionFeature.Require({ALLOWS_NULL_QUERIES, SUPPORTS_REMOVE})
|
|
public void testRemove_nullAbsent() {
|
|
assertEquals(0, getMultiset().remove(null, 2));
|
|
}
|
|
@@ -167,20 +167,20 @@ public class MultisetRemoveTester<E> extends AbstractMultisetTester<E> {
|
|
}
|
|
}
|
|
|
|
- @CollectionSize.Require(SEVERAL)
|
|
@CollectionFeature.Require(SUPPORTS_REMOVE)
|
|
+ @CollectionSize.Require(SEVERAL)
|
|
public void testRemoveAllIgnoresCount() {
|
|
initThreeCopies();
|
|
- assertTrue(getMultiset().removeAll(Collections.singleton(e0())));
|
|
+ assertTrue(getMultiset().removeAll(singleton(e0())));
|
|
assertEmpty(getMultiset());
|
|
}
|
|
|
|
- @CollectionSize.Require(SEVERAL)
|
|
@CollectionFeature.Require(SUPPORTS_REMOVE)
|
|
+ @CollectionSize.Require(SEVERAL)
|
|
public void testRetainAllIgnoresCount() {
|
|
initThreeCopies();
|
|
List<E> contents = Helpers.copyToList(getMultiset());
|
|
- assertFalse(getMultiset().retainAll(Collections.singleton(e0())));
|
|
+ assertFalse(getMultiset().retainAll(singleton(e0())));
|
|
expectContents(contents);
|
|
}
|
|
|
|
diff --git a/guava-testlib/src/com/google/common/collect/testing/google/MultisetSetCountConditionallyTester.java b/guava-testlib/src/com/google/common/collect/testing/google/MultisetSetCountConditionallyTester.java
|
|
index d5e69638f4..781b6359cb 100644
|
|
--- a/guava-testlib/src/com/google/common/collect/testing/google/MultisetSetCountConditionallyTester.java
|
|
+++ b/guava-testlib/src/com/google/common/collect/testing/google/MultisetSetCountConditionallyTester.java
|
|
@@ -84,8 +84,8 @@ public class MultisetSetCountConditionallyTester<E> extends AbstractMultisetSetC
|
|
expectUnchanged();
|
|
}
|
|
|
|
- @CollectionSize.Require(absent = ZERO)
|
|
@CollectionFeature.Require(SUPPORTS_ADD)
|
|
+ @CollectionSize.Require(absent = ZERO)
|
|
public void testSetCountConditional_oldCountTooSmallZero() {
|
|
assertFalse(
|
|
"setCount() with a too-small oldCount should return false",
|
|
@@ -93,8 +93,8 @@ public class MultisetSetCountConditionallyTester<E> extends AbstractMultisetSetC
|
|
expectUnchanged();
|
|
}
|
|
|
|
- @CollectionSize.Require(SEVERAL)
|
|
@CollectionFeature.Require(SUPPORTS_ADD)
|
|
+ @CollectionSize.Require(SEVERAL)
|
|
public void testSetCountConditional_oldCountTooSmallNonzero() {
|
|
initThreeCopies();
|
|
assertFalse(
|
|
diff --git a/guava-testlib/src/com/google/common/collect/testing/google/MultisetTestSuiteBuilder.java b/guava-testlib/src/com/google/common/collect/testing/google/MultisetTestSuiteBuilder.java
|
|
index 91d7a60e70..87b4b3aaf5 100644
|
|
--- a/guava-testlib/src/com/google/common/collect/testing/google/MultisetTestSuiteBuilder.java
|
|
+++ b/guava-testlib/src/com/google/common/collect/testing/google/MultisetTestSuiteBuilder.java
|
|
@@ -17,6 +17,7 @@
|
|
package com.google.common.collect.testing.google;
|
|
|
|
import static com.google.common.base.Preconditions.checkArgument;
|
|
+import static java.util.Collections.emptySet;
|
|
|
|
import com.google.common.annotations.GwtIncompatible;
|
|
import com.google.common.collect.Multiset;
|
|
@@ -36,7 +37,6 @@ import com.google.common.collect.testing.testers.CollectionSerializationEqualTes
|
|
import com.google.common.testing.SerializableTester;
|
|
import java.util.ArrayList;
|
|
import java.util.Collection;
|
|
-import java.util.Collections;
|
|
import java.util.HashSet;
|
|
import java.util.LinkedHashMap;
|
|
import java.util.LinkedHashSet;
|
|
@@ -64,7 +64,7 @@ public class MultisetTestSuiteBuilder<E>
|
|
|
|
@Override
|
|
public Set<Feature<? super Void>> getImpliedFeatures() {
|
|
- return Collections.emptySet();
|
|
+ return emptySet();
|
|
}
|
|
}
|
|
|
|
@@ -230,8 +230,8 @@ public class MultisetTestSuiteBuilder<E>
|
|
return ((Multiset<E>) gen.create(contents.toArray())).entrySet();
|
|
}
|
|
|
|
- @SuppressWarnings("unchecked")
|
|
@Override
|
|
+ @SuppressWarnings("unchecked")
|
|
public Multiset.Entry<E>[] createArray(int length) {
|
|
return new Multiset.Entry[length];
|
|
}
|
|
diff --git a/guava-testlib/src/com/google/common/collect/testing/google/SetGenerators.java b/guava-testlib/src/com/google/common/collect/testing/google/SetGenerators.java
|
|
index 0b55a2798a..7937f7052d 100644
|
|
--- a/guava-testlib/src/com/google/common/collect/testing/google/SetGenerators.java
|
|
+++ b/guava-testlib/src/com/google/common/collect/testing/google/SetGenerators.java
|
|
@@ -23,6 +23,7 @@ import static com.google.common.collect.testing.SampleElements.Strings.AFTER_LAS
|
|
import static com.google.common.collect.testing.SampleElements.Strings.AFTER_LAST_2;
|
|
import static com.google.common.collect.testing.SampleElements.Strings.BEFORE_FIRST;
|
|
import static com.google.common.collect.testing.SampleElements.Strings.BEFORE_FIRST_2;
|
|
+import static java.util.Collections.reverseOrder;
|
|
import static junit.framework.Assert.assertEquals;
|
|
|
|
import com.google.common.annotations.GwtCompatible;
|
|
@@ -129,8 +130,8 @@ public class SetGenerators {
|
|
public static class DegeneratedImmutableSetGenerator extends TestStringSetGenerator {
|
|
// Make sure we get what we think we're getting, or else this test
|
|
// is pointless
|
|
- @SuppressWarnings("cast")
|
|
@Override
|
|
+ @SuppressWarnings("cast")
|
|
protected Set<String> create(String[] elements) {
|
|
return (ImmutableSet<String>) ImmutableSet.of(elements[0], elements[0]);
|
|
}
|
|
@@ -181,7 +182,7 @@ public class SetGenerators {
|
|
|
|
public static class ImmutableSortedSetExplicitComparator extends TestStringSetGenerator {
|
|
|
|
- private static final Comparator<String> STRING_REVERSED = Collections.reverseOrder();
|
|
+ private static final Comparator<String> STRING_REVERSED = reverseOrder();
|
|
|
|
@Override
|
|
protected SortedSet<String> create(String[] elements) {
|
|
@@ -190,7 +191,7 @@ public class SetGenerators {
|
|
|
|
@Override
|
|
public List<String> order(List<String> insertionOrder) {
|
|
- Collections.sort(insertionOrder, Collections.reverseOrder());
|
|
+ Collections.sort(insertionOrder, reverseOrder());
|
|
return insertionOrder;
|
|
}
|
|
}
|
|
@@ -198,7 +199,7 @@ public class SetGenerators {
|
|
public static class ImmutableSortedSetExplicitSuperclassComparatorGenerator
|
|
extends TestStringSetGenerator {
|
|
|
|
- private static final Comparator<Comparable<?>> COMPARABLE_REVERSED = Collections.reverseOrder();
|
|
+ private static final Comparator<Comparable<?>> COMPARABLE_REVERSED = reverseOrder();
|
|
|
|
@Override
|
|
protected SortedSet<String> create(String[] elements) {
|
|
@@ -207,7 +208,7 @@ public class SetGenerators {
|
|
|
|
@Override
|
|
public List<String> order(List<String> insertionOrder) {
|
|
- Collections.sort(insertionOrder, Collections.reverseOrder());
|
|
+ Collections.sort(insertionOrder, reverseOrder());
|
|
return insertionOrder;
|
|
}
|
|
}
|
|
@@ -223,7 +224,7 @@ public class SetGenerators {
|
|
|
|
@Override
|
|
public List<String> order(List<String> insertionOrder) {
|
|
- Collections.sort(insertionOrder, Collections.reverseOrder());
|
|
+ Collections.sort(insertionOrder, reverseOrder());
|
|
return insertionOrder;
|
|
}
|
|
}
|
|
diff --git a/guava-testlib/src/com/google/common/collect/testing/google/SetMultimapAsMapTester.java b/guava-testlib/src/com/google/common/collect/testing/google/SetMultimapAsMapTester.java
|
|
index 6e79957208..6a20f854cf 100644
|
|
--- a/guava-testlib/src/com/google/common/collect/testing/google/SetMultimapAsMapTester.java
|
|
+++ b/guava-testlib/src/com/google/common/collect/testing/google/SetMultimapAsMapTester.java
|
|
@@ -16,6 +16,8 @@ package com.google.common.collect.testing.google;
|
|
|
|
import static com.google.common.collect.testing.features.CollectionSize.SEVERAL;
|
|
import static com.google.common.collect.testing.features.MapFeature.SUPPORTS_REMOVE;
|
|
+import static java.util.Collections.singleton;
|
|
+import static java.util.Collections.singletonMap;
|
|
|
|
import com.google.common.annotations.GwtCompatible;
|
|
import com.google.common.collect.Maps;
|
|
@@ -27,7 +29,6 @@ import com.google.common.collect.testing.features.MapFeature;
|
|
import com.google.common.testing.EqualsTester;
|
|
import java.util.ArrayList;
|
|
import java.util.Collection;
|
|
-import java.util.Collections;
|
|
import java.util.List;
|
|
import java.util.Map;
|
|
import java.util.Map.Entry;
|
|
@@ -90,8 +91,8 @@ public class SetMultimapAsMapTester<K, V> extends AbstractMultimapTester<K, V, S
|
|
public void testValuesRemove() {
|
|
resetContainer(
|
|
Helpers.mapEntry(k0(), v0()), Helpers.mapEntry(k1(), v0()), Helpers.mapEntry(k0(), v3()));
|
|
- assertTrue(multimap().asMap().values().remove(Collections.singleton(v0())));
|
|
+ assertTrue(multimap().asMap().values().remove(singleton(v0())));
|
|
assertEquals(2, multimap().size());
|
|
- assertEquals(Collections.singletonMap(k0(), Sets.newHashSet(v0(), v3())), multimap().asMap());
|
|
+ assertEquals(singletonMap(k0(), Sets.newHashSet(v0(), v3())), multimap().asMap());
|
|
}
|
|
}
|
|
diff --git a/guava-testlib/src/com/google/common/collect/testing/google/SetMultimapPutTester.java b/guava-testlib/src/com/google/common/collect/testing/google/SetMultimapPutTester.java
|
|
index 7aaf9dce54..65b9e01de3 100644
|
|
--- a/guava-testlib/src/com/google/common/collect/testing/google/SetMultimapPutTester.java
|
|
+++ b/guava-testlib/src/com/google/common/collect/testing/google/SetMultimapPutTester.java
|
|
@@ -39,8 +39,8 @@ import org.junit.Ignore;
|
|
public class SetMultimapPutTester<K, V> extends AbstractMultimapTester<K, V, SetMultimap<K, V>> {
|
|
// Tests for non-duplicate values are in MultimapPutTester
|
|
|
|
- @MapFeature.Require(SUPPORTS_PUT)
|
|
@CollectionSize.Require(absent = ZERO)
|
|
+ @MapFeature.Require(SUPPORTS_PUT)
|
|
public void testPutDuplicateValuePreservesSize() {
|
|
assertFalse(multimap().put(k0(), v0()));
|
|
assertEquals(getNumElements(), multimap().size());
|
|
@@ -64,8 +64,8 @@ public class SetMultimapPutTester<K, V> extends AbstractMultimapTester<K, V, Set
|
|
}
|
|
}
|
|
|
|
- @MapFeature.Require({SUPPORTS_PUT, ALLOWS_NULL_VALUES})
|
|
@CollectionSize.Require(absent = ZERO)
|
|
+ @MapFeature.Require({ALLOWS_NULL_VALUES, SUPPORTS_PUT})
|
|
public void testPutDuplicateValue_null() {
|
|
initMultimapWithNullValue();
|
|
assertFalse(multimap().put(getKeyForNullValue(), null));
|
|
diff --git a/guava-testlib/src/com/google/common/collect/testing/google/SetMultimapTestSuiteBuilder.java b/guava-testlib/src/com/google/common/collect/testing/google/SetMultimapTestSuiteBuilder.java
|
|
index 4368cee9bf..0ea713f501 100644
|
|
--- a/guava-testlib/src/com/google/common/collect/testing/google/SetMultimapTestSuiteBuilder.java
|
|
+++ b/guava-testlib/src/com/google/common/collect/testing/google/SetMultimapTestSuiteBuilder.java
|
|
@@ -16,6 +16,8 @@
|
|
|
|
package com.google.common.collect.testing.google;
|
|
|
|
+import static java.util.Collections.disjoint;
|
|
+
|
|
import com.google.common.annotations.GwtIncompatible;
|
|
import com.google.common.collect.SetMultimap;
|
|
import com.google.common.collect.testing.AbstractTester;
|
|
@@ -26,7 +28,6 @@ import com.google.common.collect.testing.SetTestSuiteBuilder;
|
|
import com.google.common.collect.testing.TestSetGenerator;
|
|
import com.google.common.collect.testing.features.CollectionSize;
|
|
import com.google.common.collect.testing.features.Feature;
|
|
-import java.util.Collections;
|
|
import java.util.EnumSet;
|
|
import java.util.List;
|
|
import java.util.Map.Entry;
|
|
@@ -80,7 +81,7 @@ public class SetMultimapTestSuiteBuilder<K, V>
|
|
?, ? extends OneSizeTestContainerGenerator<SetMultimap<K, V>, Entry<K, V>>>
|
|
parentBuilder) {
|
|
Set<Feature<?>> features = computeMultimapAsMapGetFeatures(parentBuilder.getFeatures());
|
|
- if (Collections.disjoint(features, EnumSet.allOf(CollectionSize.class))) {
|
|
+ if (disjoint(features, EnumSet.allOf(CollectionSize.class))) {
|
|
return new TestSuite();
|
|
} else {
|
|
return SetTestSuiteBuilder.using(
|
|
diff --git a/guava-testlib/src/com/google/common/collect/testing/google/SortedMapGenerators.java b/guava-testlib/src/com/google/common/collect/testing/google/SortedMapGenerators.java
|
|
index 424fbb17ef..1283a012d9 100644
|
|
--- a/guava-testlib/src/com/google/common/collect/testing/google/SortedMapGenerators.java
|
|
+++ b/guava-testlib/src/com/google/common/collect/testing/google/SortedMapGenerators.java
|
|
@@ -76,8 +76,8 @@ public class SortedMapGenerators {
|
|
mapEntry("toaster", -2));
|
|
}
|
|
|
|
- @SuppressWarnings("unchecked")
|
|
@Override
|
|
+ @SuppressWarnings("unchecked")
|
|
public Entry<String, Integer>[] createArray(int length) {
|
|
return new Entry[length];
|
|
}
|
|
diff --git a/guava-testlib/src/com/google/common/collect/testing/google/SortedMultisetTestSuiteBuilder.java b/guava-testlib/src/com/google/common/collect/testing/google/SortedMultisetTestSuiteBuilder.java
|
|
index b44494b81d..740c24f071 100644
|
|
--- a/guava-testlib/src/com/google/common/collect/testing/google/SortedMultisetTestSuiteBuilder.java
|
|
+++ b/guava-testlib/src/com/google/common/collect/testing/google/SortedMultisetTestSuiteBuilder.java
|
|
@@ -20,6 +20,7 @@ import static com.google.common.collect.testing.features.CollectionFeature.KNOWN
|
|
import static com.google.common.collect.testing.features.CollectionFeature.RESTRICTS_ELEMENTS;
|
|
import static com.google.common.collect.testing.features.CollectionFeature.SERIALIZABLE;
|
|
import static com.google.common.collect.testing.features.CollectionFeature.SERIALIZABLE_INCLUDING_VIEWS;
|
|
+import static java.util.Collections.emptySet;
|
|
|
|
import com.google.common.annotations.GwtIncompatible;
|
|
import com.google.common.collect.BoundType;
|
|
@@ -101,7 +102,7 @@ public class SortedMultisetTestSuiteBuilder<E> extends MultisetTestSuiteBuilder<
|
|
|
|
@Override
|
|
public Set<Feature<? super Void>> getImpliedFeatures() {
|
|
- return Collections.emptySet();
|
|
+ return emptySet();
|
|
}
|
|
}
|
|
|
|
diff --git a/guava-testlib/src/com/google/common/collect/testing/google/SortedSetMultimapTestSuiteBuilder.java b/guava-testlib/src/com/google/common/collect/testing/google/SortedSetMultimapTestSuiteBuilder.java
|
|
index 66c5a8ed09..a110aed1b1 100644
|
|
--- a/guava-testlib/src/com/google/common/collect/testing/google/SortedSetMultimapTestSuiteBuilder.java
|
|
+++ b/guava-testlib/src/com/google/common/collect/testing/google/SortedSetMultimapTestSuiteBuilder.java
|
|
@@ -16,6 +16,8 @@
|
|
|
|
package com.google.common.collect.testing.google;
|
|
|
|
+import static java.util.Collections.disjoint;
|
|
+
|
|
import com.google.common.annotations.GwtIncompatible;
|
|
import com.google.common.collect.SetMultimap;
|
|
import com.google.common.collect.testing.AbstractTester;
|
|
@@ -25,7 +27,6 @@ import com.google.common.collect.testing.OneSizeTestContainerGenerator;
|
|
import com.google.common.collect.testing.SortedSetTestSuiteBuilder;
|
|
import com.google.common.collect.testing.features.CollectionSize;
|
|
import com.google.common.collect.testing.features.Feature;
|
|
-import java.util.Collections;
|
|
import java.util.EnumSet;
|
|
import java.util.List;
|
|
import java.util.Map.Entry;
|
|
@@ -82,7 +83,7 @@ public class SortedSetMultimapTestSuiteBuilder<K, V>
|
|
?, ? extends OneSizeTestContainerGenerator<SetMultimap<K, V>, Entry<K, V>>>
|
|
parentBuilder) {
|
|
Set<Feature<?>> features = computeMultimapAsMapGetFeatures(parentBuilder.getFeatures());
|
|
- if (Collections.disjoint(features, EnumSet.allOf(CollectionSize.class))) {
|
|
+ if (disjoint(features, EnumSet.allOf(CollectionSize.class))) {
|
|
return new TestSuite();
|
|
} else {
|
|
return SortedSetTestSuiteBuilder.using(
|
|
diff --git a/guava-testlib/src/com/google/common/collect/testing/google/UnmodifiableCollectionTests.java b/guava-testlib/src/com/google/common/collect/testing/google/UnmodifiableCollectionTests.java
|
|
index 40b2c859d2..cfd17ad666 100644
|
|
--- a/guava-testlib/src/com/google/common/collect/testing/google/UnmodifiableCollectionTests.java
|
|
+++ b/guava-testlib/src/com/google/common/collect/testing/google/UnmodifiableCollectionTests.java
|
|
@@ -16,6 +16,8 @@
|
|
|
|
package com.google.common.collect.testing.google;
|
|
|
|
+import static java.util.Collections.singleton;
|
|
+import static java.util.Collections.unmodifiableList;
|
|
import static junit.framework.TestCase.assertEquals;
|
|
import static junit.framework.TestCase.assertTrue;
|
|
import static junit.framework.TestCase.fail;
|
|
@@ -30,7 +32,6 @@ import com.google.common.collect.Multimap;
|
|
import com.google.common.collect.Multiset;
|
|
import java.util.ArrayList;
|
|
import java.util.Collection;
|
|
-import java.util.Collections;
|
|
import java.util.Iterator;
|
|
import java.util.List;
|
|
import java.util.Map.Entry;
|
|
@@ -265,12 +266,11 @@ public class UnmodifiableCollectionTests {
|
|
*/
|
|
public static <K, V> void assertMultimapIsUnmodifiable(
|
|
Multimap<K, V> multimap, K sampleKey, V sampleValue) {
|
|
- List<Entry<K, V>> originalEntries =
|
|
- Collections.unmodifiableList(Lists.newArrayList(multimap.entries()));
|
|
+ List<Entry<K, V>> originalEntries = unmodifiableList(Lists.newArrayList(multimap.entries()));
|
|
|
|
assertMultimapRemainsUnmodified(multimap, originalEntries);
|
|
|
|
- Collection<V> sampleValueAsCollection = Collections.singleton(sampleValue);
|
|
+ Collection<V> sampleValueAsCollection = singleton(sampleValue);
|
|
|
|
// Test #clear()
|
|
try {
|
|
diff --git a/guava-testlib/src/com/google/common/collect/testing/testers/CollectionAddAllTester.java b/guava-testlib/src/com/google/common/collect/testing/testers/CollectionAddAllTester.java
|
|
index 5c21c9a931..81b127e298 100644
|
|
--- a/guava-testlib/src/com/google/common/collect/testing/testers/CollectionAddAllTester.java
|
|
+++ b/guava-testlib/src/com/google/common/collect/testing/testers/CollectionAddAllTester.java
|
|
@@ -102,7 +102,7 @@ public class CollectionAddAllTester<E> extends AbstractCollectionTester<E> {
|
|
expectUnchanged();
|
|
}
|
|
|
|
- @CollectionFeature.Require({SUPPORTS_ADD, FAILS_FAST_ON_CONCURRENT_MODIFICATION})
|
|
+ @CollectionFeature.Require({FAILS_FAST_ON_CONCURRENT_MODIFICATION, SUPPORTS_ADD})
|
|
@CollectionSize.Require(absent = ZERO)
|
|
public void testAddAllConcurrentWithIteration() {
|
|
try {
|
|
@@ -128,7 +128,7 @@ public class CollectionAddAllTester<E> extends AbstractCollectionTester<E> {
|
|
}
|
|
|
|
@CollectionFeature.Require(
|
|
- value = {SUPPORTS_ADD, ALLOWS_NULL_VALUES},
|
|
+ value = {ALLOWS_NULL_VALUES, SUPPORTS_ADD},
|
|
absent = RESTRICTS_ELEMENTS)
|
|
public void testAddAll_nullSupported() {
|
|
List<E> containsNull = singletonList(null);
|
|
diff --git a/guava-testlib/src/com/google/common/collect/testing/testers/CollectionAddTester.java b/guava-testlib/src/com/google/common/collect/testing/testers/CollectionAddTester.java
|
|
index bed257c976..4c3d01319b 100644
|
|
--- a/guava-testlib/src/com/google/common/collect/testing/testers/CollectionAddTester.java
|
|
+++ b/guava-testlib/src/com/google/common/collect/testing/testers/CollectionAddTester.java
|
|
@@ -72,7 +72,7 @@ public class CollectionAddTester<E> extends AbstractCollectionTester<E> {
|
|
}
|
|
|
|
@CollectionFeature.Require(
|
|
- value = {SUPPORTS_ADD, ALLOWS_NULL_VALUES},
|
|
+ value = {ALLOWS_NULL_VALUES, SUPPORTS_ADD},
|
|
absent = RESTRICTS_ELEMENTS)
|
|
public void testAdd_nullSupported() {
|
|
assertTrue("add(null) should return true", collection.add(null));
|
|
@@ -90,7 +90,7 @@ public class CollectionAddTester<E> extends AbstractCollectionTester<E> {
|
|
expectNullMissingWhenNullUnsupported("Should not contain null after unsupported add(null)");
|
|
}
|
|
|
|
- @CollectionFeature.Require({SUPPORTS_ADD, FAILS_FAST_ON_CONCURRENT_MODIFICATION})
|
|
+ @CollectionFeature.Require({FAILS_FAST_ON_CONCURRENT_MODIFICATION, SUPPORTS_ADD})
|
|
@CollectionSize.Require(absent = ZERO)
|
|
public void testAddConcurrentWithIteration() {
|
|
try {
|
|
diff --git a/guava-testlib/src/com/google/common/collect/testing/testers/CollectionClearTester.java b/guava-testlib/src/com/google/common/collect/testing/testers/CollectionClearTester.java
|
|
index 9b97fff73e..37030781eb 100644
|
|
--- a/guava-testlib/src/com/google/common/collect/testing/testers/CollectionClearTester.java
|
|
+++ b/guava-testlib/src/com/google/common/collect/testing/testers/CollectionClearTester.java
|
|
@@ -69,7 +69,7 @@ public class CollectionClearTester<E> extends AbstractCollectionTester<E> {
|
|
expectUnchanged();
|
|
}
|
|
|
|
- @CollectionFeature.Require({SUPPORTS_REMOVE, FAILS_FAST_ON_CONCURRENT_MODIFICATION})
|
|
+ @CollectionFeature.Require({FAILS_FAST_ON_CONCURRENT_MODIFICATION, SUPPORTS_REMOVE})
|
|
@CollectionSize.Require(SEVERAL)
|
|
public void testClearConcurrentWithIteration() {
|
|
try {
|
|
diff --git a/guava-testlib/src/com/google/common/collect/testing/testers/CollectionRemoveAllTester.java b/guava-testlib/src/com/google/common/collect/testing/testers/CollectionRemoveAllTester.java
|
|
index 0d59097377..ab9ad93aff 100644
|
|
--- a/guava-testlib/src/com/google/common/collect/testing/testers/CollectionRemoveAllTester.java
|
|
+++ b/guava-testlib/src/com/google/common/collect/testing/testers/CollectionRemoveAllTester.java
|
|
@@ -22,6 +22,7 @@ import static com.google.common.collect.testing.features.CollectionFeature.FAILS
|
|
import static com.google.common.collect.testing.features.CollectionFeature.SUPPORTS_REMOVE;
|
|
import static com.google.common.collect.testing.features.CollectionSize.SEVERAL;
|
|
import static com.google.common.collect.testing.features.CollectionSize.ZERO;
|
|
+import static java.util.Collections.singleton;
|
|
|
|
import com.google.common.annotations.GwtCompatible;
|
|
import com.google.common.collect.testing.AbstractCollectionTester;
|
|
@@ -29,7 +30,6 @@ import com.google.common.collect.testing.MinimalCollection;
|
|
import com.google.common.collect.testing.WrongType;
|
|
import com.google.common.collect.testing.features.CollectionFeature;
|
|
import com.google.common.collect.testing.features.CollectionSize;
|
|
-import java.util.Collections;
|
|
import java.util.ConcurrentModificationException;
|
|
import java.util.Iterator;
|
|
import org.junit.Ignore;
|
|
@@ -79,7 +79,7 @@ public class CollectionRemoveAllTester<E> extends AbstractCollectionTester<E> {
|
|
expectMissing(e0());
|
|
}
|
|
|
|
- @CollectionFeature.Require({SUPPORTS_REMOVE, FAILS_FAST_ON_CONCURRENT_MODIFICATION})
|
|
+ @CollectionFeature.Require({FAILS_FAST_ON_CONCURRENT_MODIFICATION, SUPPORTS_REMOVE})
|
|
@CollectionSize.Require(SEVERAL)
|
|
public void testRemoveAllSomePresentConcurrentWithIteration() {
|
|
try {
|
|
@@ -177,20 +177,18 @@ public class CollectionRemoveAllTester<E> extends AbstractCollectionTester<E> {
|
|
expectUnchanged();
|
|
}
|
|
|
|
- @CollectionFeature.Require({SUPPORTS_REMOVE, ALLOWS_NULL_QUERIES})
|
|
+ @CollectionFeature.Require({ALLOWS_NULL_QUERIES, SUPPORTS_REMOVE})
|
|
public void testRemoveAll_containsNullNoButAllowed() {
|
|
MinimalCollection<?> containsNull = MinimalCollection.of((Object) null);
|
|
assertFalse("removeAll(containsNull) should return false", collection.removeAll(containsNull));
|
|
expectUnchanged();
|
|
}
|
|
|
|
- @CollectionFeature.Require({SUPPORTS_REMOVE, ALLOWS_NULL_VALUES})
|
|
+ @CollectionFeature.Require({ALLOWS_NULL_VALUES, SUPPORTS_REMOVE})
|
|
@CollectionSize.Require(absent = ZERO)
|
|
public void testRemoveAll_containsNullYes() {
|
|
initCollectionWithNullElement();
|
|
- assertTrue(
|
|
- "removeAll(containsNull) should return true",
|
|
- collection.removeAll(Collections.singleton(null)));
|
|
+ assertTrue("removeAll(containsNull) should return true", collection.removeAll(singleton(null)));
|
|
// TODO: make this work with MinimalCollection
|
|
}
|
|
|
|
diff --git a/guava-testlib/src/com/google/common/collect/testing/testers/CollectionRemoveIfTester.java b/guava-testlib/src/com/google/common/collect/testing/testers/CollectionRemoveIfTester.java
|
|
index bc0139f841..170aaf3bf8 100644
|
|
--- a/guava-testlib/src/com/google/common/collect/testing/testers/CollectionRemoveIfTester.java
|
|
+++ b/guava-testlib/src/com/google/common/collect/testing/testers/CollectionRemoveIfTester.java
|
|
@@ -64,7 +64,7 @@ public class CollectionRemoveIfTester<E> extends AbstractCollectionTester<E> {
|
|
expectContents();
|
|
}
|
|
|
|
- @CollectionFeature.Require({SUPPORTS_ITERATOR_REMOVE, FAILS_FAST_ON_CONCURRENT_MODIFICATION})
|
|
+ @CollectionFeature.Require({FAILS_FAST_ON_CONCURRENT_MODIFICATION, SUPPORTS_ITERATOR_REMOVE})
|
|
@CollectionSize.Require(SEVERAL)
|
|
public void testRemoveIfSomeMatchesConcurrentWithIteration() {
|
|
try {
|
|
diff --git a/guava-testlib/src/com/google/common/collect/testing/testers/CollectionRemoveTester.java b/guava-testlib/src/com/google/common/collect/testing/testers/CollectionRemoveTester.java
|
|
index 49568fc280..be8e2c02d8 100644
|
|
--- a/guava-testlib/src/com/google/common/collect/testing/testers/CollectionRemoveTester.java
|
|
+++ b/guava-testlib/src/com/google/common/collect/testing/testers/CollectionRemoveTester.java
|
|
@@ -54,7 +54,7 @@ public class CollectionRemoveTester<E> extends AbstractCollectionTester<E> {
|
|
expectMissing(e0());
|
|
}
|
|
|
|
- @CollectionFeature.Require({SUPPORTS_REMOVE, FAILS_FAST_ON_CONCURRENT_MODIFICATION})
|
|
+ @CollectionFeature.Require({FAILS_FAST_ON_CONCURRENT_MODIFICATION, SUPPORTS_REMOVE})
|
|
@CollectionSize.Require(SEVERAL)
|
|
public void testRemovePresentConcurrentWithIteration() {
|
|
try {
|
|
@@ -73,7 +73,7 @@ public class CollectionRemoveTester<E> extends AbstractCollectionTester<E> {
|
|
expectUnchanged();
|
|
}
|
|
|
|
- @CollectionFeature.Require({SUPPORTS_REMOVE, ALLOWS_NULL_VALUES})
|
|
+ @CollectionFeature.Require({ALLOWS_NULL_VALUES, SUPPORTS_REMOVE})
|
|
@CollectionSize.Require(absent = ZERO)
|
|
public void testRemove_nullPresent() {
|
|
collection = getSubjectGenerator().create(createArrayWithNullElement());
|
|
@@ -122,7 +122,7 @@ public class CollectionRemoveTester<E> extends AbstractCollectionTester<E> {
|
|
expectUnchanged();
|
|
}
|
|
|
|
- @CollectionFeature.Require({SUPPORTS_REMOVE, ALLOWS_NULL_QUERIES})
|
|
+ @CollectionFeature.Require({ALLOWS_NULL_QUERIES, SUPPORTS_REMOVE})
|
|
public void testRemove_nullAllowed() {
|
|
assertFalse("remove(null) should return false", collection.remove(null));
|
|
expectUnchanged();
|
|
diff --git a/guava-testlib/src/com/google/common/collect/testing/testers/CollectionRetainAllTester.java b/guava-testlib/src/com/google/common/collect/testing/testers/CollectionRetainAllTester.java
|
|
index db7aef1392..1d5c1b5dc5 100644
|
|
--- a/guava-testlib/src/com/google/common/collect/testing/testers/CollectionRetainAllTester.java
|
|
+++ b/guava-testlib/src/com/google/common/collect/testing/testers/CollectionRetainAllTester.java
|
|
@@ -169,14 +169,14 @@ public class CollectionRetainAllTester<E> extends AbstractCollectionTester<E> {
|
|
// retainAll(subset)
|
|
|
|
@CollectionFeature.Require(SUPPORTS_REMOVE)
|
|
- @CollectionSize.Require(absent = {ZERO, ONE})
|
|
+ @CollectionSize.Require(absent = {ONE, ZERO})
|
|
public void testRetainAll_subset() {
|
|
expectReturnsTrue(nonEmptyProperSubset);
|
|
expectContents(nonEmptyProperSubset.toRetain);
|
|
}
|
|
|
|
@CollectionFeature.Require(absent = SUPPORTS_REMOVE)
|
|
- @CollectionSize.Require(absent = {ZERO, ONE})
|
|
+ @CollectionSize.Require(absent = {ONE, ZERO})
|
|
public void testRetainAll_subsetUnsupported() {
|
|
expectThrows(nonEmptyProperSubset);
|
|
expectUnchanged();
|
|
@@ -199,14 +199,14 @@ public class CollectionRetainAllTester<E> extends AbstractCollectionTester<E> {
|
|
// retainAll(partialOverlap)
|
|
|
|
@CollectionFeature.Require(SUPPORTS_REMOVE)
|
|
- @CollectionSize.Require(absent = {ZERO, ONE})
|
|
+ @CollectionSize.Require(absent = {ONE, ZERO})
|
|
public void testRetainAll_partialOverlap() {
|
|
expectReturnsTrue(partialOverlap);
|
|
expectContents(e2());
|
|
}
|
|
|
|
@CollectionFeature.Require(absent = SUPPORTS_REMOVE)
|
|
- @CollectionSize.Require(absent = {ZERO, ONE})
|
|
+ @CollectionSize.Require(absent = {ONE, ZERO})
|
|
public void testRetainAll_partialOverlapUnsupported() {
|
|
expectThrows(partialOverlap);
|
|
expectUnchanged();
|
|
@@ -222,7 +222,7 @@ public class CollectionRetainAllTester<E> extends AbstractCollectionTester<E> {
|
|
}
|
|
|
|
@CollectionFeature.Require(SUPPORTS_REMOVE)
|
|
- @CollectionSize.Require(absent = {ZERO, ONE})
|
|
+ @CollectionSize.Require(absent = {ONE, ZERO})
|
|
public void testRetainAll_containsDuplicatesSizeSeveral() {
|
|
expectReturnsTrue(containsDuplicates);
|
|
expectContents(e0());
|
|
@@ -244,7 +244,7 @@ public class CollectionRetainAllTester<E> extends AbstractCollectionTester<E> {
|
|
expectContents();
|
|
}
|
|
|
|
- @CollectionFeature.Require({SUPPORTS_REMOVE, ALLOWS_NULL_VALUES})
|
|
+ @CollectionFeature.Require({ALLOWS_NULL_VALUES, SUPPORTS_REMOVE})
|
|
@CollectionSize.Require(ONE)
|
|
public void testRetainAll_nullSingletonPreviouslySingletonWithNull() {
|
|
initCollectionWithNullElement();
|
|
@@ -252,8 +252,8 @@ public class CollectionRetainAllTester<E> extends AbstractCollectionTester<E> {
|
|
expectContents(createArrayWithNullElement());
|
|
}
|
|
|
|
- @CollectionFeature.Require({SUPPORTS_REMOVE, ALLOWS_NULL_VALUES})
|
|
- @CollectionSize.Require(absent = {ZERO, ONE})
|
|
+ @CollectionFeature.Require({ALLOWS_NULL_VALUES, SUPPORTS_REMOVE})
|
|
+ @CollectionSize.Require(absent = {ONE, ZERO})
|
|
public void testRetainAll_nullSingletonPreviouslySeveralWithNull() {
|
|
initCollectionWithNullElement();
|
|
expectReturnsTrue(nullSingleton);
|
|
@@ -262,7 +262,7 @@ public class CollectionRetainAllTester<E> extends AbstractCollectionTester<E> {
|
|
|
|
// nullSingleton.retainAll()
|
|
|
|
- @CollectionFeature.Require({SUPPORTS_REMOVE, ALLOWS_NULL_VALUES})
|
|
+ @CollectionFeature.Require({ALLOWS_NULL_VALUES, SUPPORTS_REMOVE})
|
|
@CollectionSize.Require(absent = ZERO)
|
|
public void testRetainAll_containsNonNullWithNull() {
|
|
initCollectionWithNullElement();
|
|
diff --git a/guava-testlib/src/com/google/common/collect/testing/testers/CollectionToStringTester.java b/guava-testlib/src/com/google/common/collect/testing/testers/CollectionToStringTester.java
|
|
index f138ccfa91..232fa4c475 100644
|
|
--- a/guava-testlib/src/com/google/common/collect/testing/testers/CollectionToStringTester.java
|
|
+++ b/guava-testlib/src/com/google/common/collect/testing/testers/CollectionToStringTester.java
|
|
@@ -43,14 +43,14 @@ public class CollectionToStringTester<E> extends AbstractCollectionTester<E> {
|
|
assertNotNull("toString() should not return null", collection.toString());
|
|
}
|
|
|
|
- @CollectionSize.Require(ZERO)
|
|
@CollectionFeature.Require(absent = NON_STANDARD_TOSTRING)
|
|
+ @CollectionSize.Require(ZERO)
|
|
public void testToString_size0() {
|
|
assertEquals("emptyCollection.toString should return []", "[]", collection.toString());
|
|
}
|
|
|
|
- @CollectionSize.Require(ONE)
|
|
@CollectionFeature.Require(absent = NON_STANDARD_TOSTRING)
|
|
+ @CollectionSize.Require(ONE)
|
|
public void testToString_size1() {
|
|
assertEquals(
|
|
"size1Collection.toString should return [{element}]",
|
|
@@ -58,15 +58,15 @@ public class CollectionToStringTester<E> extends AbstractCollectionTester<E> {
|
|
collection.toString());
|
|
}
|
|
|
|
- @CollectionSize.Require(SEVERAL)
|
|
@CollectionFeature.Require(value = KNOWN_ORDER, absent = NON_STANDARD_TOSTRING)
|
|
+ @CollectionSize.Require(SEVERAL)
|
|
public void testToString_sizeSeveral() {
|
|
String expected = Helpers.copyToList(getOrderedElements()).toString();
|
|
assertEquals("collection.toString() incorrect", expected, collection.toString());
|
|
}
|
|
|
|
- @CollectionSize.Require(absent = ZERO)
|
|
@CollectionFeature.Require(ALLOWS_NULL_VALUES)
|
|
+ @CollectionSize.Require(absent = ZERO)
|
|
public void testToString_null() {
|
|
initCollectionWithNullElement();
|
|
testToString_minimal();
|
|
diff --git a/guava-testlib/src/com/google/common/collect/testing/testers/ConcurrentMapPutIfAbsentTester.java b/guava-testlib/src/com/google/common/collect/testing/testers/ConcurrentMapPutIfAbsentTester.java
|
|
index 6cf5be2327..b287460601 100644
|
|
--- a/guava-testlib/src/com/google/common/collect/testing/testers/ConcurrentMapPutIfAbsentTester.java
|
|
+++ b/guava-testlib/src/com/google/common/collect/testing/testers/ConcurrentMapPutIfAbsentTester.java
|
|
@@ -50,8 +50,8 @@ public class ConcurrentMapPutIfAbsentTester<K, V> extends AbstractMapTester<K, V
|
|
expectAdded(e3());
|
|
}
|
|
|
|
- @MapFeature.Require(SUPPORTS_PUT)
|
|
@CollectionSize.Require(absent = ZERO)
|
|
+ @MapFeature.Require(SUPPORTS_PUT)
|
|
public void testPutIfAbsent_supportedPresent() {
|
|
assertEquals(
|
|
"putIfAbsent(present, value) should return existing value",
|
|
@@ -71,8 +71,8 @@ public class ConcurrentMapPutIfAbsentTester<K, V> extends AbstractMapTester<K, V
|
|
expectMissing(e3());
|
|
}
|
|
|
|
- @MapFeature.Require(absent = SUPPORTS_PUT)
|
|
@CollectionSize.Require(absent = ZERO)
|
|
+ @MapFeature.Require(absent = SUPPORTS_PUT)
|
|
public void testPutIfAbsent_unsupportedPresentExistingValue() {
|
|
try {
|
|
assertEquals(
|
|
@@ -84,8 +84,8 @@ public class ConcurrentMapPutIfAbsentTester<K, V> extends AbstractMapTester<K, V
|
|
expectUnchanged();
|
|
}
|
|
|
|
- @MapFeature.Require(absent = SUPPORTS_PUT)
|
|
@CollectionSize.Require(absent = ZERO)
|
|
+ @MapFeature.Require(absent = SUPPORTS_PUT)
|
|
public void testPutIfAbsent_unsupportedPresentDifferentValue() {
|
|
try {
|
|
getMap().putIfAbsent(k0(), v3());
|
|
@@ -118,8 +118,8 @@ public class ConcurrentMapPutIfAbsentTester<K, V> extends AbstractMapTester<K, V
|
|
"Should not contain null value after unsupported put(key, null)");
|
|
}
|
|
|
|
- @MapFeature.Require(value = SUPPORTS_PUT, absent = ALLOWS_NULL_VALUES)
|
|
@CollectionSize.Require(absent = ZERO)
|
|
+ @MapFeature.Require(value = SUPPORTS_PUT, absent = ALLOWS_NULL_VALUES)
|
|
public void testPutIfAbsent_putWithNullValueUnsupported() {
|
|
try {
|
|
getMap().putIfAbsent(k0(), null);
|
|
diff --git a/guava-testlib/src/com/google/common/collect/testing/testers/ConcurrentMapRemoveTester.java b/guava-testlib/src/com/google/common/collect/testing/testers/ConcurrentMapRemoveTester.java
|
|
index 87cc319b3b..e098a8b612 100644
|
|
--- a/guava-testlib/src/com/google/common/collect/testing/testers/ConcurrentMapRemoveTester.java
|
|
+++ b/guava-testlib/src/com/google/common/collect/testing/testers/ConcurrentMapRemoveTester.java
|
|
@@ -42,8 +42,8 @@ public class ConcurrentMapRemoveTester<K, V> extends AbstractMapTester<K, V> {
|
|
return (ConcurrentMap<K, V>) super.getMap();
|
|
}
|
|
|
|
- @MapFeature.Require(SUPPORTS_REMOVE)
|
|
@CollectionSize.Require(absent = ZERO)
|
|
+ @MapFeature.Require(SUPPORTS_REMOVE)
|
|
public void testRemove_supportedPresent() {
|
|
assertTrue(getMap().remove(k0(), v0()));
|
|
expectMissing(e0());
|
|
@@ -87,8 +87,8 @@ public class ConcurrentMapRemoveTester<K, V> extends AbstractMapTester<K, V> {
|
|
expectUnchanged();
|
|
}
|
|
|
|
- @MapFeature.Require(absent = SUPPORTS_REMOVE)
|
|
@CollectionSize.Require(absent = ZERO)
|
|
+ @MapFeature.Require(absent = SUPPORTS_REMOVE)
|
|
public void testRemove_unsupportedPresent() {
|
|
try {
|
|
getMap().remove(k0(), v0());
|
|
diff --git a/guava-testlib/src/com/google/common/collect/testing/testers/ConcurrentMapReplaceEntryTester.java b/guava-testlib/src/com/google/common/collect/testing/testers/ConcurrentMapReplaceEntryTester.java
|
|
index 57f631cd8b..eb4cb98f57 100644
|
|
--- a/guava-testlib/src/com/google/common/collect/testing/testers/ConcurrentMapReplaceEntryTester.java
|
|
+++ b/guava-testlib/src/com/google/common/collect/testing/testers/ConcurrentMapReplaceEntryTester.java
|
|
@@ -43,22 +43,22 @@ public class ConcurrentMapReplaceEntryTester<K, V> extends AbstractMapTester<K,
|
|
return (ConcurrentMap<K, V>) super.getMap();
|
|
}
|
|
|
|
- @MapFeature.Require(SUPPORTS_PUT)
|
|
@CollectionSize.Require(absent = ZERO)
|
|
+ @MapFeature.Require(SUPPORTS_PUT)
|
|
public void testReplaceEntry_supportedPresent() {
|
|
assertTrue(getMap().replace(k0(), v0(), v3()));
|
|
expectReplacement(entry(k0(), v3()));
|
|
}
|
|
|
|
- @MapFeature.Require(SUPPORTS_PUT)
|
|
@CollectionSize.Require(absent = ZERO)
|
|
+ @MapFeature.Require(SUPPORTS_PUT)
|
|
public void testReplaceEntry_supportedPresentUnchanged() {
|
|
assertTrue(getMap().replace(k0(), v0(), v0()));
|
|
expectUnchanged();
|
|
}
|
|
|
|
- @MapFeature.Require(SUPPORTS_PUT)
|
|
@CollectionSize.Require(absent = ZERO)
|
|
+ @MapFeature.Require(SUPPORTS_PUT)
|
|
public void testReplaceEntry_supportedWrongValue() {
|
|
assertFalse(getMap().replace(k0(), v3(), v4()));
|
|
expectUnchanged();
|
|
@@ -70,8 +70,8 @@ public class ConcurrentMapReplaceEntryTester<K, V> extends AbstractMapTester<K,
|
|
expectUnchanged();
|
|
}
|
|
|
|
- @MapFeature.Require(value = SUPPORTS_PUT, absent = ALLOWS_NULL_VALUES)
|
|
@CollectionSize.Require(absent = ZERO)
|
|
+ @MapFeature.Require(value = SUPPORTS_PUT, absent = ALLOWS_NULL_VALUES)
|
|
public void testReplaceEntry_presentNullValueUnsupported() {
|
|
try {
|
|
getMap().replace(k0(), v0(), null);
|
|
@@ -81,8 +81,8 @@ public class ConcurrentMapReplaceEntryTester<K, V> extends AbstractMapTester<K,
|
|
expectUnchanged();
|
|
}
|
|
|
|
- @MapFeature.Require(value = SUPPORTS_PUT, absent = ALLOWS_NULL_VALUE_QUERIES)
|
|
@CollectionSize.Require(absent = ZERO)
|
|
+ @MapFeature.Require(value = SUPPORTS_PUT, absent = ALLOWS_NULL_VALUE_QUERIES)
|
|
public void testReplaceEntry_wrongValueNullValueUnsupported() {
|
|
try {
|
|
assertFalse(getMap().replace(k0(), v3(), null));
|
|
@@ -102,7 +102,7 @@ public class ConcurrentMapReplaceEntryTester<K, V> extends AbstractMapTester<K,
|
|
expectUnchanged();
|
|
}
|
|
|
|
- @MapFeature.Require({SUPPORTS_PUT, ALLOWS_NULL_VALUE_QUERIES})
|
|
+ @MapFeature.Require({ALLOWS_NULL_VALUE_QUERIES, SUPPORTS_PUT})
|
|
public void testReplaceEntry_nullDifferentFromAbsent() {
|
|
assertFalse(getMap().replace(k3(), null, v3()));
|
|
expectUnchanged();
|
|
@@ -118,8 +118,8 @@ public class ConcurrentMapReplaceEntryTester<K, V> extends AbstractMapTester<K,
|
|
expectUnchanged();
|
|
}
|
|
|
|
- @MapFeature.Require(absent = SUPPORTS_PUT)
|
|
@CollectionSize.Require(absent = ZERO)
|
|
+ @MapFeature.Require(absent = SUPPORTS_PUT)
|
|
public void testReplaceEntry_unsupportedPresent() {
|
|
try {
|
|
getMap().replace(k0(), v0(), v3());
|
|
@@ -129,8 +129,8 @@ public class ConcurrentMapReplaceEntryTester<K, V> extends AbstractMapTester<K,
|
|
expectUnchanged();
|
|
}
|
|
|
|
- @MapFeature.Require(absent = SUPPORTS_PUT)
|
|
@CollectionSize.Require(absent = ZERO)
|
|
+ @MapFeature.Require(absent = SUPPORTS_PUT)
|
|
public void testReplaceEntry_unsupportedWrongValue() {
|
|
try {
|
|
getMap().replace(k0(), v3(), v4());
|
|
diff --git a/guava-testlib/src/com/google/common/collect/testing/testers/ConcurrentMapReplaceTester.java b/guava-testlib/src/com/google/common/collect/testing/testers/ConcurrentMapReplaceTester.java
|
|
index f0bc164472..1a50f895f6 100644
|
|
--- a/guava-testlib/src/com/google/common/collect/testing/testers/ConcurrentMapReplaceTester.java
|
|
+++ b/guava-testlib/src/com/google/common/collect/testing/testers/ConcurrentMapReplaceTester.java
|
|
@@ -44,15 +44,15 @@ public class ConcurrentMapReplaceTester<K, V> extends AbstractMapTester<K, V> {
|
|
return (ConcurrentMap<K, V>) super.getMap();
|
|
}
|
|
|
|
- @MapFeature.Require(SUPPORTS_PUT)
|
|
@CollectionSize.Require(absent = ZERO)
|
|
+ @MapFeature.Require(SUPPORTS_PUT)
|
|
public void testReplace_supportedPresent() {
|
|
assertEquals(v0(), getMap().replace(k0(), v3()));
|
|
expectReplacement(entry(k0(), v3()));
|
|
}
|
|
|
|
- @MapFeature.Require(SUPPORTS_PUT)
|
|
@CollectionSize.Require(absent = ZERO)
|
|
+ @MapFeature.Require(SUPPORTS_PUT)
|
|
public void testReplace_supportedPresentNoChange() {
|
|
assertEquals(v0(), getMap().replace(k0(), v0()));
|
|
expectUnchanged();
|
|
@@ -64,8 +64,8 @@ public class ConcurrentMapReplaceTester<K, V> extends AbstractMapTester<K, V> {
|
|
expectUnchanged();
|
|
}
|
|
|
|
- @MapFeature.Require(value = SUPPORTS_PUT, absent = ALLOWS_NULL_VALUES)
|
|
@CollectionSize.Require(absent = ZERO)
|
|
+ @MapFeature.Require(value = SUPPORTS_PUT, absent = ALLOWS_NULL_VALUES)
|
|
public void testReplace_presentNullValueUnsupported() {
|
|
try {
|
|
getMap().replace(k0(), null);
|
|
@@ -95,8 +95,8 @@ public class ConcurrentMapReplaceTester<K, V> extends AbstractMapTester<K, V> {
|
|
expectUnchanged();
|
|
}
|
|
|
|
- @MapFeature.Require(absent = SUPPORTS_PUT)
|
|
@CollectionSize.Require(absent = ZERO)
|
|
+ @MapFeature.Require(absent = SUPPORTS_PUT)
|
|
public void testReplace_unsupportedPresent() {
|
|
try {
|
|
getMap().replace(k0(), v3());
|
|
diff --git a/guava-testlib/src/com/google/common/collect/testing/testers/ListAddAllAtIndexTester.java b/guava-testlib/src/com/google/common/collect/testing/testers/ListAddAllAtIndexTester.java
|
|
index c3e338f1a4..cf8fcad8ef 100644
|
|
--- a/guava-testlib/src/com/google/common/collect/testing/testers/ListAddAllAtIndexTester.java
|
|
+++ b/guava-testlib/src/com/google/common/collect/testing/testers/ListAddAllAtIndexTester.java
|
|
@@ -40,8 +40,8 @@ import org.junit.Ignore;
|
|
@GwtCompatible
|
|
@Ignore // Affects only Android test runner, which respects JUnit 4 annotations on JUnit 3 tests.
|
|
public class ListAddAllAtIndexTester<E> extends AbstractListTester<E> {
|
|
- @ListFeature.Require(SUPPORTS_ADD_WITH_INDEX)
|
|
@CollectionSize.Require(absent = ZERO)
|
|
+ @ListFeature.Require(SUPPORTS_ADD_WITH_INDEX)
|
|
public void testAddAllAtIndex_supportedAllPresent() {
|
|
assertTrue(
|
|
"addAll(n, allPresent) should return true",
|
|
@@ -49,8 +49,8 @@ public class ListAddAllAtIndexTester<E> extends AbstractListTester<E> {
|
|
expectAdded(0, e0());
|
|
}
|
|
|
|
- @ListFeature.Require(absent = SUPPORTS_ADD_WITH_INDEX)
|
|
@CollectionSize.Require(absent = ZERO)
|
|
+ @ListFeature.Require(absent = SUPPORTS_ADD_WITH_INDEX)
|
|
public void testAddAllAtIndex_unsupportedAllPresent() {
|
|
try {
|
|
getList().addAll(0, MinimalCollection.of(e0()));
|
|
@@ -60,8 +60,8 @@ public class ListAddAllAtIndexTester<E> extends AbstractListTester<E> {
|
|
expectUnchanged();
|
|
}
|
|
|
|
- @ListFeature.Require(SUPPORTS_ADD_WITH_INDEX)
|
|
@CollectionSize.Require(absent = ZERO)
|
|
+ @ListFeature.Require(SUPPORTS_ADD_WITH_INDEX)
|
|
public void testAddAllAtIndex_supportedSomePresent() {
|
|
assertTrue(
|
|
"addAll(n, allPresent) should return true",
|
|
@@ -69,8 +69,8 @@ public class ListAddAllAtIndexTester<E> extends AbstractListTester<E> {
|
|
expectAdded(0, e0(), e3());
|
|
}
|
|
|
|
- @ListFeature.Require(absent = SUPPORTS_ADD_WITH_INDEX)
|
|
@CollectionSize.Require(absent = ZERO)
|
|
+ @ListFeature.Require(absent = SUPPORTS_ADD_WITH_INDEX)
|
|
public void testAddAllAtIndex_unsupportedSomePresent() {
|
|
try {
|
|
getList().addAll(0, MinimalCollection.of(e0(), e3()));
|
|
@@ -105,8 +105,8 @@ public class ListAddAllAtIndexTester<E> extends AbstractListTester<E> {
|
|
expectAdded(0, e0(), e1(), e0(), e1());
|
|
}
|
|
|
|
- @ListFeature.Require(SUPPORTS_ADD_WITH_INDEX)
|
|
@CollectionFeature.Require(ALLOWS_NULL_VALUES)
|
|
+ @ListFeature.Require(SUPPORTS_ADD_WITH_INDEX)
|
|
public void testAddAllAtIndex_nullSupported() {
|
|
List<E> containsNull = singletonList(null);
|
|
assertTrue("addAll(n, containsNull) should return true", getList().addAll(0, containsNull));
|
|
@@ -117,8 +117,8 @@ public class ListAddAllAtIndexTester<E> extends AbstractListTester<E> {
|
|
expectAdded(0, (E) null);
|
|
}
|
|
|
|
- @ListFeature.Require(SUPPORTS_ADD_WITH_INDEX)
|
|
@CollectionFeature.Require(absent = ALLOWS_NULL_VALUES)
|
|
+ @ListFeature.Require(SUPPORTS_ADD_WITH_INDEX)
|
|
public void testAddAllAtIndex_nullUnsupported() {
|
|
List<E> containsNull = singletonList(null);
|
|
try {
|
|
@@ -131,8 +131,8 @@ public class ListAddAllAtIndexTester<E> extends AbstractListTester<E> {
|
|
"Should not contain null after unsupported addAll(n, containsNull)");
|
|
}
|
|
|
|
+ @CollectionSize.Require(absent = {ONE, ZERO})
|
|
@ListFeature.Require(SUPPORTS_ADD_WITH_INDEX)
|
|
- @CollectionSize.Require(absent = {ZERO, ONE})
|
|
public void testAddAllAtIndex_middle() {
|
|
assertTrue(
|
|
"addAll(middle, disjoint) should return true",
|
|
@@ -140,8 +140,8 @@ public class ListAddAllAtIndexTester<E> extends AbstractListTester<E> {
|
|
expectAdded(getNumElements() / 2, createDisjointCollection());
|
|
}
|
|
|
|
- @ListFeature.Require(SUPPORTS_ADD_WITH_INDEX)
|
|
@CollectionSize.Require(absent = ZERO)
|
|
+ @ListFeature.Require(SUPPORTS_ADD_WITH_INDEX)
|
|
public void testAddAllAtIndex_end() {
|
|
assertTrue(
|
|
"addAll(end, disjoint) should return true",
|
|
diff --git a/guava-testlib/src/com/google/common/collect/testing/testers/ListAddAtIndexTester.java b/guava-testlib/src/com/google/common/collect/testing/testers/ListAddAtIndexTester.java
|
|
index 32310b8d38..c474b17d57 100644
|
|
--- a/guava-testlib/src/com/google/common/collect/testing/testers/ListAddAtIndexTester.java
|
|
+++ b/guava-testlib/src/com/google/common/collect/testing/testers/ListAddAtIndexTester.java
|
|
@@ -43,15 +43,15 @@ import org.junit.Ignore;
|
|
@GwtCompatible(emulated = true)
|
|
@Ignore // Affects only Android test runner, which respects JUnit 4 annotations on JUnit 3 tests.
|
|
public class ListAddAtIndexTester<E> extends AbstractListTester<E> {
|
|
- @ListFeature.Require(SUPPORTS_ADD_WITH_INDEX)
|
|
@CollectionSize.Require(absent = ZERO)
|
|
+ @ListFeature.Require(SUPPORTS_ADD_WITH_INDEX)
|
|
public void testAddAtIndex_supportedPresent() {
|
|
getList().add(0, e0());
|
|
expectAdded(0, e0());
|
|
}
|
|
|
|
- @ListFeature.Require(absent = SUPPORTS_ADD_WITH_INDEX)
|
|
@CollectionSize.Require(absent = ZERO)
|
|
+ @ListFeature.Require(absent = SUPPORTS_ADD_WITH_INDEX)
|
|
/*
|
|
* absent = ZERO isn't required, since unmodList.add() must
|
|
* throw regardless, but it keeps the method name accurate.
|
|
@@ -95,29 +95,29 @@ public class ListAddAtIndexTester<E> extends AbstractListTester<E> {
|
|
expectMissing(e3());
|
|
}
|
|
|
|
+ @CollectionSize.Require(absent = {ONE, ZERO})
|
|
@ListFeature.Require(SUPPORTS_ADD_WITH_INDEX)
|
|
- @CollectionSize.Require(absent = {ZERO, ONE})
|
|
public void testAddAtIndex_middle() {
|
|
getList().add(getNumElements() / 2, e3());
|
|
expectAdded(getNumElements() / 2, e3());
|
|
}
|
|
|
|
- @ListFeature.Require(SUPPORTS_ADD_WITH_INDEX)
|
|
@CollectionSize.Require(absent = ZERO)
|
|
+ @ListFeature.Require(SUPPORTS_ADD_WITH_INDEX)
|
|
public void testAddAtIndex_end() {
|
|
getList().add(getNumElements(), e3());
|
|
expectAdded(getNumElements(), e3());
|
|
}
|
|
|
|
- @ListFeature.Require(SUPPORTS_ADD_WITH_INDEX)
|
|
@CollectionFeature.Require(ALLOWS_NULL_VALUES)
|
|
+ @ListFeature.Require(SUPPORTS_ADD_WITH_INDEX)
|
|
public void testAddAtIndex_nullSupported() {
|
|
getList().add(0, null);
|
|
expectAdded(0, (E) null);
|
|
}
|
|
|
|
- @ListFeature.Require(SUPPORTS_ADD_WITH_INDEX)
|
|
@CollectionFeature.Require(absent = ALLOWS_NULL_VALUES)
|
|
+ @ListFeature.Require(SUPPORTS_ADD_WITH_INDEX)
|
|
public void testAddAtIndex_nullUnsupported() {
|
|
try {
|
|
getList().add(0, null);
|
|
diff --git a/guava-testlib/src/com/google/common/collect/testing/testers/ListAddTester.java b/guava-testlib/src/com/google/common/collect/testing/testers/ListAddTester.java
|
|
index 8559d3464d..9aed7261f2 100644
|
|
--- a/guava-testlib/src/com/google/common/collect/testing/testers/ListAddTester.java
|
|
+++ b/guava-testlib/src/com/google/common/collect/testing/testers/ListAddTester.java
|
|
@@ -60,7 +60,7 @@ public class ListAddTester<E> extends AbstractListTester<E> {
|
|
}
|
|
}
|
|
|
|
- @CollectionFeature.Require(value = {SUPPORTS_ADD, ALLOWS_NULL_VALUES})
|
|
+ @CollectionFeature.Require({ALLOWS_NULL_VALUES, SUPPORTS_ADD})
|
|
@CollectionSize.Require(absent = ZERO)
|
|
public void testAdd_supportedNullPresent() {
|
|
E[] array = createArrayWithNullElement();
|
|
diff --git a/guava-testlib/src/com/google/common/collect/testing/testers/ListCreationTester.java b/guava-testlib/src/com/google/common/collect/testing/testers/ListCreationTester.java
|
|
index 9d0b77ab2d..9e17e75b7b 100644
|
|
--- a/guava-testlib/src/com/google/common/collect/testing/testers/ListCreationTester.java
|
|
+++ b/guava-testlib/src/com/google/common/collect/testing/testers/ListCreationTester.java
|
|
@@ -36,7 +36,7 @@ import org.junit.Ignore;
|
|
@Ignore // Affects only Android test runner, which respects JUnit 4 annotations on JUnit 3 tests.
|
|
public class ListCreationTester<E> extends AbstractListTester<E> {
|
|
@CollectionFeature.Require(absent = REJECTS_DUPLICATES_AT_CREATION)
|
|
- @CollectionSize.Require(absent = {ZERO, ONE})
|
|
+ @CollectionSize.Require(absent = {ONE, ZERO})
|
|
public void testCreateWithDuplicates() {
|
|
E[] array = createSamplesArray();
|
|
array[1] = e0();
|
|
diff --git a/guava-testlib/src/com/google/common/collect/testing/testers/ListEqualsTester.java b/guava-testlib/src/com/google/common/collect/testing/testers/ListEqualsTester.java
|
|
index 3a09586f80..c5a837ca66 100644
|
|
--- a/guava-testlib/src/com/google/common/collect/testing/testers/ListEqualsTester.java
|
|
+++ b/guava-testlib/src/com/google/common/collect/testing/testers/ListEqualsTester.java
|
|
@@ -59,8 +59,8 @@ public class ListEqualsTester<E> extends AbstractListTester<E> {
|
|
getList().equals(other));
|
|
}
|
|
|
|
- @CollectionSize.Require(absent = CollectionSize.ZERO)
|
|
@CollectionFeature.Require(ALLOWS_NULL_VALUES)
|
|
+ @CollectionSize.Require(absent = CollectionSize.ZERO)
|
|
public void testEquals_containingNull() {
|
|
ArrayList<E> elements = new ArrayList<>(getSampleElements());
|
|
elements.set(elements.size() / 2, null);
|
|
diff --git a/guava-testlib/src/com/google/common/collect/testing/testers/ListIndexOfTester.java b/guava-testlib/src/com/google/common/collect/testing/testers/ListIndexOfTester.java
|
|
index 7afb8c8281..c3443859cc 100644
|
|
--- a/guava-testlib/src/com/google/common/collect/testing/testers/ListIndexOfTester.java
|
|
+++ b/guava-testlib/src/com/google/common/collect/testing/testers/ListIndexOfTester.java
|
|
@@ -45,7 +45,7 @@ public class ListIndexOfTester<E> extends AbstractListIndexOfTester<E> {
|
|
}
|
|
|
|
@CollectionFeature.Require(absent = REJECTS_DUPLICATES_AT_CREATION)
|
|
- @CollectionSize.Require(absent = {ZERO, ONE})
|
|
+ @CollectionSize.Require(absent = {ONE, ZERO})
|
|
public void testIndexOf_duplicate() {
|
|
E[] array = createSamplesArray();
|
|
array[getNumElements() / 2] = e0();
|
|
diff --git a/guava-testlib/src/com/google/common/collect/testing/testers/ListLastIndexOfTester.java b/guava-testlib/src/com/google/common/collect/testing/testers/ListLastIndexOfTester.java
|
|
index 19f7f1e123..ec3148eba6 100644
|
|
--- a/guava-testlib/src/com/google/common/collect/testing/testers/ListLastIndexOfTester.java
|
|
+++ b/guava-testlib/src/com/google/common/collect/testing/testers/ListLastIndexOfTester.java
|
|
@@ -45,7 +45,7 @@ public class ListLastIndexOfTester<E> extends AbstractListIndexOfTester<E> {
|
|
}
|
|
|
|
@CollectionFeature.Require(absent = REJECTS_DUPLICATES_AT_CREATION)
|
|
- @CollectionSize.Require(absent = {ZERO, ONE})
|
|
+ @CollectionSize.Require(absent = {ONE, ZERO})
|
|
public void testLastIndexOf_duplicate() {
|
|
E[] array = createSamplesArray();
|
|
array[getNumElements() / 2] = e0();
|
|
diff --git a/guava-testlib/src/com/google/common/collect/testing/testers/ListListIteratorTester.java b/guava-testlib/src/com/google/common/collect/testing/testers/ListListIteratorTester.java
|
|
index 0d4b13e684..64c723cbd7 100644
|
|
--- a/guava-testlib/src/com/google/common/collect/testing/testers/ListListIteratorTester.java
|
|
+++ b/guava-testlib/src/com/google/common/collect/testing/testers/ListListIteratorTester.java
|
|
@@ -49,7 +49,7 @@ import org.junit.Ignore;
|
|
@Ignore // Affects only Android test runner, which respects JUnit 4 annotations on JUnit 3 tests.
|
|
public class ListListIteratorTester<E> extends AbstractListTester<E> {
|
|
@CollectionFeature.Require(absent = SUPPORTS_REMOVE)
|
|
- @ListFeature.Require(absent = {SUPPORTS_SET, SUPPORTS_ADD_WITH_INDEX})
|
|
+ @ListFeature.Require(absent = {SUPPORTS_ADD_WITH_INDEX, SUPPORTS_SET})
|
|
public void testListIterator_unmodifiable() {
|
|
runListIteratorTest(UNMODIFIABLE);
|
|
}
|
|
@@ -59,7 +59,7 @@ public class ListListIteratorTester<E> extends AbstractListTester<E> {
|
|
* modification operations.
|
|
*/
|
|
@CollectionFeature.Require(SUPPORTS_REMOVE)
|
|
- @ListFeature.Require({SUPPORTS_SET, SUPPORTS_ADD_WITH_INDEX})
|
|
+ @ListFeature.Require({SUPPORTS_ADD_WITH_INDEX, SUPPORTS_SET})
|
|
public void testListIterator_fullyModifiable() {
|
|
runListIteratorTest(MODIFIABLE);
|
|
}
|
|
diff --git a/guava-testlib/src/com/google/common/collect/testing/testers/ListRemoveAllTester.java b/guava-testlib/src/com/google/common/collect/testing/testers/ListRemoveAllTester.java
|
|
index 513134cd44..90f141b7b5 100644
|
|
--- a/guava-testlib/src/com/google/common/collect/testing/testers/ListRemoveAllTester.java
|
|
+++ b/guava-testlib/src/com/google/common/collect/testing/testers/ListRemoveAllTester.java
|
|
@@ -37,7 +37,7 @@ import org.junit.Ignore;
|
|
@Ignore // Affects only Android test runner, which respects JUnit 4 annotations on JUnit 3 tests.
|
|
public class ListRemoveAllTester<E> extends AbstractListTester<E> {
|
|
@CollectionFeature.Require(SUPPORTS_REMOVE)
|
|
- @CollectionSize.Require(absent = {ZERO, ONE})
|
|
+ @CollectionSize.Require(absent = {ONE, ZERO})
|
|
public void testRemoveAll_duplicate() {
|
|
ArrayWithDuplicate<E> arrayAndDuplicate = createArrayWithDuplicateElement();
|
|
collection = getSubjectGenerator().create(arrayAndDuplicate.elements);
|
|
diff --git a/guava-testlib/src/com/google/common/collect/testing/testers/ListRemoveAtIndexTester.java b/guava-testlib/src/com/google/common/collect/testing/testers/ListRemoveAtIndexTester.java
|
|
index 9714251527..f7e5e74666 100644
|
|
--- a/guava-testlib/src/com/google/common/collect/testing/testers/ListRemoveAtIndexTester.java
|
|
+++ b/guava-testlib/src/com/google/common/collect/testing/testers/ListRemoveAtIndexTester.java
|
|
@@ -40,8 +40,8 @@ import org.junit.Ignore;
|
|
@GwtCompatible
|
|
@Ignore // Affects only Android test runner, which respects JUnit 4 annotations on JUnit 3 tests.
|
|
public class ListRemoveAtIndexTester<E> extends AbstractListTester<E> {
|
|
- @ListFeature.Require(absent = SUPPORTS_REMOVE_WITH_INDEX)
|
|
@CollectionSize.Require(absent = ZERO)
|
|
+ @ListFeature.Require(absent = SUPPORTS_REMOVE_WITH_INDEX)
|
|
public void testRemoveAtIndex_unsupported() {
|
|
try {
|
|
getList().remove(0);
|
|
@@ -71,21 +71,21 @@ public class ListRemoveAtIndexTester<E> extends AbstractListTester<E> {
|
|
expectUnchanged();
|
|
}
|
|
|
|
- @ListFeature.Require(SUPPORTS_REMOVE_WITH_INDEX)
|
|
@CollectionSize.Require(absent = ZERO)
|
|
+ @ListFeature.Require(SUPPORTS_REMOVE_WITH_INDEX)
|
|
public void testRemoveAtIndex_first() {
|
|
runRemoveTest(0);
|
|
}
|
|
|
|
+ @CollectionSize.Require(absent = {ONE, ZERO})
|
|
@ListFeature.Require(SUPPORTS_REMOVE_WITH_INDEX)
|
|
- @CollectionSize.Require(absent = {ZERO, ONE})
|
|
public void testRemoveAtIndex_middle() {
|
|
runRemoveTest(getNumElements() / 2);
|
|
}
|
|
|
|
@CollectionFeature.Require(FAILS_FAST_ON_CONCURRENT_MODIFICATION)
|
|
- @ListFeature.Require(SUPPORTS_REMOVE_WITH_INDEX)
|
|
@CollectionSize.Require(absent = ZERO)
|
|
+ @ListFeature.Require(SUPPORTS_REMOVE_WITH_INDEX)
|
|
public void testRemoveAtIndexConcurrentWithIteration() {
|
|
try {
|
|
Iterator<E> iterator = collection.iterator();
|
|
@@ -97,8 +97,8 @@ public class ListRemoveAtIndexTester<E> extends AbstractListTester<E> {
|
|
}
|
|
}
|
|
|
|
- @ListFeature.Require(SUPPORTS_REMOVE_WITH_INDEX)
|
|
@CollectionSize.Require(absent = ZERO)
|
|
+ @ListFeature.Require(SUPPORTS_REMOVE_WITH_INDEX)
|
|
public void testRemoveAtIndex_last() {
|
|
runRemoveTest(getNumElements() - 1);
|
|
}
|
|
diff --git a/guava-testlib/src/com/google/common/collect/testing/testers/ListRemoveTester.java b/guava-testlib/src/com/google/common/collect/testing/testers/ListRemoveTester.java
|
|
index 9c2c688aba..8b117fb565 100644
|
|
--- a/guava-testlib/src/com/google/common/collect/testing/testers/ListRemoveTester.java
|
|
+++ b/guava-testlib/src/com/google/common/collect/testing/testers/ListRemoveTester.java
|
|
@@ -35,7 +35,7 @@ import org.junit.Ignore;
|
|
@Ignore // Affects only Android test runner, which respects JUnit 4 annotations on JUnit 3 tests.
|
|
public class ListRemoveTester<E> extends AbstractListTester<E> {
|
|
@CollectionFeature.Require(SUPPORTS_REMOVE)
|
|
- @CollectionSize.Require(absent = {ZERO, ONE})
|
|
+ @CollectionSize.Require(absent = {ONE, ZERO})
|
|
public void testRemove_duplicate() {
|
|
ArrayWithDuplicate<E> arrayAndDuplicate = createArrayWithDuplicateElement();
|
|
collection = getSubjectGenerator().create(arrayAndDuplicate.elements);
|
|
diff --git a/guava-testlib/src/com/google/common/collect/testing/testers/ListRetainAllTester.java b/guava-testlib/src/com/google/common/collect/testing/testers/ListRetainAllTester.java
|
|
index 96bd3b4004..655f398b73 100644
|
|
--- a/guava-testlib/src/com/google/common/collect/testing/testers/ListRetainAllTester.java
|
|
+++ b/guava-testlib/src/com/google/common/collect/testing/testers/ListRetainAllTester.java
|
|
@@ -39,7 +39,7 @@ import org.junit.Ignore;
|
|
@Ignore // Affects only Android test runner, which respects JUnit 4 annotations on JUnit 3 tests.
|
|
public class ListRetainAllTester<E> extends AbstractListTester<E> {
|
|
@CollectionFeature.Require(SUPPORTS_REMOVE)
|
|
- @CollectionSize.Require(absent = {ZERO, ONE})
|
|
+ @CollectionSize.Require(absent = {ONE, ZERO})
|
|
public void testRetainAll_duplicatesKept() {
|
|
E[] array = createSamplesArray();
|
|
array[1] = e0();
|
|
@@ -50,9 +50,9 @@ public class ListRetainAllTester<E> extends AbstractListTester<E> {
|
|
expectContents(array);
|
|
}
|
|
|
|
- @SuppressWarnings("unchecked")
|
|
@CollectionFeature.Require(SUPPORTS_REMOVE)
|
|
@CollectionSize.Require(SEVERAL)
|
|
+ @SuppressWarnings("unchecked")
|
|
public void testRetainAll_duplicatesRemoved() {
|
|
E[] array = createSamplesArray();
|
|
array[1] = e0();
|
|
@@ -63,9 +63,9 @@ public class ListRetainAllTester<E> extends AbstractListTester<E> {
|
|
expectContents(e2());
|
|
}
|
|
|
|
- @SuppressWarnings("unchecked")
|
|
@CollectionFeature.Require(SUPPORTS_REMOVE)
|
|
@CollectionSize.Require(SEVERAL)
|
|
+ @SuppressWarnings("unchecked")
|
|
public void testRetainAll_countIgnored() {
|
|
resetContainer(getSubjectGenerator().create(e0(), e2(), e1(), e0()));
|
|
assertTrue(getList().retainAll(Arrays.asList(e0(), e1())));
|
|
diff --git a/guava-testlib/src/com/google/common/collect/testing/testers/ListSetTester.java b/guava-testlib/src/com/google/common/collect/testing/testers/ListSetTester.java
|
|
index 844f1b4d60..924a7605aa 100644
|
|
--- a/guava-testlib/src/com/google/common/collect/testing/testers/ListSetTester.java
|
|
+++ b/guava-testlib/src/com/google/common/collect/testing/testers/ListSetTester.java
|
|
@@ -38,21 +38,21 @@ import org.junit.Ignore;
|
|
@GwtCompatible(emulated = true)
|
|
@Ignore // Affects only Android test runner, which respects JUnit 4 annotations on JUnit 3 tests.
|
|
public class ListSetTester<E> extends AbstractListTester<E> {
|
|
- @ListFeature.Require(SUPPORTS_SET)
|
|
@CollectionSize.Require(absent = ZERO)
|
|
+ @ListFeature.Require(SUPPORTS_SET)
|
|
public void testSet() {
|
|
doTestSet(e3());
|
|
}
|
|
|
|
- @CollectionSize.Require(absent = ZERO)
|
|
@CollectionFeature.Require(ALLOWS_NULL_VALUES)
|
|
+ @CollectionSize.Require(absent = ZERO)
|
|
@ListFeature.Require(SUPPORTS_SET)
|
|
public void testSet_null() {
|
|
doTestSet(null);
|
|
}
|
|
|
|
- @CollectionSize.Require(absent = ZERO)
|
|
@CollectionFeature.Require(ALLOWS_NULL_VALUES)
|
|
+ @CollectionSize.Require(absent = ZERO)
|
|
@ListFeature.Require(SUPPORTS_SET)
|
|
public void testSet_replacingNull() {
|
|
E[] elements = createSamplesArray();
|
|
@@ -117,9 +117,9 @@ public class ListSetTester<E> extends AbstractListTester<E> {
|
|
expectUnchanged();
|
|
}
|
|
|
|
+ @CollectionFeature.Require(absent = ALLOWS_NULL_VALUES)
|
|
@CollectionSize.Require(absent = ZERO)
|
|
@ListFeature.Require(SUPPORTS_SET)
|
|
- @CollectionFeature.Require(absent = ALLOWS_NULL_VALUES)
|
|
public void testSet_nullUnsupported() {
|
|
try {
|
|
getList().set(aValidIndex(), null);
|
|
diff --git a/guava-testlib/src/com/google/common/collect/testing/testers/ListSubListTester.java b/guava-testlib/src/com/google/common/collect/testing/testers/ListSubListTester.java
|
|
index 553b693584..bef134e93c 100644
|
|
--- a/guava-testlib/src/com/google/common/collect/testing/testers/ListSubListTester.java
|
|
+++ b/guava-testlib/src/com/google/common/collect/testing/testers/ListSubListTester.java
|
|
@@ -24,6 +24,7 @@ import static com.google.common.collect.testing.features.ListFeature.SUPPORTS_AD
|
|
import static com.google.common.collect.testing.features.ListFeature.SUPPORTS_REMOVE_WITH_INDEX;
|
|
import static com.google.common.collect.testing.features.ListFeature.SUPPORTS_SET;
|
|
import static java.util.Collections.emptyList;
|
|
+import static java.util.Collections.singletonList;
|
|
|
|
import com.google.common.annotations.GwtCompatible;
|
|
import com.google.common.annotations.GwtIncompatible;
|
|
@@ -34,7 +35,6 @@ import com.google.common.collect.testing.features.ListFeature;
|
|
import com.google.common.testing.SerializableTester;
|
|
import java.lang.reflect.Method;
|
|
import java.util.Arrays;
|
|
-import java.util.Collections;
|
|
import java.util.List;
|
|
import java.util.concurrent.CopyOnWriteArrayList;
|
|
import org.junit.Ignore;
|
|
@@ -91,8 +91,8 @@ public class ListSubListTester<E> extends AbstractListTester<E> {
|
|
getList().subList(0, getNumElements()));
|
|
}
|
|
|
|
- @ListFeature.Require(SUPPORTS_REMOVE_WITH_INDEX)
|
|
@CollectionSize.Require(absent = ZERO)
|
|
+ @ListFeature.Require(SUPPORTS_REMOVE_WITH_INDEX)
|
|
public void testSubList_subListRemoveAffectsOriginal() {
|
|
List<E> subList = getList().subList(0, 1);
|
|
subList.remove(0);
|
|
@@ -100,8 +100,8 @@ public class ListSubListTester<E> extends AbstractListTester<E> {
|
|
expectContents(expected);
|
|
}
|
|
|
|
- @ListFeature.Require(SUPPORTS_REMOVE_WITH_INDEX)
|
|
@CollectionSize.Require(absent = ZERO)
|
|
+ @ListFeature.Require(SUPPORTS_REMOVE_WITH_INDEX)
|
|
public void testSubList_subListClearAffectsOriginal() {
|
|
List<E> subList = getList().subList(0, 1);
|
|
subList.clear();
|
|
@@ -116,8 +116,8 @@ public class ListSubListTester<E> extends AbstractListTester<E> {
|
|
expectAdded(0, e3());
|
|
}
|
|
|
|
- @ListFeature.Require(SUPPORTS_SET)
|
|
@CollectionSize.Require(absent = ZERO)
|
|
+ @ListFeature.Require(SUPPORTS_SET)
|
|
public void testSubList_subListSetAffectsOriginal() {
|
|
List<E> subList = getList().subList(0, 1);
|
|
subList.set(0, e3());
|
|
@@ -126,20 +126,20 @@ public class ListSubListTester<E> extends AbstractListTester<E> {
|
|
expectContents(expected);
|
|
}
|
|
|
|
- @ListFeature.Require(SUPPORTS_SET)
|
|
@CollectionSize.Require(absent = ZERO)
|
|
+ @ListFeature.Require(SUPPORTS_SET)
|
|
public void testSubList_originalListSetAffectsSubList() {
|
|
List<E> subList = getList().subList(0, 1);
|
|
getList().set(0, e3());
|
|
assertEquals(
|
|
"A set() call to a list after a sublist has been created "
|
|
+ "should be reflected in the sublist",
|
|
- Collections.singletonList(e3()),
|
|
+ singletonList(e3()),
|
|
subList);
|
|
}
|
|
|
|
+ @CollectionSize.Require(absent = {ONE, ZERO})
|
|
@ListFeature.Require(SUPPORTS_REMOVE_WITH_INDEX)
|
|
- @CollectionSize.Require(absent = {ZERO, ONE})
|
|
public void testSubList_subListRemoveAffectsOriginalLargeList() {
|
|
List<E> subList = getList().subList(1, 3);
|
|
subList.remove(e2());
|
|
@@ -148,16 +148,16 @@ public class ListSubListTester<E> extends AbstractListTester<E> {
|
|
expectContents(expected);
|
|
}
|
|
|
|
+ @CollectionSize.Require(absent = {ONE, ZERO})
|
|
@ListFeature.Require(SUPPORTS_ADD_WITH_INDEX)
|
|
- @CollectionSize.Require(absent = {ZERO, ONE})
|
|
public void testSubList_subListAddAtIndexAffectsOriginalLargeList() {
|
|
List<E> subList = getList().subList(2, 3);
|
|
subList.add(0, e3());
|
|
expectAdded(2, e3());
|
|
}
|
|
|
|
+ @CollectionSize.Require(absent = {ONE, ZERO})
|
|
@ListFeature.Require(SUPPORTS_SET)
|
|
- @CollectionSize.Require(absent = {ZERO, ONE})
|
|
public void testSubList_subListSetAffectsOriginalLargeList() {
|
|
List<E> subList = getList().subList(1, 2);
|
|
subList.set(0, e3());
|
|
@@ -166,8 +166,8 @@ public class ListSubListTester<E> extends AbstractListTester<E> {
|
|
expectContents(expected);
|
|
}
|
|
|
|
+ @CollectionSize.Require(absent = {ONE, ZERO})
|
|
@ListFeature.Require(SUPPORTS_SET)
|
|
- @CollectionSize.Require(absent = {ZERO, ONE})
|
|
public void testSubList_originalListSetAffectsSubListLargeList() {
|
|
List<E> subList = getList().subList(1, 3);
|
|
getList().set(1, e3());
|
|
@@ -183,17 +183,17 @@ public class ListSubListTester<E> extends AbstractListTester<E> {
|
|
assertEquals("subList(0, 0).subList(0, 0) should be an empty list", emptyList(), subList);
|
|
}
|
|
|
|
- @CollectionSize.Require(absent = {ZERO, ONE})
|
|
+ @CollectionSize.Require(absent = {ONE, ZERO})
|
|
public void testSubList_ofSubListNonEmpty() {
|
|
List<E> subList = getList().subList(0, 2).subList(1, 2);
|
|
assertEquals(
|
|
"subList(0, 2).subList(1, 2) "
|
|
+ "should be a single-element list of the element at index 1",
|
|
- Collections.singletonList(getOrderedElements().get(1)),
|
|
+ singletonList(getOrderedElements().get(1)),
|
|
subList);
|
|
}
|
|
|
|
- @CollectionSize.Require(absent = {ZERO})
|
|
+ @CollectionSize.Require(absent = ZERO)
|
|
public void testSubList_size() {
|
|
List<E> list = getList();
|
|
int size = getNumElements();
|
|
@@ -204,7 +204,7 @@ public class ListSubListTester<E> extends AbstractListTester<E> {
|
|
assertEquals(0, list.subList(0, 0).size());
|
|
}
|
|
|
|
- @CollectionSize.Require(absent = {ZERO})
|
|
+ @CollectionSize.Require(absent = ZERO)
|
|
public void testSubList_isEmpty() {
|
|
List<E> list = getList();
|
|
int size = getNumElements();
|
|
@@ -219,7 +219,7 @@ public class ListSubListTester<E> extends AbstractListTester<E> {
|
|
}
|
|
}
|
|
|
|
- @CollectionSize.Require(absent = {ZERO, ONE})
|
|
+ @CollectionSize.Require(absent = {ONE, ZERO})
|
|
public void testSubList_get() {
|
|
List<E> list = getList();
|
|
int size = getNumElements();
|
|
@@ -243,7 +243,7 @@ public class ListSubListTester<E> extends AbstractListTester<E> {
|
|
}
|
|
}
|
|
|
|
- @CollectionSize.Require(absent = {ZERO, ONE})
|
|
+ @CollectionSize.Require(absent = {ONE, ZERO})
|
|
public void testSubList_contains() {
|
|
List<E> list = getList();
|
|
int size = getNumElements();
|
|
@@ -261,7 +261,7 @@ public class ListSubListTester<E> extends AbstractListTester<E> {
|
|
assertFalse(tail.contains(list.get(0)));
|
|
}
|
|
|
|
- @CollectionSize.Require(absent = {ZERO, ONE})
|
|
+ @CollectionSize.Require(absent = {ONE, ZERO})
|
|
public void testSubList_indexOf() {
|
|
List<E> list = getList();
|
|
int size = getNumElements();
|
|
@@ -279,7 +279,7 @@ public class ListSubListTester<E> extends AbstractListTester<E> {
|
|
assertEquals(-1, tail.indexOf(list.get(0)));
|
|
}
|
|
|
|
- @CollectionSize.Require(absent = {ZERO, ONE})
|
|
+ @CollectionSize.Require(absent = {ONE, ZERO})
|
|
public void testSubList_lastIndexOf() {
|
|
List<E> list = getList();
|
|
int size = list.size();
|
|
@@ -308,7 +308,7 @@ public class ListSubListTester<E> extends AbstractListTester<E> {
|
|
}
|
|
|
|
@CollectionFeature.Require(SERIALIZABLE_INCLUDING_VIEWS)
|
|
- @CollectionSize.Require(absent = {ZERO, ONE})
|
|
+ @CollectionSize.Require(absent = {ONE, ZERO})
|
|
public void testReserializeSubList() {
|
|
SerializableTester.reserializeAndAssert(getList().subList(0, 2));
|
|
}
|
|
diff --git a/guava-testlib/src/com/google/common/collect/testing/testers/MapClearTester.java b/guava-testlib/src/com/google/common/collect/testing/testers/MapClearTester.java
|
|
index 64f5127e7f..468188762d 100644
|
|
--- a/guava-testlib/src/com/google/common/collect/testing/testers/MapClearTester.java
|
|
+++ b/guava-testlib/src/com/google/common/collect/testing/testers/MapClearTester.java
|
|
@@ -48,8 +48,8 @@ public class MapClearTester<K, V> extends AbstractMapTester<K, V> {
|
|
assertFalse(getMap().entrySet().iterator().hasNext());
|
|
}
|
|
|
|
- @MapFeature.Require({FAILS_FAST_ON_CONCURRENT_MODIFICATION, SUPPORTS_REMOVE})
|
|
@CollectionSize.Require(SEVERAL)
|
|
+ @MapFeature.Require({FAILS_FAST_ON_CONCURRENT_MODIFICATION, SUPPORTS_REMOVE})
|
|
public void testClearConcurrentWithEntrySetIteration() {
|
|
try {
|
|
Iterator<Entry<K, V>> iterator = getMap().entrySet().iterator();
|
|
@@ -61,8 +61,8 @@ public class MapClearTester<K, V> extends AbstractMapTester<K, V> {
|
|
}
|
|
}
|
|
|
|
- @MapFeature.Require({FAILS_FAST_ON_CONCURRENT_MODIFICATION, SUPPORTS_REMOVE})
|
|
@CollectionSize.Require(SEVERAL)
|
|
+ @MapFeature.Require({FAILS_FAST_ON_CONCURRENT_MODIFICATION, SUPPORTS_REMOVE})
|
|
public void testClearConcurrentWithKeySetIteration() {
|
|
try {
|
|
Iterator<K> iterator = getMap().keySet().iterator();
|
|
@@ -74,8 +74,8 @@ public class MapClearTester<K, V> extends AbstractMapTester<K, V> {
|
|
}
|
|
}
|
|
|
|
- @MapFeature.Require({FAILS_FAST_ON_CONCURRENT_MODIFICATION, SUPPORTS_REMOVE})
|
|
@CollectionSize.Require(SEVERAL)
|
|
+ @MapFeature.Require({FAILS_FAST_ON_CONCURRENT_MODIFICATION, SUPPORTS_REMOVE})
|
|
public void testClearConcurrentWithValuesIteration() {
|
|
try {
|
|
Iterator<V> iterator = getMap().values().iterator();
|
|
@@ -87,8 +87,8 @@ public class MapClearTester<K, V> extends AbstractMapTester<K, V> {
|
|
}
|
|
}
|
|
|
|
- @MapFeature.Require(absent = SUPPORTS_REMOVE)
|
|
@CollectionSize.Require(absent = ZERO)
|
|
+ @MapFeature.Require(absent = SUPPORTS_REMOVE)
|
|
public void testClear_unsupported() {
|
|
try {
|
|
getMap().clear();
|
|
@@ -100,8 +100,8 @@ public class MapClearTester<K, V> extends AbstractMapTester<K, V> {
|
|
expectUnchanged();
|
|
}
|
|
|
|
- @MapFeature.Require(absent = SUPPORTS_REMOVE)
|
|
@CollectionSize.Require(ZERO)
|
|
+ @MapFeature.Require(absent = SUPPORTS_REMOVE)
|
|
public void testClear_unsupportedByEmptyCollection() {
|
|
try {
|
|
getMap().clear();
|
|
diff --git a/guava-testlib/src/com/google/common/collect/testing/testers/MapComputeIfAbsentTester.java b/guava-testlib/src/com/google/common/collect/testing/testers/MapComputeIfAbsentTester.java
|
|
index a6ca7be067..776ef47f99 100644
|
|
--- a/guava-testlib/src/com/google/common/collect/testing/testers/MapComputeIfAbsentTester.java
|
|
+++ b/guava-testlib/src/com/google/common/collect/testing/testers/MapComputeIfAbsentTester.java
|
|
@@ -54,8 +54,8 @@ public class MapComputeIfAbsentTester<K, V> extends AbstractMapTester<K, V> {
|
|
expectAdded(e3());
|
|
}
|
|
|
|
- @MapFeature.Require(SUPPORTS_PUT)
|
|
@CollectionSize.Require(absent = ZERO)
|
|
+ @MapFeature.Require(SUPPORTS_PUT)
|
|
public void testComputeIfAbsent_supportedPresent() {
|
|
assertEquals(
|
|
"computeIfAbsent(present, function) should return existing value",
|
|
@@ -83,8 +83,8 @@ public class MapComputeIfAbsentTester<K, V> extends AbstractMapTester<K, V> {
|
|
expectUnchanged();
|
|
}
|
|
|
|
- @MapFeature.Require({SUPPORTS_PUT, ALLOWS_NULL_VALUES})
|
|
@CollectionSize.Require(absent = ZERO)
|
|
+ @MapFeature.Require({ALLOWS_NULL_VALUES, SUPPORTS_PUT})
|
|
public void testComputeIfAbsent_nullTreatedAsAbsent() {
|
|
initMapWithNullValue();
|
|
assertEquals(
|
|
@@ -100,7 +100,7 @@ public class MapComputeIfAbsentTester<K, V> extends AbstractMapTester<K, V> {
|
|
expectReplacement(entry(getKeyForNullValue(), getValueForNullKey()));
|
|
}
|
|
|
|
- @MapFeature.Require({SUPPORTS_PUT, ALLOWS_NULL_KEYS})
|
|
+ @MapFeature.Require({ALLOWS_NULL_KEYS, SUPPORTS_PUT})
|
|
public void testComputeIfAbsent_nullKeySupported() {
|
|
getMap()
|
|
.computeIfAbsent(
|
|
@@ -147,8 +147,8 @@ public class MapComputeIfAbsentTester<K, V> extends AbstractMapTester<K, V> {
|
|
expectUnchanged();
|
|
}
|
|
|
|
- @MapFeature.Require(absent = SUPPORTS_PUT)
|
|
@CollectionSize.Require(absent = ZERO)
|
|
+ @MapFeature.Require(absent = SUPPORTS_PUT)
|
|
public void testComputeIfAbsent_unsupportedPresentExistingValue() {
|
|
try {
|
|
assertEquals(
|
|
@@ -166,8 +166,8 @@ public class MapComputeIfAbsentTester<K, V> extends AbstractMapTester<K, V> {
|
|
expectUnchanged();
|
|
}
|
|
|
|
- @MapFeature.Require(absent = SUPPORTS_PUT)
|
|
@CollectionSize.Require(absent = ZERO)
|
|
+ @MapFeature.Require(absent = SUPPORTS_PUT)
|
|
public void testComputeIfAbsent_unsupportedPresentDifferentValue() {
|
|
try {
|
|
assertEquals(
|
|
diff --git a/guava-testlib/src/com/google/common/collect/testing/testers/MapComputeIfPresentTester.java b/guava-testlib/src/com/google/common/collect/testing/testers/MapComputeIfPresentTester.java
|
|
index 02e097a867..b4d1e82156 100644
|
|
--- a/guava-testlib/src/com/google/common/collect/testing/testers/MapComputeIfPresentTester.java
|
|
+++ b/guava-testlib/src/com/google/common/collect/testing/testers/MapComputeIfPresentTester.java
|
|
@@ -53,8 +53,8 @@ public class MapComputeIfPresentTester<K, V> extends AbstractMapTester<K, V> {
|
|
expectUnchanged();
|
|
}
|
|
|
|
- @MapFeature.Require(SUPPORTS_PUT)
|
|
@CollectionSize.Require(absent = ZERO)
|
|
+ @MapFeature.Require(SUPPORTS_PUT)
|
|
public void testComputeIfPresent_supportedPresent() {
|
|
assertEquals(
|
|
"computeIfPresent(present, function) should return new value",
|
|
@@ -70,8 +70,8 @@ public class MapComputeIfPresentTester<K, V> extends AbstractMapTester<K, V> {
|
|
expectReplacement(entry(k0(), v3()));
|
|
}
|
|
|
|
- @MapFeature.Require(SUPPORTS_PUT)
|
|
@CollectionSize.Require(absent = ZERO)
|
|
+ @MapFeature.Require(SUPPORTS_PUT)
|
|
public void testComputeIfPresent_functionReturnsNull() {
|
|
assertNull(
|
|
"computeIfPresent(present, returnsNull) should return null",
|
|
@@ -86,8 +86,8 @@ public class MapComputeIfPresentTester<K, V> extends AbstractMapTester<K, V> {
|
|
expectMissing(e0());
|
|
}
|
|
|
|
- @MapFeature.Require({SUPPORTS_PUT, ALLOWS_NULL_VALUES})
|
|
@CollectionSize.Require(absent = ZERO)
|
|
+ @MapFeature.Require({ALLOWS_NULL_VALUES, SUPPORTS_PUT})
|
|
public void testComputeIfPresent_nullTreatedAsAbsent() {
|
|
initMapWithNullValue();
|
|
assertNull(
|
|
@@ -103,8 +103,8 @@ public class MapComputeIfPresentTester<K, V> extends AbstractMapTester<K, V> {
|
|
|
|
static class ExpectedException extends RuntimeException {}
|
|
|
|
- @MapFeature.Require(SUPPORTS_PUT)
|
|
@CollectionSize.Require(absent = ZERO)
|
|
+ @MapFeature.Require(SUPPORTS_PUT)
|
|
public void testComputeIfPresent_functionThrows() {
|
|
try {
|
|
getMap()
|
|
@@ -121,8 +121,8 @@ public class MapComputeIfPresentTester<K, V> extends AbstractMapTester<K, V> {
|
|
expectUnchanged();
|
|
}
|
|
|
|
- @MapFeature.Require({SUPPORTS_PUT, ALLOWS_NULL_KEYS})
|
|
@CollectionSize.Require(absent = ZERO)
|
|
+ @MapFeature.Require({ALLOWS_NULL_KEYS, SUPPORTS_PUT})
|
|
public void testComputeIfPresent_nullKeySupportedPresent() {
|
|
initMapWithNullKey();
|
|
assertEquals(
|
|
@@ -142,7 +142,7 @@ public class MapComputeIfPresentTester<K, V> extends AbstractMapTester<K, V> {
|
|
expectContents(expected);
|
|
}
|
|
|
|
- @MapFeature.Require({SUPPORTS_PUT, ALLOWS_NULL_KEYS})
|
|
+ @MapFeature.Require({ALLOWS_NULL_KEYS, SUPPORTS_PUT})
|
|
public void testComputeIfPresent_nullKeySupportedAbsent() {
|
|
assertNull(
|
|
"computeIfPresent(null, function) should return null",
|
|
@@ -169,8 +169,8 @@ public class MapComputeIfPresentTester<K, V> extends AbstractMapTester<K, V> {
|
|
expectUnchanged();
|
|
}
|
|
|
|
- @MapFeature.Require(absent = SUPPORTS_PUT)
|
|
@CollectionSize.Require(absent = ZERO)
|
|
+ @MapFeature.Require(absent = SUPPORTS_PUT)
|
|
public void testComputeIfPresent_unsupportedPresent() {
|
|
try {
|
|
getMap().computeIfPresent(k0(), (k, v) -> v3());
|
|
diff --git a/guava-testlib/src/com/google/common/collect/testing/testers/MapComputeTester.java b/guava-testlib/src/com/google/common/collect/testing/testers/MapComputeTester.java
|
|
index eb79e08791..ecceaf96b9 100644
|
|
--- a/guava-testlib/src/com/google/common/collect/testing/testers/MapComputeTester.java
|
|
+++ b/guava-testlib/src/com/google/common/collect/testing/testers/MapComputeTester.java
|
|
@@ -71,8 +71,8 @@ public class MapComputeTester<K, V> extends AbstractMapTester<K, V> {
|
|
assertEquals(getNumElements(), getMap().size());
|
|
}
|
|
|
|
- @MapFeature.Require({SUPPORTS_PUT, SUPPORTS_REMOVE})
|
|
@CollectionSize.Require(absent = ZERO)
|
|
+ @MapFeature.Require({SUPPORTS_PUT, SUPPORTS_REMOVE})
|
|
public void testCompute_presentToPresent() {
|
|
assertEquals(
|
|
"Map.compute(present, functionReturningValue) should return new value",
|
|
@@ -89,8 +89,8 @@ public class MapComputeTester<K, V> extends AbstractMapTester<K, V> {
|
|
assertEquals(getNumElements(), getMap().size());
|
|
}
|
|
|
|
- @MapFeature.Require({SUPPORTS_PUT, SUPPORTS_REMOVE})
|
|
@CollectionSize.Require(absent = ZERO)
|
|
+ @MapFeature.Require({SUPPORTS_PUT, SUPPORTS_REMOVE})
|
|
public void testCompute_presentToAbsent() {
|
|
assertNull(
|
|
"Map.compute(present, functionReturningNull) should return null",
|
|
@@ -107,8 +107,8 @@ public class MapComputeTester<K, V> extends AbstractMapTester<K, V> {
|
|
assertEquals(getNumElements() - 1, getMap().size());
|
|
}
|
|
|
|
- @MapFeature.Require({SUPPORTS_PUT, SUPPORTS_REMOVE, ALLOWS_NULL_VALUES})
|
|
@CollectionSize.Require(absent = ZERO)
|
|
+ @MapFeature.Require({ALLOWS_NULL_VALUES, SUPPORTS_PUT, SUPPORTS_REMOVE})
|
|
public void testCompute_presentNullToPresentNonnull() {
|
|
initMapWithNullValue();
|
|
V value = getValueForNullKey();
|
|
@@ -127,8 +127,8 @@ public class MapComputeTester<K, V> extends AbstractMapTester<K, V> {
|
|
assertEquals(getNumElements(), getMap().size());
|
|
}
|
|
|
|
- @MapFeature.Require({SUPPORTS_PUT, SUPPORTS_REMOVE, ALLOWS_NULL_VALUES})
|
|
@CollectionSize.Require(absent = ZERO)
|
|
+ @MapFeature.Require({ALLOWS_NULL_VALUES, SUPPORTS_PUT, SUPPORTS_REMOVE})
|
|
public void testCompute_presentNullToNull() {
|
|
// The spec is somewhat ambiguous about this case, but the actual default implementation
|
|
// in Map will remove a present null.
|
|
@@ -147,8 +147,8 @@ public class MapComputeTester<K, V> extends AbstractMapTester<K, V> {
|
|
assertEquals(getNumElements() - 1, getMap().size());
|
|
}
|
|
|
|
- @MapFeature.Require({SUPPORTS_PUT, SUPPORTS_REMOVE, ALLOWS_NULL_KEYS})
|
|
@CollectionSize.Require(absent = ZERO)
|
|
+ @MapFeature.Require({ALLOWS_NULL_KEYS, SUPPORTS_PUT, SUPPORTS_REMOVE})
|
|
public void testCompute_nullKeyPresentToPresent() {
|
|
initMapWithNullKey();
|
|
assertEquals(
|
|
@@ -167,8 +167,8 @@ public class MapComputeTester<K, V> extends AbstractMapTester<K, V> {
|
|
|
|
static class ExpectedException extends RuntimeException {}
|
|
|
|
- @MapFeature.Require({SUPPORTS_PUT, SUPPORTS_REMOVE})
|
|
@CollectionSize.Require(absent = ZERO)
|
|
+ @MapFeature.Require({SUPPORTS_PUT, SUPPORTS_REMOVE})
|
|
public void testCompute_presentFunctionThrows() {
|
|
try {
|
|
getMap()
|
|
diff --git a/guava-testlib/src/com/google/common/collect/testing/testers/MapContainsKeyTester.java b/guava-testlib/src/com/google/common/collect/testing/testers/MapContainsKeyTester.java
|
|
index 3721db1174..2ac9adc331 100644
|
|
--- a/guava-testlib/src/com/google/common/collect/testing/testers/MapContainsKeyTester.java
|
|
+++ b/guava-testlib/src/com/google/common/collect/testing/testers/MapContainsKeyTester.java
|
|
@@ -55,15 +55,15 @@ public class MapContainsKeyTester<K, V> extends AbstractMapTester<K, V> {
|
|
expectNullKeyMissingWhenNullKeysUnsupported("containsKey(null) should return false or throw");
|
|
}
|
|
|
|
- @MapFeature.Require(ALLOWS_NULL_KEYS)
|
|
@CollectionSize.Require(absent = ZERO)
|
|
+ @MapFeature.Require(ALLOWS_NULL_KEYS)
|
|
public void testContains_nonNullWhenNullContained() {
|
|
initMapWithNullKey();
|
|
assertFalse("containsKey(notPresent) should return false", getMap().containsKey(k3()));
|
|
}
|
|
|
|
- @MapFeature.Require(ALLOWS_NULL_KEYS)
|
|
@CollectionSize.Require(absent = ZERO)
|
|
+ @MapFeature.Require(ALLOWS_NULL_KEYS)
|
|
public void testContains_nullContained() {
|
|
initMapWithNullKey();
|
|
assertTrue("containsKey(null) should return true", getMap().containsKey(null));
|
|
diff --git a/guava-testlib/src/com/google/common/collect/testing/testers/MapContainsValueTester.java b/guava-testlib/src/com/google/common/collect/testing/testers/MapContainsValueTester.java
|
|
index 044562ab6e..5047ed0e40 100644
|
|
--- a/guava-testlib/src/com/google/common/collect/testing/testers/MapContainsValueTester.java
|
|
+++ b/guava-testlib/src/com/google/common/collect/testing/testers/MapContainsValueTester.java
|
|
@@ -57,15 +57,15 @@ public class MapContainsValueTester<K, V> extends AbstractMapTester<K, V> {
|
|
"containsValue(null) should return false or throw");
|
|
}
|
|
|
|
- @MapFeature.Require(ALLOWS_NULL_VALUES)
|
|
@CollectionSize.Require(absent = ZERO)
|
|
+ @MapFeature.Require(ALLOWS_NULL_VALUES)
|
|
public void testContains_nonNullWhenNullContained() {
|
|
initMapWithNullValue();
|
|
assertFalse("containsValue(notPresent) should return false", getMap().containsValue(v3()));
|
|
}
|
|
|
|
- @MapFeature.Require(ALLOWS_NULL_VALUES)
|
|
@CollectionSize.Require(absent = ZERO)
|
|
+ @MapFeature.Require(ALLOWS_NULL_VALUES)
|
|
public void testContains_nullContained() {
|
|
initMapWithNullValue();
|
|
assertTrue("containsValue(null) should return true", getMap().containsValue(null));
|
|
diff --git a/guava-testlib/src/com/google/common/collect/testing/testers/MapCreationTester.java b/guava-testlib/src/com/google/common/collect/testing/testers/MapCreationTester.java
|
|
index 0810dea28a..cdf7b1edab 100644
|
|
--- a/guava-testlib/src/com/google/common/collect/testing/testers/MapCreationTester.java
|
|
+++ b/guava-testlib/src/com/google/common/collect/testing/testers/MapCreationTester.java
|
|
@@ -45,15 +45,15 @@ import org.junit.Ignore;
|
|
@GwtCompatible(emulated = true)
|
|
@Ignore // Affects only Android test runner, which respects JUnit 4 annotations on JUnit 3 tests.
|
|
public class MapCreationTester<K, V> extends AbstractMapTester<K, V> {
|
|
- @MapFeature.Require(ALLOWS_NULL_KEYS)
|
|
@CollectionSize.Require(absent = ZERO)
|
|
+ @MapFeature.Require(ALLOWS_NULL_KEYS)
|
|
public void testCreateWithNullKeySupported() {
|
|
initMapWithNullKey();
|
|
expectContents(createArrayWithNullKey());
|
|
}
|
|
|
|
- @MapFeature.Require(absent = ALLOWS_NULL_KEYS)
|
|
@CollectionSize.Require(absent = ZERO)
|
|
+ @MapFeature.Require(absent = ALLOWS_NULL_KEYS)
|
|
public void testCreateWithNullKeyUnsupported() {
|
|
try {
|
|
initMapWithNullKey();
|
|
@@ -62,15 +62,15 @@ public class MapCreationTester<K, V> extends AbstractMapTester<K, V> {
|
|
}
|
|
}
|
|
|
|
- @MapFeature.Require(ALLOWS_NULL_VALUES)
|
|
@CollectionSize.Require(absent = ZERO)
|
|
+ @MapFeature.Require(ALLOWS_NULL_VALUES)
|
|
public void testCreateWithNullValueSupported() {
|
|
initMapWithNullValue();
|
|
expectContents(createArrayWithNullValue());
|
|
}
|
|
|
|
- @MapFeature.Require(absent = ALLOWS_NULL_VALUES)
|
|
@CollectionSize.Require(absent = ZERO)
|
|
+ @MapFeature.Require(absent = ALLOWS_NULL_VALUES)
|
|
public void testCreateWithNullValueUnsupported() {
|
|
try {
|
|
initMapWithNullValue();
|
|
@@ -79,8 +79,8 @@ public class MapCreationTester<K, V> extends AbstractMapTester<K, V> {
|
|
}
|
|
}
|
|
|
|
- @MapFeature.Require({ALLOWS_NULL_KEYS, ALLOWS_NULL_VALUES})
|
|
@CollectionSize.Require(absent = ZERO)
|
|
+ @MapFeature.Require({ALLOWS_NULL_KEYS, ALLOWS_NULL_VALUES})
|
|
public void testCreateWithNullKeyAndValueSupported() {
|
|
Entry<K, V>[] entries = createSamplesArray();
|
|
entries[getNullLocation()] = entry(null, null);
|
|
@@ -88,20 +88,20 @@ public class MapCreationTester<K, V> extends AbstractMapTester<K, V> {
|
|
expectContents(entries);
|
|
}
|
|
|
|
+ @CollectionSize.Require(absent = {ONE, ZERO})
|
|
@MapFeature.Require(value = ALLOWS_NULL_KEYS, absent = REJECTS_DUPLICATES_AT_CREATION)
|
|
- @CollectionSize.Require(absent = {ZERO, ONE})
|
|
public void testCreateWithDuplicates_nullDuplicatesNotRejected() {
|
|
expectFirstRemoved(getEntriesMultipleNullKeys());
|
|
}
|
|
|
|
+ @CollectionSize.Require(absent = {ONE, ZERO})
|
|
@MapFeature.Require(absent = REJECTS_DUPLICATES_AT_CREATION)
|
|
- @CollectionSize.Require(absent = {ZERO, ONE})
|
|
public void testCreateWithDuplicates_nonNullDuplicatesNotRejected() {
|
|
expectFirstRemoved(getEntriesMultipleNonNullKeys());
|
|
}
|
|
|
|
+ @CollectionSize.Require(absent = {ONE, ZERO})
|
|
@MapFeature.Require({ALLOWS_NULL_KEYS, REJECTS_DUPLICATES_AT_CREATION})
|
|
- @CollectionSize.Require(absent = {ZERO, ONE})
|
|
public void testCreateWithDuplicates_nullDuplicatesRejected() {
|
|
Entry<K, V>[] entries = getEntriesMultipleNullKeys();
|
|
try {
|
|
@@ -111,8 +111,8 @@ public class MapCreationTester<K, V> extends AbstractMapTester<K, V> {
|
|
}
|
|
}
|
|
|
|
+ @CollectionSize.Require(absent = {ONE, ZERO})
|
|
@MapFeature.Require(REJECTS_DUPLICATES_AT_CREATION)
|
|
- @CollectionSize.Require(absent = {ZERO, ONE})
|
|
public void testCreateWithDuplicates_nonNullDuplicatesRejected() {
|
|
Entry<K, V>[] entries = getEntriesMultipleNonNullKeys();
|
|
try {
|
|
diff --git a/guava-testlib/src/com/google/common/collect/testing/testers/MapEntrySetTester.java b/guava-testlib/src/com/google/common/collect/testing/testers/MapEntrySetTester.java
|
|
index 537f091b4a..4b4387aaaf 100644
|
|
--- a/guava-testlib/src/com/google/common/collect/testing/testers/MapEntrySetTester.java
|
|
+++ b/guava-testlib/src/com/google/common/collect/testing/testers/MapEntrySetTester.java
|
|
@@ -52,8 +52,8 @@ public class MapEntrySetTester<K, V> extends AbstractMapTester<K, V> {
|
|
INSTANCE;
|
|
}
|
|
|
|
- @CollectionSize.Require(ONE)
|
|
@CollectionFeature.Require(SUPPORTS_ITERATOR_REMOVE)
|
|
+ @CollectionSize.Require(ONE)
|
|
public void testEntrySetIteratorRemove() {
|
|
Set<Entry<K, V>> entrySet = getMap().entrySet();
|
|
Iterator<Entry<K, V>> entryItr = entrySet.iterator();
|
|
@@ -103,8 +103,8 @@ public class MapEntrySetTester<K, V> extends AbstractMapTester<K, V> {
|
|
assertTrue(getMap().entrySet().contains(Helpers.mapEntry(getKeyForNullValue(), null)));
|
|
}
|
|
|
|
- @MapFeature.Require(SUPPORTS_PUT)
|
|
@CollectionSize.Require(absent = ZERO)
|
|
+ @MapFeature.Require(SUPPORTS_PUT)
|
|
public void testSetValue() {
|
|
for (Entry<K, V> entry : getMap().entrySet()) {
|
|
if (entry.getKey().equals(k0())) {
|
|
@@ -115,8 +115,8 @@ public class MapEntrySetTester<K, V> extends AbstractMapTester<K, V> {
|
|
expectReplacement(entry(k0(), v3()));
|
|
}
|
|
|
|
- @MapFeature.Require({SUPPORTS_PUT, ALLOWS_NULL_VALUES})
|
|
@CollectionSize.Require(absent = ZERO)
|
|
+ @MapFeature.Require({ALLOWS_NULL_VALUES, SUPPORTS_PUT})
|
|
public void testSetValueWithNullValuesPresent() {
|
|
for (Entry<K, V> entry : getMap().entrySet()) {
|
|
if (entry.getKey().equals(k0())) {
|
|
@@ -127,8 +127,8 @@ public class MapEntrySetTester<K, V> extends AbstractMapTester<K, V> {
|
|
expectReplacement(entry(k0(), (V) null));
|
|
}
|
|
|
|
- @MapFeature.Require(value = SUPPORTS_PUT, absent = ALLOWS_NULL_VALUES)
|
|
@CollectionSize.Require(absent = ZERO)
|
|
+ @MapFeature.Require(value = SUPPORTS_PUT, absent = ALLOWS_NULL_VALUES)
|
|
public void testSetValueWithNullValuesAbsent() {
|
|
for (Entry<K, V> entry : getMap().entrySet()) {
|
|
try {
|
|
diff --git a/guava-testlib/src/com/google/common/collect/testing/testers/MapForEachTester.java b/guava-testlib/src/com/google/common/collect/testing/testers/MapForEachTester.java
|
|
index 40086a87ac..2ecb02eb8b 100644
|
|
--- a/guava-testlib/src/com/google/common/collect/testing/testers/MapForEachTester.java
|
|
+++ b/guava-testlib/src/com/google/common/collect/testing/testers/MapForEachTester.java
|
|
@@ -57,8 +57,8 @@ public class MapForEachTester<K, V> extends AbstractMapTester<K, V> {
|
|
Helpers.assertEqualIgnoringOrder(getSampleEntries(), entries);
|
|
}
|
|
|
|
- @MapFeature.Require(ALLOWS_NULL_KEYS)
|
|
@CollectionSize.Require(absent = ZERO)
|
|
+ @MapFeature.Require(ALLOWS_NULL_KEYS)
|
|
public void testForEach_nullKeys() {
|
|
initMapWithNullKey();
|
|
List<Entry<K, V>> expectedEntries = Arrays.asList(createArrayWithNullKey());
|
|
@@ -67,8 +67,8 @@ public class MapForEachTester<K, V> extends AbstractMapTester<K, V> {
|
|
Helpers.assertEqualIgnoringOrder(expectedEntries, entries);
|
|
}
|
|
|
|
- @MapFeature.Require(ALLOWS_NULL_VALUES)
|
|
@CollectionSize.Require(absent = ZERO)
|
|
+ @MapFeature.Require(ALLOWS_NULL_VALUES)
|
|
public void testForEach_nullValues() {
|
|
initMapWithNullValue();
|
|
List<Entry<K, V>> expectedEntries = Arrays.asList(createArrayWithNullValue());
|
|
diff --git a/guava-testlib/src/com/google/common/collect/testing/testers/MapGetOrDefaultTester.java b/guava-testlib/src/com/google/common/collect/testing/testers/MapGetOrDefaultTester.java
|
|
index 92094a8aac..2e1326fd6e 100644
|
|
--- a/guava-testlib/src/com/google/common/collect/testing/testers/MapGetOrDefaultTester.java
|
|
+++ b/guava-testlib/src/com/google/common/collect/testing/testers/MapGetOrDefaultTester.java
|
|
@@ -84,8 +84,8 @@ public class MapGetOrDefaultTester<K, V> extends AbstractMapTester<K, V> {
|
|
}
|
|
}
|
|
|
|
- @MapFeature.Require(ALLOWS_NULL_KEYS)
|
|
@CollectionSize.Require(absent = ZERO)
|
|
+ @MapFeature.Require(ALLOWS_NULL_KEYS)
|
|
public void testGetOrDefault_nonNullWhenNullContained() {
|
|
initMapWithNullKey();
|
|
assertEquals(
|
|
@@ -94,8 +94,8 @@ public class MapGetOrDefaultTester<K, V> extends AbstractMapTester<K, V> {
|
|
getMap().getOrDefault(k3(), v3()));
|
|
}
|
|
|
|
- @MapFeature.Require(ALLOWS_NULL_KEYS)
|
|
@CollectionSize.Require(absent = ZERO)
|
|
+ @MapFeature.Require(ALLOWS_NULL_KEYS)
|
|
public void testGetOrDefault_presentNull() {
|
|
initMapWithNullKey();
|
|
assertEquals(
|
|
@@ -104,8 +104,8 @@ public class MapGetOrDefaultTester<K, V> extends AbstractMapTester<K, V> {
|
|
getMap().getOrDefault(null, v3()));
|
|
}
|
|
|
|
- @MapFeature.Require(ALLOWS_NULL_VALUES)
|
|
@CollectionSize.Require(absent = ZERO)
|
|
+ @MapFeature.Require(ALLOWS_NULL_VALUES)
|
|
public void testGetOrDefault_presentMappedToNull() {
|
|
initMapWithNullValue();
|
|
assertNull(
|
|
diff --git a/guava-testlib/src/com/google/common/collect/testing/testers/MapGetTester.java b/guava-testlib/src/com/google/common/collect/testing/testers/MapGetTester.java
|
|
index 89610f26c7..2f3f2754e0 100644
|
|
--- a/guava-testlib/src/com/google/common/collect/testing/testers/MapGetTester.java
|
|
+++ b/guava-testlib/src/com/google/common/collect/testing/testers/MapGetTester.java
|
|
@@ -59,15 +59,15 @@ public class MapGetTester<K, V> extends AbstractMapTester<K, V> {
|
|
}
|
|
}
|
|
|
|
- @MapFeature.Require(ALLOWS_NULL_KEYS)
|
|
@CollectionSize.Require(absent = ZERO)
|
|
+ @MapFeature.Require(ALLOWS_NULL_KEYS)
|
|
public void testGet_nonNullWhenNullContained() {
|
|
initMapWithNullKey();
|
|
assertNull("get(notPresent) should return null", get(k3()));
|
|
}
|
|
|
|
- @MapFeature.Require(ALLOWS_NULL_KEYS)
|
|
@CollectionSize.Require(absent = ZERO)
|
|
+ @MapFeature.Require(ALLOWS_NULL_KEYS)
|
|
public void testGet_nullContained() {
|
|
initMapWithNullKey();
|
|
assertEquals("get(null) should return the associated value", getValueForNullKey(), get(null));
|
|
diff --git a/guava-testlib/src/com/google/common/collect/testing/testers/MapMergeTester.java b/guava-testlib/src/com/google/common/collect/testing/testers/MapMergeTester.java
|
|
index c001afa009..da65752af8 100644
|
|
--- a/guava-testlib/src/com/google/common/collect/testing/testers/MapMergeTester.java
|
|
+++ b/guava-testlib/src/com/google/common/collect/testing/testers/MapMergeTester.java
|
|
@@ -58,8 +58,8 @@ public class MapMergeTester<K, V> extends AbstractMapTester<K, V> {
|
|
expectAdded(e3());
|
|
}
|
|
|
|
- @MapFeature.Require({SUPPORTS_PUT, ALLOWS_NULL_VALUES})
|
|
@CollectionSize.Require(absent = ZERO)
|
|
+ @MapFeature.Require({ALLOWS_NULL_VALUES, SUPPORTS_PUT})
|
|
public void testMappedToNull() {
|
|
initMapWithNullValue();
|
|
assertEquals(
|
|
@@ -76,7 +76,7 @@ public class MapMergeTester<K, V> extends AbstractMapTester<K, V> {
|
|
expectReplacement(entry(getKeyForNullValue(), v3()));
|
|
}
|
|
|
|
- @MapFeature.Require({SUPPORTS_PUT, ALLOWS_NULL_KEYS})
|
|
+ @MapFeature.Require({ALLOWS_NULL_KEYS, SUPPORTS_PUT})
|
|
public void testMergeAbsentNullKey() {
|
|
assertEquals(
|
|
"Map.merge(null, value, function) should return value",
|
|
@@ -92,8 +92,8 @@ public class MapMergeTester<K, V> extends AbstractMapTester<K, V> {
|
|
expectAdded(entry(null, v3()));
|
|
}
|
|
|
|
- @MapFeature.Require(SUPPORTS_PUT)
|
|
@CollectionSize.Require(absent = ZERO)
|
|
+ @MapFeature.Require(SUPPORTS_PUT)
|
|
public void testMergePresent() {
|
|
assertEquals(
|
|
"Map.merge(present, value, function) should return function result",
|
|
@@ -112,8 +112,8 @@ public class MapMergeTester<K, V> extends AbstractMapTester<K, V> {
|
|
|
|
private static class ExpectedException extends RuntimeException {}
|
|
|
|
- @MapFeature.Require(SUPPORTS_PUT)
|
|
@CollectionSize.Require(absent = ZERO)
|
|
+ @MapFeature.Require(SUPPORTS_PUT)
|
|
public void testMergeFunctionThrows() {
|
|
try {
|
|
getMap()
|
|
@@ -131,8 +131,8 @@ public class MapMergeTester<K, V> extends AbstractMapTester<K, V> {
|
|
expectUnchanged();
|
|
}
|
|
|
|
- @MapFeature.Require(SUPPORTS_REMOVE)
|
|
@CollectionSize.Require(absent = ZERO)
|
|
+ @MapFeature.Require(SUPPORTS_REMOVE)
|
|
public void testMergePresentToNull() {
|
|
assertNull(
|
|
"Map.merge(present, value, functionReturningNull) should return null",
|
|
diff --git a/guava-testlib/src/com/google/common/collect/testing/testers/MapPutAllTester.java b/guava-testlib/src/com/google/common/collect/testing/testers/MapPutAllTester.java
|
|
index 21d89d8d68..28af9176cd 100644
|
|
--- a/guava-testlib/src/com/google/common/collect/testing/testers/MapPutAllTester.java
|
|
+++ b/guava-testlib/src/com/google/common/collect/testing/testers/MapPutAllTester.java
|
|
@@ -93,15 +93,15 @@ public class MapPutAllTester<K, V> extends AbstractMapTester<K, V> {
|
|
expectMissing(e3(), e4());
|
|
}
|
|
|
|
- @MapFeature.Require(SUPPORTS_PUT)
|
|
@CollectionSize.Require(absent = ZERO)
|
|
+ @MapFeature.Require(SUPPORTS_PUT)
|
|
public void testPutAll_supportedSomePresent() {
|
|
putAll(MinimalCollection.of(e3(), e0()));
|
|
expectAdded(e3());
|
|
}
|
|
|
|
- @MapFeature.Require({FAILS_FAST_ON_CONCURRENT_MODIFICATION, SUPPORTS_PUT})
|
|
@CollectionSize.Require(absent = ZERO)
|
|
+ @MapFeature.Require({FAILS_FAST_ON_CONCURRENT_MODIFICATION, SUPPORTS_PUT})
|
|
public void testPutAllSomePresentConcurrentWithEntrySetIteration() {
|
|
try {
|
|
Iterator<Entry<K, V>> iterator = getMap().entrySet().iterator();
|
|
@@ -113,8 +113,8 @@ public class MapPutAllTester<K, V> extends AbstractMapTester<K, V> {
|
|
}
|
|
}
|
|
|
|
- @MapFeature.Require(absent = SUPPORTS_PUT)
|
|
@CollectionSize.Require(absent = ZERO)
|
|
+ @MapFeature.Require(absent = SUPPORTS_PUT)
|
|
public void testPutAll_unsupportedSomePresent() {
|
|
try {
|
|
putAll(MinimalCollection.of(e3(), e0()));
|
|
@@ -124,8 +124,8 @@ public class MapPutAllTester<K, V> extends AbstractMapTester<K, V> {
|
|
expectUnchanged();
|
|
}
|
|
|
|
- @MapFeature.Require(absent = SUPPORTS_PUT)
|
|
@CollectionSize.Require(absent = ZERO)
|
|
+ @MapFeature.Require(absent = SUPPORTS_PUT)
|
|
public void testPutAll_unsupportedAllPresent() {
|
|
try {
|
|
putAll(MinimalCollection.of(e0()));
|
|
@@ -134,7 +134,7 @@ public class MapPutAllTester<K, V> extends AbstractMapTester<K, V> {
|
|
expectUnchanged();
|
|
}
|
|
|
|
- @MapFeature.Require({SUPPORTS_PUT, ALLOWS_NULL_KEYS})
|
|
+ @MapFeature.Require({ALLOWS_NULL_KEYS, SUPPORTS_PUT})
|
|
public void testPutAll_nullKeySupported() {
|
|
putAll(containsNullKey);
|
|
expectAdded(containsNullKey.get(0));
|
|
@@ -152,7 +152,7 @@ public class MapPutAllTester<K, V> extends AbstractMapTester<K, V> {
|
|
"Should not contain null key after unsupported putAll(containsNullKey)");
|
|
}
|
|
|
|
- @MapFeature.Require({SUPPORTS_PUT, ALLOWS_NULL_VALUES})
|
|
+ @MapFeature.Require({ALLOWS_NULL_VALUES, SUPPORTS_PUT})
|
|
public void testPutAll_nullValueSupported() {
|
|
putAll(containsNullValue);
|
|
expectAdded(containsNullValue.get(0));
|
|
diff --git a/guava-testlib/src/com/google/common/collect/testing/testers/MapPutIfAbsentTester.java b/guava-testlib/src/com/google/common/collect/testing/testers/MapPutIfAbsentTester.java
|
|
index c9aa930eb0..9956e3dee9 100644
|
|
--- a/guava-testlib/src/com/google/common/collect/testing/testers/MapPutIfAbsentTester.java
|
|
+++ b/guava-testlib/src/com/google/common/collect/testing/testers/MapPutIfAbsentTester.java
|
|
@@ -45,8 +45,8 @@ public class MapPutIfAbsentTester<K, V> extends AbstractMapTester<K, V> {
|
|
expectAdded(e3());
|
|
}
|
|
|
|
- @MapFeature.Require(SUPPORTS_PUT)
|
|
@CollectionSize.Require(absent = ZERO)
|
|
+ @MapFeature.Require(SUPPORTS_PUT)
|
|
public void testPutIfAbsent_supportedPresent() {
|
|
assertEquals(
|
|
"putIfAbsent(present, value) should return existing value",
|
|
@@ -66,8 +66,8 @@ public class MapPutIfAbsentTester<K, V> extends AbstractMapTester<K, V> {
|
|
expectMissing(e3());
|
|
}
|
|
|
|
- @MapFeature.Require(absent = SUPPORTS_PUT)
|
|
@CollectionSize.Require(absent = ZERO)
|
|
+ @MapFeature.Require(absent = SUPPORTS_PUT)
|
|
public void testPutIfAbsent_unsupportedPresentExistingValue() {
|
|
try {
|
|
assertEquals(
|
|
@@ -79,8 +79,8 @@ public class MapPutIfAbsentTester<K, V> extends AbstractMapTester<K, V> {
|
|
expectUnchanged();
|
|
}
|
|
|
|
- @MapFeature.Require(absent = SUPPORTS_PUT)
|
|
@CollectionSize.Require(absent = ZERO)
|
|
+ @MapFeature.Require(absent = SUPPORTS_PUT)
|
|
public void testPutIfAbsent_unsupportedPresentDifferentValue() {
|
|
try {
|
|
getMap().putIfAbsent(k0(), v3());
|
|
@@ -113,8 +113,8 @@ public class MapPutIfAbsentTester<K, V> extends AbstractMapTester<K, V> {
|
|
"Should not contain null value after unsupported put(key, null)");
|
|
}
|
|
|
|
- @MapFeature.Require(value = SUPPORTS_PUT, absent = ALLOWS_NULL_VALUES)
|
|
@CollectionSize.Require(absent = ZERO)
|
|
+ @MapFeature.Require(value = SUPPORTS_PUT, absent = ALLOWS_NULL_VALUES)
|
|
public void testPutIfAbsent_putWithNullValueUnsupported() {
|
|
try {
|
|
getMap().putIfAbsent(k0(), null);
|
|
diff --git a/guava-testlib/src/com/google/common/collect/testing/testers/MapPutTester.java b/guava-testlib/src/com/google/common/collect/testing/testers/MapPutTester.java
|
|
index c9a745d4ad..1491b79b4b 100644
|
|
--- a/guava-testlib/src/com/google/common/collect/testing/testers/MapPutTester.java
|
|
+++ b/guava-testlib/src/com/google/common/collect/testing/testers/MapPutTester.java
|
|
@@ -59,8 +59,8 @@ public class MapPutTester<K, V> extends AbstractMapTester<K, V> {
|
|
presentKeyNullValueEntry = entry(k0(), null);
|
|
}
|
|
|
|
- @MapFeature.Require(SUPPORTS_PUT)
|
|
@CollectionSize.Require(absent = ZERO)
|
|
+ @MapFeature.Require(SUPPORTS_PUT)
|
|
public void testPut_supportedPresent() {
|
|
assertEquals("put(present, value) should return the old value", v0(), getMap().put(k0(), v3()));
|
|
expectReplacement(entry(k0(), v3()));
|
|
@@ -72,8 +72,8 @@ public class MapPutTester<K, V> extends AbstractMapTester<K, V> {
|
|
expectAdded(e3());
|
|
}
|
|
|
|
- @MapFeature.Require({FAILS_FAST_ON_CONCURRENT_MODIFICATION, SUPPORTS_PUT})
|
|
@CollectionSize.Require(absent = ZERO)
|
|
+ @MapFeature.Require({FAILS_FAST_ON_CONCURRENT_MODIFICATION, SUPPORTS_PUT})
|
|
public void testPutAbsentConcurrentWithEntrySetIteration() {
|
|
try {
|
|
Iterator<Entry<K, V>> iterator = getMap().entrySet().iterator();
|
|
@@ -85,8 +85,8 @@ public class MapPutTester<K, V> extends AbstractMapTester<K, V> {
|
|
}
|
|
}
|
|
|
|
- @MapFeature.Require({FAILS_FAST_ON_CONCURRENT_MODIFICATION, SUPPORTS_PUT})
|
|
@CollectionSize.Require(absent = ZERO)
|
|
+ @MapFeature.Require({FAILS_FAST_ON_CONCURRENT_MODIFICATION, SUPPORTS_PUT})
|
|
public void testPutAbsentConcurrentWithKeySetIteration() {
|
|
try {
|
|
Iterator<K> iterator = getMap().keySet().iterator();
|
|
@@ -98,8 +98,8 @@ public class MapPutTester<K, V> extends AbstractMapTester<K, V> {
|
|
}
|
|
}
|
|
|
|
- @MapFeature.Require({FAILS_FAST_ON_CONCURRENT_MODIFICATION, SUPPORTS_PUT})
|
|
@CollectionSize.Require(absent = ZERO)
|
|
+ @MapFeature.Require({FAILS_FAST_ON_CONCURRENT_MODIFICATION, SUPPORTS_PUT})
|
|
public void testPutAbsentConcurrentWithValueIteration() {
|
|
try {
|
|
Iterator<V> iterator = getMap().values().iterator();
|
|
@@ -122,8 +122,8 @@ public class MapPutTester<K, V> extends AbstractMapTester<K, V> {
|
|
expectMissing(e3());
|
|
}
|
|
|
|
- @MapFeature.Require(absent = SUPPORTS_PUT)
|
|
@CollectionSize.Require(absent = ZERO)
|
|
+ @MapFeature.Require(absent = SUPPORTS_PUT)
|
|
public void testPut_unsupportedPresentExistingValue() {
|
|
try {
|
|
assertEquals("put(present, existingValue) should return present or throw", v0(), put(e0()));
|
|
@@ -132,8 +132,8 @@ public class MapPutTester<K, V> extends AbstractMapTester<K, V> {
|
|
expectUnchanged();
|
|
}
|
|
|
|
- @MapFeature.Require(absent = SUPPORTS_PUT)
|
|
@CollectionSize.Require(absent = ZERO)
|
|
+ @MapFeature.Require(absent = SUPPORTS_PUT)
|
|
public void testPut_unsupportedPresentDifferentValue() {
|
|
try {
|
|
getMap().put(k0(), v3());
|
|
@@ -143,14 +143,14 @@ public class MapPutTester<K, V> extends AbstractMapTester<K, V> {
|
|
expectUnchanged();
|
|
}
|
|
|
|
- @MapFeature.Require({SUPPORTS_PUT, ALLOWS_NULL_KEYS})
|
|
+ @MapFeature.Require({ALLOWS_NULL_KEYS, SUPPORTS_PUT})
|
|
public void testPut_nullKeySupportedNotPresent() {
|
|
assertNull("put(null, value) should return null", put(nullKeyEntry));
|
|
expectAdded(nullKeyEntry);
|
|
}
|
|
|
|
- @MapFeature.Require({SUPPORTS_PUT, ALLOWS_NULL_KEYS})
|
|
@CollectionSize.Require(absent = ZERO)
|
|
+ @MapFeature.Require({ALLOWS_NULL_KEYS, SUPPORTS_PUT})
|
|
public void testPut_nullKeySupportedPresent() {
|
|
Entry<K, V> newEntry = entry(null, v3());
|
|
initMapWithNullKey();
|
|
@@ -176,7 +176,7 @@ public class MapPutTester<K, V> extends AbstractMapTester<K, V> {
|
|
"Should not contain null key after unsupported put(null, value)");
|
|
}
|
|
|
|
- @MapFeature.Require({SUPPORTS_PUT, ALLOWS_NULL_VALUES})
|
|
+ @MapFeature.Require({ALLOWS_NULL_VALUES, SUPPORTS_PUT})
|
|
public void testPut_nullValueSupported() {
|
|
assertNull("put(key, null) should return null", put(nullValueEntry));
|
|
expectAdded(nullValueEntry);
|
|
@@ -194,8 +194,8 @@ public class MapPutTester<K, V> extends AbstractMapTester<K, V> {
|
|
"Should not contain null value after unsupported put(key, null)");
|
|
}
|
|
|
|
- @MapFeature.Require({SUPPORTS_PUT, ALLOWS_NULL_VALUES})
|
|
@CollectionSize.Require(absent = ZERO)
|
|
+ @MapFeature.Require({ALLOWS_NULL_VALUES, SUPPORTS_PUT})
|
|
public void testPut_replaceWithNullValueSupported() {
|
|
assertEquals(
|
|
"put(present, null) should return the associated value",
|
|
@@ -204,8 +204,8 @@ public class MapPutTester<K, V> extends AbstractMapTester<K, V> {
|
|
expectReplacement(presentKeyNullValueEntry);
|
|
}
|
|
|
|
- @MapFeature.Require(value = SUPPORTS_PUT, absent = ALLOWS_NULL_VALUES)
|
|
@CollectionSize.Require(absent = ZERO)
|
|
+ @MapFeature.Require(value = SUPPORTS_PUT, absent = ALLOWS_NULL_VALUES)
|
|
public void testPut_replaceWithNullValueUnsupported() {
|
|
try {
|
|
put(presentKeyNullValueEntry);
|
|
@@ -217,8 +217,8 @@ public class MapPutTester<K, V> extends AbstractMapTester<K, V> {
|
|
"Should not contain null after unsupported put(present, null)");
|
|
}
|
|
|
|
- @MapFeature.Require({SUPPORTS_PUT, ALLOWS_NULL_VALUES})
|
|
@CollectionSize.Require(absent = ZERO)
|
|
+ @MapFeature.Require({ALLOWS_NULL_VALUES, SUPPORTS_PUT})
|
|
public void testPut_replaceNullValueWithNullSupported() {
|
|
initMapWithNullValue();
|
|
assertNull(
|
|
@@ -227,8 +227,8 @@ public class MapPutTester<K, V> extends AbstractMapTester<K, V> {
|
|
expectContents(createArrayWithNullValue());
|
|
}
|
|
|
|
- @MapFeature.Require({SUPPORTS_PUT, ALLOWS_NULL_VALUES})
|
|
@CollectionSize.Require(absent = ZERO)
|
|
+ @MapFeature.Require({ALLOWS_NULL_VALUES, SUPPORTS_PUT})
|
|
public void testPut_replaceNullValueWithNonNullSupported() {
|
|
Entry<K, V> newEntry = entry(getKeyForNullValue(), v3());
|
|
initMapWithNullValue();
|
|
@@ -239,7 +239,7 @@ public class MapPutTester<K, V> extends AbstractMapTester<K, V> {
|
|
expectContents(expected);
|
|
}
|
|
|
|
- @MapFeature.Require({SUPPORTS_PUT, ALLOWS_NULL_KEYS, ALLOWS_NULL_VALUES})
|
|
+ @MapFeature.Require({ALLOWS_NULL_KEYS, ALLOWS_NULL_VALUES, SUPPORTS_PUT})
|
|
public void testPut_nullKeyAndValueSupported() {
|
|
assertNull("put(null, null) should return null", put(nullKeyValueEntry));
|
|
expectAdded(nullKeyValueEntry);
|
|
diff --git a/guava-testlib/src/com/google/common/collect/testing/testers/MapRemoveEntryTester.java b/guava-testlib/src/com/google/common/collect/testing/testers/MapRemoveEntryTester.java
|
|
index a59a74a101..2638a20c13 100644
|
|
--- a/guava-testlib/src/com/google/common/collect/testing/testers/MapRemoveEntryTester.java
|
|
+++ b/guava-testlib/src/com/google/common/collect/testing/testers/MapRemoveEntryTester.java
|
|
@@ -37,8 +37,8 @@ import org.junit.Ignore;
|
|
@GwtCompatible
|
|
@Ignore // Affects only Android test runner, which respects JUnit 4 annotations on JUnit 3 tests.
|
|
public class MapRemoveEntryTester<K, V> extends AbstractMapTester<K, V> {
|
|
- @MapFeature.Require(SUPPORTS_REMOVE)
|
|
@CollectionSize.Require(absent = ZERO)
|
|
+ @MapFeature.Require(SUPPORTS_REMOVE)
|
|
public void testRemove_supportedPresent() {
|
|
assertTrue(getMap().remove(k0(), v0()));
|
|
expectMissing(e0());
|
|
@@ -82,8 +82,8 @@ public class MapRemoveEntryTester<K, V> extends AbstractMapTester<K, V> {
|
|
expectUnchanged();
|
|
}
|
|
|
|
- @MapFeature.Require(absent = SUPPORTS_REMOVE)
|
|
@CollectionSize.Require(absent = ZERO)
|
|
+ @MapFeature.Require(absent = SUPPORTS_REMOVE)
|
|
public void testRemove_unsupportedPresent() {
|
|
try {
|
|
getMap().remove(k0(), v0());
|
|
diff --git a/guava-testlib/src/com/google/common/collect/testing/testers/MapRemoveTester.java b/guava-testlib/src/com/google/common/collect/testing/testers/MapRemoveTester.java
|
|
index 00c074e5e8..94409fb05f 100644
|
|
--- a/guava-testlib/src/com/google/common/collect/testing/testers/MapRemoveTester.java
|
|
+++ b/guava-testlib/src/com/google/common/collect/testing/testers/MapRemoveTester.java
|
|
@@ -44,8 +44,8 @@ import org.junit.Ignore;
|
|
@GwtCompatible
|
|
@Ignore // Affects only Android test runner, which respects JUnit 4 annotations on JUnit 3 tests.
|
|
public class MapRemoveTester<K, V> extends AbstractMapTester<K, V> {
|
|
- @MapFeature.Require(SUPPORTS_REMOVE)
|
|
@CollectionSize.Require(absent = ZERO)
|
|
+ @MapFeature.Require(SUPPORTS_REMOVE)
|
|
public void testRemove_present() {
|
|
int initialSize = getMap().size();
|
|
assertEquals("remove(present) should return the associated value", v0(), getMap().remove(k0()));
|
|
@@ -54,8 +54,8 @@ public class MapRemoveTester<K, V> extends AbstractMapTester<K, V> {
|
|
expectMissing(e0());
|
|
}
|
|
|
|
- @MapFeature.Require({FAILS_FAST_ON_CONCURRENT_MODIFICATION, SUPPORTS_REMOVE})
|
|
@CollectionSize.Require(SEVERAL)
|
|
+ @MapFeature.Require({FAILS_FAST_ON_CONCURRENT_MODIFICATION, SUPPORTS_REMOVE})
|
|
public void testRemovePresentConcurrentWithEntrySetIteration() {
|
|
try {
|
|
Iterator<Entry<K, V>> iterator = getMap().entrySet().iterator();
|
|
@@ -67,8 +67,8 @@ public class MapRemoveTester<K, V> extends AbstractMapTester<K, V> {
|
|
}
|
|
}
|
|
|
|
- @MapFeature.Require({FAILS_FAST_ON_CONCURRENT_MODIFICATION, SUPPORTS_REMOVE})
|
|
@CollectionSize.Require(SEVERAL)
|
|
+ @MapFeature.Require({FAILS_FAST_ON_CONCURRENT_MODIFICATION, SUPPORTS_REMOVE})
|
|
public void testRemovePresentConcurrentWithKeySetIteration() {
|
|
try {
|
|
Iterator<K> iterator = getMap().keySet().iterator();
|
|
@@ -80,8 +80,8 @@ public class MapRemoveTester<K, V> extends AbstractMapTester<K, V> {
|
|
}
|
|
}
|
|
|
|
- @MapFeature.Require({FAILS_FAST_ON_CONCURRENT_MODIFICATION, SUPPORTS_REMOVE})
|
|
@CollectionSize.Require(SEVERAL)
|
|
+ @MapFeature.Require({FAILS_FAST_ON_CONCURRENT_MODIFICATION, SUPPORTS_REMOVE})
|
|
public void testRemovePresentConcurrentWithValuesIteration() {
|
|
try {
|
|
Iterator<V> iterator = getMap().values().iterator();
|
|
@@ -99,8 +99,8 @@ public class MapRemoveTester<K, V> extends AbstractMapTester<K, V> {
|
|
expectUnchanged();
|
|
}
|
|
|
|
- @MapFeature.Require({SUPPORTS_REMOVE, ALLOWS_NULL_KEYS})
|
|
@CollectionSize.Require(absent = ZERO)
|
|
+ @MapFeature.Require({ALLOWS_NULL_KEYS, SUPPORTS_REMOVE})
|
|
public void testRemove_nullPresent() {
|
|
initMapWithNullKey();
|
|
|
|
@@ -114,8 +114,8 @@ public class MapRemoveTester<K, V> extends AbstractMapTester<K, V> {
|
|
expectMissing(entry(null, getValueForNullKey()));
|
|
}
|
|
|
|
- @MapFeature.Require(absent = SUPPORTS_REMOVE)
|
|
@CollectionSize.Require(absent = ZERO)
|
|
+ @MapFeature.Require(absent = SUPPORTS_REMOVE)
|
|
public void testRemove_unsupported() {
|
|
try {
|
|
getMap().remove(k0());
|
|
@@ -148,7 +148,7 @@ public class MapRemoveTester<K, V> extends AbstractMapTester<K, V> {
|
|
expectUnchanged();
|
|
}
|
|
|
|
- @MapFeature.Require({SUPPORTS_REMOVE, ALLOWS_NULL_KEY_QUERIES})
|
|
+ @MapFeature.Require({ALLOWS_NULL_KEY_QUERIES, SUPPORTS_REMOVE})
|
|
public void testRemove_nullSupportedMissing() {
|
|
assertNull("remove(null) should return null", getMap().remove(null));
|
|
expectUnchanged();
|
|
diff --git a/guava-testlib/src/com/google/common/collect/testing/testers/MapReplaceAllTester.java b/guava-testlib/src/com/google/common/collect/testing/testers/MapReplaceAllTester.java
|
|
index eb37a60135..8283698f15 100644
|
|
--- a/guava-testlib/src/com/google/common/collect/testing/testers/MapReplaceAllTester.java
|
|
+++ b/guava-testlib/src/com/google/common/collect/testing/testers/MapReplaceAllTester.java
|
|
@@ -65,8 +65,8 @@ public class MapReplaceAllTester<K, V> extends AbstractMapTester<K, V> {
|
|
expectContents(expectedEntries);
|
|
}
|
|
|
|
- @MapFeature.Require(SUPPORTS_PUT)
|
|
@CollectionFeature.Require(KNOWN_ORDER)
|
|
+ @MapFeature.Require(SUPPORTS_PUT)
|
|
public void testReplaceAllPreservesOrder() {
|
|
getMap()
|
|
.replaceAll(
|
|
@@ -82,8 +82,8 @@ public class MapReplaceAllTester<K, V> extends AbstractMapTester<K, V> {
|
|
}
|
|
}
|
|
|
|
- @MapFeature.Require(absent = SUPPORTS_PUT)
|
|
@CollectionSize.Require(absent = ZERO)
|
|
+ @MapFeature.Require(absent = SUPPORTS_PUT)
|
|
public void testReplaceAll_unsupported() {
|
|
try {
|
|
getMap()
|
|
@@ -100,8 +100,8 @@ public class MapReplaceAllTester<K, V> extends AbstractMapTester<K, V> {
|
|
expectUnchanged();
|
|
}
|
|
|
|
- @MapFeature.Require(absent = SUPPORTS_PUT)
|
|
@CollectionSize.Require(ZERO)
|
|
+ @MapFeature.Require(absent = SUPPORTS_PUT)
|
|
public void testReplaceAll_unsupportedByEmptyCollection() {
|
|
try {
|
|
getMap()
|
|
diff --git a/guava-testlib/src/com/google/common/collect/testing/testers/MapReplaceEntryTester.java b/guava-testlib/src/com/google/common/collect/testing/testers/MapReplaceEntryTester.java
|
|
index 8a619da4db..4613fbe509 100644
|
|
--- a/guava-testlib/src/com/google/common/collect/testing/testers/MapReplaceEntryTester.java
|
|
+++ b/guava-testlib/src/com/google/common/collect/testing/testers/MapReplaceEntryTester.java
|
|
@@ -38,8 +38,8 @@ import org.junit.Ignore;
|
|
@Ignore // Affects only Android test runner, which respects JUnit 4 annotations on JUnit 3 tests.
|
|
public class MapReplaceEntryTester<K, V> extends AbstractMapTester<K, V> {
|
|
|
|
- @MapFeature.Require(SUPPORTS_PUT)
|
|
@CollectionSize.Require(absent = ZERO)
|
|
+ @MapFeature.Require(SUPPORTS_PUT)
|
|
public void testReplaceEntry_supportedPresent() {
|
|
try {
|
|
assertTrue(getMap().replace(k0(), v0(), v3()));
|
|
@@ -49,15 +49,15 @@ public class MapReplaceEntryTester<K, V> extends AbstractMapTester<K, V> {
|
|
}
|
|
}
|
|
|
|
- @MapFeature.Require(SUPPORTS_PUT)
|
|
@CollectionSize.Require(absent = ZERO)
|
|
+ @MapFeature.Require(SUPPORTS_PUT)
|
|
public void testReplaceEntry_supportedPresentUnchanged() {
|
|
assertTrue(getMap().replace(k0(), v0(), v0()));
|
|
expectUnchanged();
|
|
}
|
|
|
|
- @MapFeature.Require(SUPPORTS_PUT)
|
|
@CollectionSize.Require(absent = ZERO)
|
|
+ @MapFeature.Require(SUPPORTS_PUT)
|
|
public void testReplaceEntry_supportedWrongValue() {
|
|
assertFalse(getMap().replace(k0(), v3(), v4()));
|
|
expectUnchanged();
|
|
@@ -69,8 +69,8 @@ public class MapReplaceEntryTester<K, V> extends AbstractMapTester<K, V> {
|
|
expectUnchanged();
|
|
}
|
|
|
|
- @MapFeature.Require(value = SUPPORTS_PUT, absent = ALLOWS_NULL_VALUES)
|
|
@CollectionSize.Require(absent = ZERO)
|
|
+ @MapFeature.Require(value = SUPPORTS_PUT, absent = ALLOWS_NULL_VALUES)
|
|
public void testReplaceEntry_presentNullValueUnsupported() {
|
|
try {
|
|
getMap().replace(k0(), v0(), null);
|
|
@@ -80,8 +80,8 @@ public class MapReplaceEntryTester<K, V> extends AbstractMapTester<K, V> {
|
|
expectUnchanged();
|
|
}
|
|
|
|
- @MapFeature.Require(value = SUPPORTS_PUT, absent = ALLOWS_NULL_VALUE_QUERIES)
|
|
@CollectionSize.Require(absent = ZERO)
|
|
+ @MapFeature.Require(value = SUPPORTS_PUT, absent = ALLOWS_NULL_VALUE_QUERIES)
|
|
public void testReplaceEntry_wrongValueNullValueUnsupported() {
|
|
try {
|
|
assertFalse(getMap().replace(k0(), v3(), null));
|
|
@@ -101,7 +101,7 @@ public class MapReplaceEntryTester<K, V> extends AbstractMapTester<K, V> {
|
|
expectUnchanged();
|
|
}
|
|
|
|
- @MapFeature.Require({SUPPORTS_PUT, ALLOWS_NULL_VALUE_QUERIES})
|
|
+ @MapFeature.Require({ALLOWS_NULL_VALUE_QUERIES, SUPPORTS_PUT})
|
|
public void testReplaceEntry_nullDifferentFromAbsent() {
|
|
assertFalse(getMap().replace(k3(), null, v3()));
|
|
expectUnchanged();
|
|
@@ -117,8 +117,8 @@ public class MapReplaceEntryTester<K, V> extends AbstractMapTester<K, V> {
|
|
expectUnchanged();
|
|
}
|
|
|
|
- @MapFeature.Require(absent = SUPPORTS_PUT)
|
|
@CollectionSize.Require(absent = ZERO)
|
|
+ @MapFeature.Require(absent = SUPPORTS_PUT)
|
|
public void testReplaceEntry_unsupportedPresent() {
|
|
try {
|
|
getMap().replace(k0(), v0(), v3());
|
|
@@ -128,8 +128,8 @@ public class MapReplaceEntryTester<K, V> extends AbstractMapTester<K, V> {
|
|
expectUnchanged();
|
|
}
|
|
|
|
- @MapFeature.Require(absent = SUPPORTS_PUT)
|
|
@CollectionSize.Require(absent = ZERO)
|
|
+ @MapFeature.Require(absent = SUPPORTS_PUT)
|
|
public void testReplaceEntry_unsupportedWrongValue() {
|
|
try {
|
|
getMap().replace(k0(), v3(), v4());
|
|
diff --git a/guava-testlib/src/com/google/common/collect/testing/testers/MapReplaceTester.java b/guava-testlib/src/com/google/common/collect/testing/testers/MapReplaceTester.java
|
|
index b4101f2671..abb961fe82 100644
|
|
--- a/guava-testlib/src/com/google/common/collect/testing/testers/MapReplaceTester.java
|
|
+++ b/guava-testlib/src/com/google/common/collect/testing/testers/MapReplaceTester.java
|
|
@@ -39,8 +39,8 @@ import org.junit.Ignore;
|
|
@Ignore // Affects only Android test runner, which respects JUnit 4 annotations on JUnit 3 tests.
|
|
public class MapReplaceTester<K, V> extends AbstractMapTester<K, V> {
|
|
|
|
- @MapFeature.Require(SUPPORTS_PUT)
|
|
@CollectionSize.Require(absent = ZERO)
|
|
+ @MapFeature.Require(SUPPORTS_PUT)
|
|
public void testReplace_supportedPresent() {
|
|
try {
|
|
assertEquals(v0(), getMap().replace(k0(), v3()));
|
|
@@ -50,8 +50,8 @@ public class MapReplaceTester<K, V> extends AbstractMapTester<K, V> {
|
|
}
|
|
}
|
|
|
|
- @MapFeature.Require(SUPPORTS_PUT)
|
|
@CollectionSize.Require(absent = ZERO)
|
|
+ @MapFeature.Require(SUPPORTS_PUT)
|
|
public void testReplace_supportedPresentNoChange() {
|
|
assertEquals(v0(), getMap().replace(k0(), v0()));
|
|
expectUnchanged();
|
|
@@ -63,8 +63,8 @@ public class MapReplaceTester<K, V> extends AbstractMapTester<K, V> {
|
|
expectUnchanged();
|
|
}
|
|
|
|
- @MapFeature.Require(value = SUPPORTS_PUT, absent = ALLOWS_NULL_VALUES)
|
|
@CollectionSize.Require(absent = ZERO)
|
|
+ @MapFeature.Require(value = SUPPORTS_PUT, absent = ALLOWS_NULL_VALUES)
|
|
public void testReplace_presentNullValueUnsupported() {
|
|
try {
|
|
getMap().replace(k0(), null);
|
|
@@ -94,8 +94,8 @@ public class MapReplaceTester<K, V> extends AbstractMapTester<K, V> {
|
|
expectUnchanged();
|
|
}
|
|
|
|
- @MapFeature.Require(absent = SUPPORTS_PUT)
|
|
@CollectionSize.Require(absent = ZERO)
|
|
+ @MapFeature.Require(absent = SUPPORTS_PUT)
|
|
public void testReplace_unsupportedPresent() {
|
|
try {
|
|
getMap().replace(k0(), v3());
|
|
diff --git a/guava-testlib/src/com/google/common/collect/testing/testers/MapToStringTester.java b/guava-testlib/src/com/google/common/collect/testing/testers/MapToStringTester.java
|
|
index 429f8f4957..5ba3245f13 100644
|
|
--- a/guava-testlib/src/com/google/common/collect/testing/testers/MapToStringTester.java
|
|
+++ b/guava-testlib/src/com/google/common/collect/testing/testers/MapToStringTester.java
|
|
@@ -45,28 +45,28 @@ public class MapToStringTester<K, V> extends AbstractMapTester<K, V> {
|
|
assertNotNull("toString() should not return null", getMap().toString());
|
|
}
|
|
|
|
- @CollectionSize.Require(ZERO)
|
|
@CollectionFeature.Require(absent = NON_STANDARD_TOSTRING)
|
|
+ @CollectionSize.Require(ZERO)
|
|
public void testToString_size0() {
|
|
assertEquals("emptyMap.toString should return {}", "{}", getMap().toString());
|
|
}
|
|
|
|
- @CollectionSize.Require(ONE)
|
|
@CollectionFeature.Require(absent = NON_STANDARD_TOSTRING)
|
|
+ @CollectionSize.Require(ONE)
|
|
public void testToString_size1() {
|
|
assertEquals("size1Map.toString should return {entry}", "{" + e0() + "}", getMap().toString());
|
|
}
|
|
|
|
- @CollectionSize.Require(absent = ZERO)
|
|
@CollectionFeature.Require(absent = NON_STANDARD_TOSTRING)
|
|
+ @CollectionSize.Require(absent = ZERO)
|
|
@MapFeature.Require(ALLOWS_NULL_KEYS)
|
|
public void testToStringWithNullKey() {
|
|
initMapWithNullKey();
|
|
testToString_formatting();
|
|
}
|
|
|
|
- @CollectionSize.Require(absent = ZERO)
|
|
@CollectionFeature.Require(absent = NON_STANDARD_TOSTRING)
|
|
+ @CollectionSize.Require(absent = ZERO)
|
|
@MapFeature.Require(ALLOWS_NULL_VALUES)
|
|
public void testToStringWithNullValue() {
|
|
initMapWithNullValue();
|
|
diff --git a/guava-testlib/src/com/google/common/collect/testing/testers/NavigableMapNavigationTester.java b/guava-testlib/src/com/google/common/collect/testing/testers/NavigableMapNavigationTester.java
|
|
index ebb86b6156..0ba6be597c 100644
|
|
--- a/guava-testlib/src/com/google/common/collect/testing/testers/NavigableMapNavigationTester.java
|
|
+++ b/guava-testlib/src/com/google/common/collect/testing/testers/NavigableMapNavigationTester.java
|
|
@@ -20,6 +20,7 @@ import static com.google.common.collect.testing.features.CollectionSize.ONE;
|
|
import static com.google.common.collect.testing.features.CollectionSize.SEVERAL;
|
|
import static com.google.common.collect.testing.features.CollectionSize.ZERO;
|
|
import static com.google.common.collect.testing.features.MapFeature.SUPPORTS_REMOVE;
|
|
+import static java.util.Collections.reverse;
|
|
|
|
import com.google.common.annotations.GwtIncompatible;
|
|
import com.google.common.collect.testing.AbstractMapTester;
|
|
@@ -83,8 +84,8 @@ public class NavigableMapNavigationTester<K, V> extends AbstractMapTester<K, V>
|
|
assertNull(navigableMap.firstEntry());
|
|
}
|
|
|
|
- @MapFeature.Require(SUPPORTS_REMOVE)
|
|
@CollectionSize.Require(ZERO)
|
|
+ @MapFeature.Require(SUPPORTS_REMOVE)
|
|
public void testEmptyMapPollFirst() {
|
|
assertNull(navigableMap.pollFirstEntry());
|
|
}
|
|
@@ -106,8 +107,8 @@ public class NavigableMapNavigationTester<K, V> extends AbstractMapTester<K, V>
|
|
assertNull(navigableMap.lastEntry());
|
|
}
|
|
|
|
- @MapFeature.Require(SUPPORTS_REMOVE)
|
|
@CollectionSize.Require(ZERO)
|
|
+ @MapFeature.Require(SUPPORTS_REMOVE)
|
|
public void testEmptyMapPollLast() {
|
|
assertNull(navigableMap.pollLastEntry());
|
|
}
|
|
@@ -117,8 +118,8 @@ public class NavigableMapNavigationTester<K, V> extends AbstractMapTester<K, V>
|
|
assertEquals(a, navigableMap.firstEntry());
|
|
}
|
|
|
|
- @MapFeature.Require(SUPPORTS_REMOVE)
|
|
@CollectionSize.Require(ONE)
|
|
+ @MapFeature.Require(SUPPORTS_REMOVE)
|
|
public void testSingletonMapPollFirst() {
|
|
assertEquals(a, navigableMap.pollFirstEntry());
|
|
assertTrue(navigableMap.isEmpty());
|
|
@@ -141,8 +142,8 @@ public class NavigableMapNavigationTester<K, V> extends AbstractMapTester<K, V>
|
|
assertEquals(a, navigableMap.lastEntry());
|
|
}
|
|
|
|
- @MapFeature.Require(SUPPORTS_REMOVE)
|
|
@CollectionSize.Require(ONE)
|
|
+ @MapFeature.Require(SUPPORTS_REMOVE)
|
|
public void testSingletonMapPollLast() {
|
|
assertEquals(a, navigableMap.pollLastEntry());
|
|
assertTrue(navigableMap.isEmpty());
|
|
@@ -153,8 +154,8 @@ public class NavigableMapNavigationTester<K, V> extends AbstractMapTester<K, V>
|
|
assertEquals(a, navigableMap.firstEntry());
|
|
}
|
|
|
|
- @MapFeature.Require(SUPPORTS_REMOVE)
|
|
@CollectionSize.Require(SEVERAL)
|
|
+ @MapFeature.Require(SUPPORTS_REMOVE)
|
|
public void testPollFirst() {
|
|
assertEquals(a, navigableMap.pollFirstEntry());
|
|
assertEquals(entries.subList(1, entries.size()), Helpers.copyToList(navigableMap.entrySet()));
|
|
@@ -218,16 +219,16 @@ public class NavigableMapNavigationTester<K, V> extends AbstractMapTester<K, V>
|
|
assertEquals(c, navigableMap.lastEntry());
|
|
}
|
|
|
|
- @MapFeature.Require(SUPPORTS_REMOVE)
|
|
@CollectionSize.Require(SEVERAL)
|
|
+ @MapFeature.Require(SUPPORTS_REMOVE)
|
|
public void testPollLast() {
|
|
assertEquals(c, navigableMap.pollLastEntry());
|
|
assertEquals(
|
|
entries.subList(0, entries.size() - 1), Helpers.copyToList(navigableMap.entrySet()));
|
|
}
|
|
|
|
- @MapFeature.Require(absent = SUPPORTS_REMOVE)
|
|
@CollectionSize.Require(SEVERAL)
|
|
+ @MapFeature.Require(absent = SUPPORTS_REMOVE)
|
|
public void testPollLastUnsupported() {
|
|
try {
|
|
navigableMap.pollLastEntry();
|
|
@@ -239,7 +240,7 @@ public class NavigableMapNavigationTester<K, V> extends AbstractMapTester<K, V>
|
|
@CollectionSize.Require(SEVERAL)
|
|
public void testDescendingNavigation() {
|
|
List<Entry<K, V>> descending = new ArrayList<>(navigableMap.descendingMap().entrySet());
|
|
- Collections.reverse(descending);
|
|
+ reverse(descending);
|
|
assertEquals(entries, descending);
|
|
}
|
|
|
|
diff --git a/guava-testlib/src/com/google/common/collect/testing/testers/NavigableSetNavigationTester.java b/guava-testlib/src/com/google/common/collect/testing/testers/NavigableSetNavigationTester.java
|
|
index 8b056b4cb1..a0c08fb057 100644
|
|
--- a/guava-testlib/src/com/google/common/collect/testing/testers/NavigableSetNavigationTester.java
|
|
+++ b/guava-testlib/src/com/google/common/collect/testing/testers/NavigableSetNavigationTester.java
|
|
@@ -20,6 +20,7 @@ import static com.google.common.collect.testing.features.CollectionFeature.SUPPO
|
|
import static com.google.common.collect.testing.features.CollectionSize.ONE;
|
|
import static com.google.common.collect.testing.features.CollectionSize.SEVERAL;
|
|
import static com.google.common.collect.testing.features.CollectionSize.ZERO;
|
|
+import static java.util.Collections.reverse;
|
|
|
|
import com.google.common.annotations.GwtIncompatible;
|
|
import com.google.common.collect.testing.Helpers;
|
|
@@ -222,7 +223,7 @@ public class NavigableSetNavigationTester<E> extends AbstractSetTester<E> {
|
|
for (Iterator<E> i = navigableSet.descendingIterator(); i.hasNext(); ) {
|
|
descending.add(i.next());
|
|
}
|
|
- Collections.reverse(descending);
|
|
+ reverse(descending);
|
|
assertEquals(values, descending);
|
|
}
|
|
|
|
diff --git a/guava-testlib/src/com/google/common/collect/testing/testers/QueueOfferTester.java b/guava-testlib/src/com/google/common/collect/testing/testers/QueueOfferTester.java
|
|
index 3b17289538..cfbd0f9d05 100644
|
|
--- a/guava-testlib/src/com/google/common/collect/testing/testers/QueueOfferTester.java
|
|
+++ b/guava-testlib/src/com/google/common/collect/testing/testers/QueueOfferTester.java
|
|
@@ -39,7 +39,7 @@ public class QueueOfferTester<E> extends AbstractQueueTester<E> {
|
|
expectAdded(e3());
|
|
}
|
|
|
|
- @CollectionFeature.Require({SUPPORTS_ADD, ALLOWS_NULL_VALUES})
|
|
+ @CollectionFeature.Require({ALLOWS_NULL_VALUES, SUPPORTS_ADD})
|
|
public void testOffer_nullSupported() {
|
|
assertTrue("offer(null) should return true", getQueue().offer(null));
|
|
expectAdded((E) null);
|
|
diff --git a/guava-testlib/src/com/google/common/collect/testing/testers/SetAddTester.java b/guava-testlib/src/com/google/common/collect/testing/testers/SetAddTester.java
|
|
index 197496827e..f3905924df 100644
|
|
--- a/guava-testlib/src/com/google/common/collect/testing/testers/SetAddTester.java
|
|
+++ b/guava-testlib/src/com/google/common/collect/testing/testers/SetAddTester.java
|
|
@@ -44,7 +44,7 @@ public class SetAddTester<E> extends AbstractSetTester<E> {
|
|
expectUnchanged();
|
|
}
|
|
|
|
- @CollectionFeature.Require(value = {SUPPORTS_ADD, ALLOWS_NULL_VALUES})
|
|
+ @CollectionFeature.Require({ALLOWS_NULL_VALUES, SUPPORTS_ADD})
|
|
@CollectionSize.Require(absent = ZERO)
|
|
public void testAdd_supportedNullPresent() {
|
|
E[] array = createArrayWithNullElement();
|
|
diff --git a/guava-testlib/src/com/google/common/collect/testing/testers/SetCreationTester.java b/guava-testlib/src/com/google/common/collect/testing/testers/SetCreationTester.java
|
|
index 0c1be6b7ab..c9d29a7643 100644
|
|
--- a/guava-testlib/src/com/google/common/collect/testing/testers/SetCreationTester.java
|
|
+++ b/guava-testlib/src/com/google/common/collect/testing/testers/SetCreationTester.java
|
|
@@ -39,7 +39,7 @@ import org.junit.Ignore;
|
|
@Ignore // Affects only Android test runner, which respects JUnit 4 annotations on JUnit 3 tests.
|
|
public class SetCreationTester<E> extends AbstractSetTester<E> {
|
|
@CollectionFeature.Require(value = ALLOWS_NULL_VALUES, absent = REJECTS_DUPLICATES_AT_CREATION)
|
|
- @CollectionSize.Require(absent = {ZERO, ONE})
|
|
+ @CollectionSize.Require(absent = {ONE, ZERO})
|
|
public void testCreateWithDuplicates_nullDuplicatesNotRejected() {
|
|
E[] array = createArrayWithNullElement();
|
|
array[0] = null;
|
|
@@ -50,7 +50,7 @@ public class SetCreationTester<E> extends AbstractSetTester<E> {
|
|
}
|
|
|
|
@CollectionFeature.Require(absent = REJECTS_DUPLICATES_AT_CREATION)
|
|
- @CollectionSize.Require(absent = {ZERO, ONE})
|
|
+ @CollectionSize.Require(absent = {ONE, ZERO})
|
|
public void testCreateWithDuplicates_nonNullDuplicatesNotRejected() {
|
|
E[] array = createSamplesArray();
|
|
array[1] = e0();
|
|
@@ -61,7 +61,7 @@ public class SetCreationTester<E> extends AbstractSetTester<E> {
|
|
}
|
|
|
|
@CollectionFeature.Require({ALLOWS_NULL_VALUES, REJECTS_DUPLICATES_AT_CREATION})
|
|
- @CollectionSize.Require(absent = {ZERO, ONE})
|
|
+ @CollectionSize.Require(absent = {ONE, ZERO})
|
|
public void testCreateWithDuplicates_nullDuplicatesRejected() {
|
|
E[] array = createArrayWithNullElement();
|
|
array[0] = null;
|
|
@@ -73,7 +73,7 @@ public class SetCreationTester<E> extends AbstractSetTester<E> {
|
|
}
|
|
|
|
@CollectionFeature.Require(REJECTS_DUPLICATES_AT_CREATION)
|
|
- @CollectionSize.Require(absent = {ZERO, ONE})
|
|
+ @CollectionSize.Require(absent = {ONE, ZERO})
|
|
public void testCreateWithDuplicates_nonNullDuplicatesRejected() {
|
|
E[] array = createSamplesArray();
|
|
array[1] = e0();
|
|
diff --git a/guava-testlib/src/com/google/common/collect/testing/testers/SetEqualsTester.java b/guava-testlib/src/com/google/common/collect/testing/testers/SetEqualsTester.java
|
|
index 839e1737c7..7af49d5243 100644
|
|
--- a/guava-testlib/src/com/google/common/collect/testing/testers/SetEqualsTester.java
|
|
+++ b/guava-testlib/src/com/google/common/collect/testing/testers/SetEqualsTester.java
|
|
@@ -51,8 +51,8 @@ public class SetEqualsTester<E> extends AbstractSetTester<E> {
|
|
getSet().equals(MinimalSet.from(elements)));
|
|
}
|
|
|
|
- @CollectionSize.Require(absent = CollectionSize.ZERO)
|
|
@CollectionFeature.Require(ALLOWS_NULL_VALUES)
|
|
+ @CollectionSize.Require(absent = CollectionSize.ZERO)
|
|
public void testEquals_containingNull() {
|
|
Collection<E> elements = getSampleElements(getNumElements() - 1);
|
|
elements.add(null);
|
|
diff --git a/guava-testlib/src/com/google/common/collect/testing/testers/SetHashCodeTester.java b/guava-testlib/src/com/google/common/collect/testing/testers/SetHashCodeTester.java
|
|
index 5f60327d47..175bda03f5 100644
|
|
--- a/guava-testlib/src/com/google/common/collect/testing/testers/SetHashCodeTester.java
|
|
+++ b/guava-testlib/src/com/google/common/collect/testing/testers/SetHashCodeTester.java
|
|
@@ -46,8 +46,8 @@ public class SetHashCodeTester<E> extends AbstractSetTester<E> {
|
|
getSet().hashCode());
|
|
}
|
|
|
|
- @CollectionSize.Require(absent = CollectionSize.ZERO)
|
|
@CollectionFeature.Require(ALLOWS_NULL_VALUES)
|
|
+ @CollectionSize.Require(absent = CollectionSize.ZERO)
|
|
public void testHashCode_containingNull() {
|
|
Collection<E> elements = getSampleElements(getNumElements() - 1);
|
|
int expectedHashCode = 0;
|
|
diff --git a/guava-testlib/src/com/google/common/collect/testing/testers/SortedMapNavigationTester.java b/guava-testlib/src/com/google/common/collect/testing/testers/SortedMapNavigationTester.java
|
|
index 691fee139b..fda38a3fa0 100644
|
|
--- a/guava-testlib/src/com/google/common/collect/testing/testers/SortedMapNavigationTester.java
|
|
+++ b/guava-testlib/src/com/google/common/collect/testing/testers/SortedMapNavigationTester.java
|
|
@@ -172,8 +172,8 @@ public class SortedMapNavigationTester<K, V> extends AbstractMapTester<K, V> {
|
|
if (comparator == null) {
|
|
comparator =
|
|
new Comparator<K>() {
|
|
- @SuppressWarnings("unchecked")
|
|
@Override
|
|
+ @SuppressWarnings("unchecked")
|
|
public int compare(K o1, K o2) {
|
|
return ((Comparable) o1).compareTo(o2);
|
|
}
|
|
diff --git a/guava-testlib/src/com/google/common/testing/ArbitraryInstances.java b/guava-testlib/src/com/google/common/testing/ArbitraryInstances.java
|
|
index 1325d7f8c0..ed1628a486 100644
|
|
--- a/guava-testlib/src/com/google/common/testing/ArbitraryInstances.java
|
|
+++ b/guava-testlib/src/com/google/common/testing/ArbitraryInstances.java
|
|
@@ -17,6 +17,8 @@
|
|
package com.google.common.testing;
|
|
|
|
import static com.google.common.base.Preconditions.checkArgument;
|
|
+import static com.google.common.base.Predicates.alwaysTrue;
|
|
+import static java.util.UUID.randomUUID;
|
|
|
|
import com.google.common.annotations.GwtIncompatible;
|
|
import com.google.common.base.CharMatcher;
|
|
@@ -25,7 +27,6 @@ import com.google.common.base.Defaults;
|
|
import com.google.common.base.Equivalence;
|
|
import com.google.common.base.Joiner;
|
|
import com.google.common.base.Predicate;
|
|
-import com.google.common.base.Predicates;
|
|
import com.google.common.base.Splitter;
|
|
import com.google.common.base.Stopwatch;
|
|
import com.google.common.base.Ticker;
|
|
@@ -214,13 +215,13 @@ public final class ArbitraryInstances {
|
|
.put(OptionalInt.class, OptionalInt.empty())
|
|
.put(OptionalLong.class, OptionalLong.empty())
|
|
.put(OptionalDouble.class, OptionalDouble.empty())
|
|
- .put(UUID.class, UUID.randomUUID())
|
|
+ .put(UUID.class, randomUUID())
|
|
// common.base
|
|
.put(CharMatcher.class, CharMatcher.none())
|
|
.put(Joiner.class, Joiner.on(','))
|
|
.put(Splitter.class, Splitter.on(','))
|
|
.put(com.google.common.base.Optional.class, com.google.common.base.Optional.absent())
|
|
- .put(Predicate.class, Predicates.alwaysTrue())
|
|
+ .put(Predicate.class, alwaysTrue())
|
|
.put(Equivalence.class, Equivalence.equals())
|
|
.put(Ticker.class, Ticker.systemTicker())
|
|
.put(Stopwatch.class, Stopwatch.createUnstarted())
|
|
diff --git a/guava-testlib/src/com/google/common/testing/ClassSanityTester.java b/guava-testlib/src/com/google/common/testing/ClassSanityTester.java
|
|
index 0c8daf08e1..5902f87932 100644
|
|
--- a/guava-testlib/src/com/google/common/testing/ClassSanityTester.java
|
|
+++ b/guava-testlib/src/com/google/common/testing/ClassSanityTester.java
|
|
@@ -647,7 +647,7 @@ public final class ClassSanityTester {
|
|
|
|
// distinctValues is a type-safe class-values mapping, but we don't have a type-safe data
|
|
// structure to hold the mappings.
|
|
- @SuppressWarnings({"unchecked", "rawtypes"})
|
|
+ @SuppressWarnings({"rawtypes", "unchecked"})
|
|
private FreshValueGenerator newFreshValueGenerator() {
|
|
FreshValueGenerator generator =
|
|
new FreshValueGenerator() {
|
|
diff --git a/guava-testlib/src/com/google/common/testing/ClusterException.java b/guava-testlib/src/com/google/common/testing/ClusterException.java
|
|
index 688ffa5ab2..c7c0b0a418 100644
|
|
--- a/guava-testlib/src/com/google/common/testing/ClusterException.java
|
|
+++ b/guava-testlib/src/com/google/common/testing/ClusterException.java
|
|
@@ -16,11 +16,12 @@
|
|
|
|
package com.google.common.testing;
|
|
|
|
+import static java.util.Collections.unmodifiableCollection;
|
|
+
|
|
import com.google.common.annotations.GwtCompatible;
|
|
import java.util.ArrayList;
|
|
import java.util.Arrays;
|
|
import java.util.Collection;
|
|
-import java.util.Collections;
|
|
|
|
/**
|
|
* An {@link ClusterException} is a data structure that allows for some code to "throw multiple
|
|
@@ -68,7 +69,7 @@ final class ClusterException extends RuntimeException {
|
|
exceptions.size() + " exceptions were thrown. The first exception is listed as a cause.",
|
|
exceptions.iterator().next());
|
|
ArrayList<Throwable> temp = new ArrayList<>(exceptions);
|
|
- this.exceptions = Collections.unmodifiableCollection(temp);
|
|
+ this.exceptions = unmodifiableCollection(temp);
|
|
}
|
|
|
|
/**
|
|
diff --git a/guava-testlib/src/com/google/common/testing/CollectorTester.java b/guava-testlib/src/com/google/common/testing/CollectorTester.java
|
|
index ab6e544d8a..ffe0b13b64 100644
|
|
--- a/guava-testlib/src/com/google/common/testing/CollectorTester.java
|
|
+++ b/guava-testlib/src/com/google/common/testing/CollectorTester.java
|
|
@@ -17,12 +17,12 @@
|
|
package com.google.common.testing;
|
|
|
|
import static com.google.common.base.Preconditions.checkNotNull;
|
|
+import static java.util.Collections.reverse;
|
|
import static junit.framework.Assert.assertTrue;
|
|
|
|
import com.google.common.annotations.GwtCompatible;
|
|
import java.util.ArrayList;
|
|
import java.util.Arrays;
|
|
-import java.util.Collections;
|
|
import java.util.EnumSet;
|
|
import java.util.List;
|
|
import java.util.Objects;
|
|
@@ -142,7 +142,7 @@ public final class CollectorTester<T, A, R> {
|
|
List<T> list = Arrays.asList(inputs);
|
|
doExpectCollects(expectedResult, list);
|
|
if (collector.characteristics().contains(Collector.Characteristics.UNORDERED)) {
|
|
- Collections.reverse(list);
|
|
+ reverse(list);
|
|
doExpectCollects(expectedResult, list);
|
|
}
|
|
return this;
|
|
diff --git a/guava-testlib/src/com/google/common/testing/FreshValueGenerator.java b/guava-testlib/src/com/google/common/testing/FreshValueGenerator.java
|
|
index bb51e408b2..f88aefa81a 100644
|
|
--- a/guava-testlib/src/com/google/common/testing/FreshValueGenerator.java
|
|
+++ b/guava-testlib/src/com/google/common/testing/FreshValueGenerator.java
|
|
@@ -943,15 +943,15 @@ class FreshValueGenerator {
|
|
return table;
|
|
}
|
|
|
|
- @SuppressWarnings("rawtypes") // TreeBasedTable.create() is defined as such
|
|
- @Generates
|
|
+ @Generates // TreeBasedTable.create() is defined as such
|
|
+ @SuppressWarnings("rawtypes")
|
|
static <R extends Comparable, C extends Comparable, V>
|
|
RowSortedTable<R, C, V> generateRowSortedTable(R row, C column, V value) {
|
|
return generateTreeBasedTable(row, column, value);
|
|
}
|
|
|
|
- @SuppressWarnings("rawtypes") // TreeBasedTable.create() is defined as such
|
|
- @Generates
|
|
+ @Generates // TreeBasedTable.create() is defined as such
|
|
+ @SuppressWarnings("rawtypes")
|
|
static <R extends Comparable, C extends Comparable, V>
|
|
TreeBasedTable<R, C, V> generateTreeBasedTable(R row, C column, V value) {
|
|
TreeBasedTable<R, C, V> table = TreeBasedTable.create();
|
|
diff --git a/guava-testlib/src/com/google/common/testing/TestLogHandler.java b/guava-testlib/src/com/google/common/testing/TestLogHandler.java
|
|
index 41dca2ec8b..68a61861d1 100644
|
|
--- a/guava-testlib/src/com/google/common/testing/TestLogHandler.java
|
|
+++ b/guava-testlib/src/com/google/common/testing/TestLogHandler.java
|
|
@@ -16,9 +16,10 @@
|
|
|
|
package com.google.common.testing;
|
|
|
|
+import static java.util.Collections.unmodifiableList;
|
|
+
|
|
import com.google.common.annotations.GwtCompatible;
|
|
import java.util.ArrayList;
|
|
-import java.util.Collections;
|
|
import java.util.List;
|
|
import java.util.logging.Handler;
|
|
import java.util.logging.LogRecord;
|
|
@@ -82,6 +83,6 @@ public class TestLogHandler extends Handler {
|
|
*/
|
|
public synchronized List<LogRecord> getStoredLogRecords() {
|
|
List<LogRecord> result = new ArrayList<>(list);
|
|
- return Collections.unmodifiableList(result);
|
|
+ return unmodifiableList(result);
|
|
}
|
|
}
|
|
diff --git a/guava-testlib/src/com/google/common/util/concurrent/testing/AbstractListenableFutureTest.java b/guava-testlib/src/com/google/common/util/concurrent/testing/AbstractListenableFutureTest.java
|
|
index b5bec2c094..08ca9c83b1 100644
|
|
--- a/guava-testlib/src/com/google/common/util/concurrent/testing/AbstractListenableFutureTest.java
|
|
+++ b/guava-testlib/src/com/google/common/util/concurrent/testing/AbstractListenableFutureTest.java
|
|
@@ -204,7 +204,7 @@ public abstract class AbstractListenableFutureTest extends TestCase {
|
|
|
|
// Right in the middle start up a thread to close the latch.
|
|
if (i == 10) {
|
|
- new Thread(() -> latch.countDown()).start();
|
|
+ new Thread(latch::countDown).start();
|
|
}
|
|
|
|
future.addListener(listenerLatch::countDown, exec);
|
|
diff --git a/guava-testlib/src/com/google/common/util/concurrent/testing/SameThreadScheduledExecutorService.java b/guava-testlib/src/com/google/common/util/concurrent/testing/SameThreadScheduledExecutorService.java
|
|
index 25b7ef791c..bf08296ab3 100644
|
|
--- a/guava-testlib/src/com/google/common/util/concurrent/testing/SameThreadScheduledExecutorService.java
|
|
+++ b/guava-testlib/src/com/google/common/util/concurrent/testing/SameThreadScheduledExecutorService.java
|
|
@@ -16,10 +16,10 @@
|
|
|
|
package com.google.common.util.concurrent.testing;
|
|
|
|
+import static com.google.common.base.Preconditions.checkNotNull;
|
|
import static com.google.common.util.concurrent.MoreExecutors.newDirectExecutorService;
|
|
|
|
import com.google.common.annotations.GwtIncompatible;
|
|
-import com.google.common.base.Preconditions;
|
|
import com.google.common.util.concurrent.ForwardingListenableFuture.SimpleForwardingListenableFuture;
|
|
import com.google.common.util.concurrent.ListenableFuture;
|
|
import com.google.common.util.concurrent.ListenableScheduledFuture;
|
|
@@ -71,33 +71,33 @@ class SameThreadScheduledExecutorService extends AbstractExecutorService
|
|
|
|
@Override
|
|
public boolean awaitTermination(long timeout, TimeUnit unit) throws InterruptedException {
|
|
- Preconditions.checkNotNull(unit, "unit must not be null!");
|
|
+ checkNotNull(unit, "unit must not be null!");
|
|
return delegate.awaitTermination(timeout, unit);
|
|
}
|
|
|
|
@Override
|
|
public <T> ListenableFuture<T> submit(Callable<T> task) {
|
|
- Preconditions.checkNotNull(task, "task must not be null!");
|
|
+ checkNotNull(task, "task must not be null!");
|
|
return delegate.submit(task);
|
|
}
|
|
|
|
@Override
|
|
public <T> ListenableFuture<T> submit(Runnable task, T result) {
|
|
- Preconditions.checkNotNull(task, "task must not be null!");
|
|
- Preconditions.checkNotNull(result, "result must not be null!");
|
|
+ checkNotNull(task, "task must not be null!");
|
|
+ checkNotNull(result, "result must not be null!");
|
|
return delegate.submit(task, result);
|
|
}
|
|
|
|
@Override
|
|
public ListenableFuture<?> submit(Runnable task) {
|
|
- Preconditions.checkNotNull(task, "task must not be null!");
|
|
+ checkNotNull(task, "task must not be null!");
|
|
return delegate.submit(task);
|
|
}
|
|
|
|
@Override
|
|
public <T> List<Future<T>> invokeAll(Collection<? extends Callable<T>> tasks)
|
|
throws InterruptedException {
|
|
- Preconditions.checkNotNull(tasks, "tasks must not be null!");
|
|
+ checkNotNull(tasks, "tasks must not be null!");
|
|
return delegate.invokeAll(tasks);
|
|
}
|
|
|
|
@@ -105,44 +105,44 @@ class SameThreadScheduledExecutorService extends AbstractExecutorService
|
|
public <T> List<Future<T>> invokeAll(
|
|
Collection<? extends Callable<T>> tasks, long timeout, TimeUnit unit)
|
|
throws InterruptedException {
|
|
- Preconditions.checkNotNull(tasks, "tasks must not be null!");
|
|
- Preconditions.checkNotNull(unit, "unit must not be null!");
|
|
+ checkNotNull(tasks, "tasks must not be null!");
|
|
+ checkNotNull(unit, "unit must not be null!");
|
|
return delegate.invokeAll(tasks, timeout, unit);
|
|
}
|
|
|
|
@Override
|
|
public <T> T invokeAny(Collection<? extends Callable<T>> tasks)
|
|
throws InterruptedException, ExecutionException {
|
|
- Preconditions.checkNotNull(tasks, "tasks must not be null!");
|
|
+ checkNotNull(tasks, "tasks must not be null!");
|
|
return delegate.invokeAny(tasks);
|
|
}
|
|
|
|
@Override
|
|
public <T> T invokeAny(Collection<? extends Callable<T>> tasks, long timeout, TimeUnit unit)
|
|
throws InterruptedException, ExecutionException, TimeoutException {
|
|
- Preconditions.checkNotNull(tasks, "tasks must not be null!");
|
|
- Preconditions.checkNotNull(unit, "unit must not be null!");
|
|
+ checkNotNull(tasks, "tasks must not be null!");
|
|
+ checkNotNull(unit, "unit must not be null!");
|
|
return delegate.invokeAny(tasks, timeout, unit);
|
|
}
|
|
|
|
@Override
|
|
public void execute(Runnable command) {
|
|
- Preconditions.checkNotNull(command, "command must not be null!");
|
|
+ checkNotNull(command, "command must not be null!");
|
|
delegate.execute(command);
|
|
}
|
|
|
|
@Override
|
|
public ListenableScheduledFuture<?> schedule(Runnable command, long delay, TimeUnit unit) {
|
|
- Preconditions.checkNotNull(command, "command must not be null");
|
|
- Preconditions.checkNotNull(unit, "unit must not be null!");
|
|
+ checkNotNull(command, "command must not be null");
|
|
+ checkNotNull(unit, "unit must not be null!");
|
|
return schedule(java.util.concurrent.Executors.callable(command), delay, unit);
|
|
}
|
|
|
|
@Override
|
|
public <V> ListenableScheduledFuture<V> schedule(
|
|
Callable<V> callable, long delay, TimeUnit unit) {
|
|
- Preconditions.checkNotNull(callable, "callable must not be null!");
|
|
- Preconditions.checkNotNull(unit, "unit must not be null!");
|
|
+ checkNotNull(callable, "callable must not be null!");
|
|
+ checkNotNull(unit, "unit must not be null!");
|
|
ListenableFuture<V> delegateFuture = submit(callable);
|
|
return new ImmediateScheduledFuture<>(delegateFuture);
|
|
}
|
|
@@ -158,19 +158,19 @@ class SameThreadScheduledExecutorService extends AbstractExecutorService
|
|
@Override
|
|
public V get(long timeout, TimeUnit unit)
|
|
throws InterruptedException, ExecutionException, TimeoutException {
|
|
- Preconditions.checkNotNull(unit, "unit must not be null!");
|
|
+ checkNotNull(unit, "unit must not be null!");
|
|
return get();
|
|
}
|
|
|
|
@Override
|
|
public long getDelay(TimeUnit unit) {
|
|
- Preconditions.checkNotNull(unit, "unit must not be null!");
|
|
+ checkNotNull(unit, "unit must not be null!");
|
|
return 0;
|
|
}
|
|
|
|
@Override
|
|
public int compareTo(Delayed other) {
|
|
- Preconditions.checkNotNull(other, "other must not be null!");
|
|
+ checkNotNull(other, "other must not be null!");
|
|
return 0;
|
|
}
|
|
}
|
|
diff --git a/guava/src/com/google/common/base/Absent.java b/guava/src/com/google/common/base/Absent.java
|
|
index f96136b5ef..e028ef0eb2 100644
|
|
--- a/guava/src/com/google/common/base/Absent.java
|
|
+++ b/guava/src/com/google/common/base/Absent.java
|
|
@@ -15,9 +15,9 @@
|
|
package com.google.common.base;
|
|
|
|
import static com.google.common.base.Preconditions.checkNotNull;
|
|
+import static java.util.Collections.emptySet;
|
|
|
|
import com.google.common.annotations.GwtCompatible;
|
|
-import java.util.Collections;
|
|
import java.util.Set;
|
|
import javax.annotation.CheckForNull;
|
|
|
|
@@ -49,8 +49,8 @@ final class Absent<T> extends Optional<T> {
|
|
return checkNotNull(defaultValue, "use Optional.orNull() instead of Optional.or(null)");
|
|
}
|
|
|
|
- @SuppressWarnings("unchecked") // safe covariant cast
|
|
- @Override
|
|
+ @Override // safe covariant cast
|
|
+ @SuppressWarnings("unchecked")
|
|
public Optional<T> or(Optional<? extends T> secondChoice) {
|
|
return (Optional<T>) checkNotNull(secondChoice);
|
|
}
|
|
@@ -61,15 +61,15 @@ final class Absent<T> extends Optional<T> {
|
|
supplier.get(), "use Optional.orNull() instead of a Supplier that returns null");
|
|
}
|
|
|
|
- @Override
|
|
@CheckForNull
|
|
+ @Override
|
|
public T orNull() {
|
|
return null;
|
|
}
|
|
|
|
@Override
|
|
public Set<T> asSet() {
|
|
- return Collections.emptySet();
|
|
+ return emptySet();
|
|
}
|
|
|
|
@Override
|
|
diff --git a/guava/src/com/google/common/base/CharMatcher.java b/guava/src/com/google/common/base/CharMatcher.java
|
|
index 253bc6a22f..1cc8026aad 100644
|
|
--- a/guava/src/com/google/common/base/CharMatcher.java
|
|
+++ b/guava/src/com/google/common/base/CharMatcher.java
|
|
@@ -1739,8 +1739,8 @@ public abstract class CharMatcher implements Predicate<Character> {
|
|
return Arrays.binarySearch(chars, c) >= 0;
|
|
}
|
|
|
|
- @Override
|
|
- @GwtIncompatible // used only from other GwtIncompatible code
|
|
+ @GwtIncompatible
|
|
+ @Override // used only from other GwtIncompatible code
|
|
void setBits(BitSet table) {
|
|
for (char c : chars) {
|
|
table.set(c);
|
|
@@ -1805,8 +1805,8 @@ public abstract class CharMatcher implements Predicate<Character> {
|
|
return predicate.apply(c);
|
|
}
|
|
|
|
- @SuppressWarnings("deprecation") // intentional; deprecation is for callers primarily
|
|
- @Override
|
|
+ @Override // intentional; deprecation is for callers primarily
|
|
+ @SuppressWarnings("deprecation")
|
|
public boolean apply(Character character) {
|
|
return predicate.apply(checkNotNull(character));
|
|
}
|
|
diff --git a/guava/src/com/google/common/base/Converter.java b/guava/src/com/google/common/base/Converter.java
|
|
index 422480d164..f1ea113513 100644
|
|
--- a/guava/src/com/google/common/base/Converter.java
|
|
+++ b/guava/src/com/google/common/base/Converter.java
|
|
@@ -285,9 +285,9 @@ public abstract class Converter<A, B> implements Function<A, B> {
|
|
return fromIterator.hasNext();
|
|
}
|
|
|
|
- @Override
|
|
- @SuppressWarnings("nullness") // See code comments on convertAll and Converter.apply.
|
|
@CheckForNull
|
|
+ @Override // See code comments on convertAll and Converter.apply.
|
|
+ @SuppressWarnings("nullness")
|
|
public B next() {
|
|
return convert(fromIterator.next());
|
|
}
|
|
@@ -340,14 +340,14 @@ public abstract class Converter<A, B> implements Function<A, B> {
|
|
throw new AssertionError();
|
|
}
|
|
|
|
- @Override
|
|
@CheckForNull
|
|
+ @Override
|
|
A correctedDoForward(@CheckForNull B b) {
|
|
return original.correctedDoBackward(b);
|
|
}
|
|
|
|
- @Override
|
|
@CheckForNull
|
|
+ @Override
|
|
B correctedDoBackward(@CheckForNull A a) {
|
|
return original.correctedDoForward(a);
|
|
}
|
|
@@ -422,14 +422,14 @@ public abstract class Converter<A, B> implements Function<A, B> {
|
|
throw new AssertionError();
|
|
}
|
|
|
|
- @Override
|
|
@CheckForNull
|
|
+ @Override
|
|
C correctedDoForward(@CheckForNull A a) {
|
|
return second.correctedDoForward(first.correctedDoForward(a));
|
|
}
|
|
|
|
- @Override
|
|
@CheckForNull
|
|
+ @Override
|
|
A correctedDoBackward(@CheckForNull C c) {
|
|
return first.correctedDoBackward(second.correctedDoBackward(c));
|
|
}
|
|
@@ -459,9 +459,9 @@ public abstract class Converter<A, B> implements Function<A, B> {
|
|
/**
|
|
* @deprecated Provided to satisfy the {@code Function} interface; use {@link #convert} instead.
|
|
*/
|
|
- @Deprecated
|
|
- @Override
|
|
@CanIgnoreReturnValue
|
|
+ @CheckForNull
|
|
+ @Deprecated
|
|
/*
|
|
* Even though we implement `Function<A, B>` instead of `Function<@Nullable A, @Nullable B>` (as
|
|
* discussed in a code comment at the top of the class), we declare our override of Function.apply
|
|
@@ -492,9 +492,9 @@ public abstract class Converter<A, B> implements Function<A, B> {
|
|
* various hypothetical futures. (Plus, a tool that were that smart would likely already introduce
|
|
* problems with LegacyConverter.)
|
|
*/
|
|
- @SuppressWarnings("nullness")
|
|
- @CheckForNull
|
|
@InlineMe(replacement = "this.convert(a)")
|
|
+ @Override
|
|
+ @SuppressWarnings("nullness")
|
|
public final B apply(@CheckForNull A a) {
|
|
return convert(a);
|
|
}
|
|
diff --git a/guava/src/com/google/common/base/Defaults.java b/guava/src/com/google/common/base/Defaults.java
|
|
index 5d12343ed2..1737c88168 100644
|
|
--- a/guava/src/com/google/common/base/Defaults.java
|
|
+++ b/guava/src/com/google/common/base/Defaults.java
|
|
@@ -38,8 +38,8 @@ public final class Defaults {
|
|
* false} for {@code boolean} and {@code '\0'} for {@code char}. For non-primitive types and
|
|
* {@code void}, {@code null} is returned.
|
|
*/
|
|
- @SuppressWarnings("unchecked")
|
|
@CheckForNull
|
|
+ @SuppressWarnings("unchecked")
|
|
public static <T> T defaultValue(Class<T> type) {
|
|
checkNotNull(type);
|
|
if (type.isPrimitive()) {
|
|
diff --git a/guava/src/com/google/common/base/FinalizableReferenceQueue.java b/guava/src/com/google/common/base/FinalizableReferenceQueue.java
|
|
index 7447b8051d..70dfac8ed2 100644
|
|
--- a/guava/src/com/google/common/base/FinalizableReferenceQueue.java
|
|
+++ b/guava/src/com/google/common/base/FinalizableReferenceQueue.java
|
|
@@ -242,8 +242,8 @@ public class FinalizableReferenceQueue implements Closeable {
|
|
// finding Finalizer on the system class path even if it is there.
|
|
@VisibleForTesting static boolean disabled;
|
|
|
|
- @Override
|
|
@CheckForNull
|
|
+ @Override
|
|
public Class<?> loadFinalizer() {
|
|
if (disabled) {
|
|
return null;
|
|
@@ -280,8 +280,8 @@ public class FinalizableReferenceQueue implements Closeable {
|
|
+ "loader. To support reclaiming this class loader, either resolve the underlying "
|
|
+ "issue, or move Guava to your system class path.";
|
|
|
|
- @Override
|
|
@CheckForNull
|
|
+ @Override
|
|
public Class<?> loadFinalizer() {
|
|
try {
|
|
/*
|
|
diff --git a/guava/src/com/google/common/base/Function.java b/guava/src/com/google/common/base/Function.java
|
|
index 45287b744a..0844cf5360 100644
|
|
--- a/guava/src/com/google/common/base/Function.java
|
|
+++ b/guava/src/com/google/common/base/Function.java
|
|
@@ -45,8 +45,8 @@ import org.checkerframework.checker.nullness.qual.Nullable;
|
|
@ElementTypesAreNonnullByDefault
|
|
public interface Function<F extends @Nullable Object, T extends @Nullable Object>
|
|
extends java.util.function.Function<F, T> {
|
|
- @Override
|
|
- @CanIgnoreReturnValue // TODO(kevinb): remove this
|
|
+ @CanIgnoreReturnValue
|
|
+ @Override // TODO(kevinb): remove this
|
|
@ParametricNullness
|
|
T apply(@ParametricNullness F input);
|
|
|
|
diff --git a/guava/src/com/google/common/base/Functions.java b/guava/src/com/google/common/base/Functions.java
|
|
index 5710dcf054..c60e3d74bd 100644
|
|
--- a/guava/src/com/google/common/base/Functions.java
|
|
+++ b/guava/src/com/google/common/base/Functions.java
|
|
@@ -90,8 +90,8 @@ public final class Functions {
|
|
private enum IdentityFunction implements Function<@Nullable Object, @Nullable Object> {
|
|
INSTANCE;
|
|
|
|
- @Override
|
|
@CheckForNull
|
|
+ @Override
|
|
public Object apply(@CheckForNull Object o) {
|
|
return o;
|
|
}
|
|
diff --git a/guava/src/com/google/common/base/JdkPattern.java b/guava/src/com/google/common/base/JdkPattern.java
|
|
index 4788398b7c..a84f7e7479 100644
|
|
--- a/guava/src/com/google/common/base/JdkPattern.java
|
|
+++ b/guava/src/com/google/common/base/JdkPattern.java
|
|
@@ -14,6 +14,8 @@
|
|
|
|
package com.google.common.base;
|
|
|
|
+import static com.google.common.base.Preconditions.checkNotNull;
|
|
+
|
|
import com.google.common.annotations.GwtIncompatible;
|
|
import java.io.Serializable;
|
|
import java.util.regex.Matcher;
|
|
@@ -26,7 +28,7 @@ final class JdkPattern extends CommonPattern implements Serializable {
|
|
private final Pattern pattern;
|
|
|
|
JdkPattern(Pattern pattern) {
|
|
- this.pattern = Preconditions.checkNotNull(pattern);
|
|
+ this.pattern = checkNotNull(pattern);
|
|
}
|
|
|
|
@Override
|
|
@@ -53,7 +55,7 @@ final class JdkPattern extends CommonPattern implements Serializable {
|
|
final Matcher matcher;
|
|
|
|
JdkMatcher(Matcher matcher) {
|
|
- this.matcher = Preconditions.checkNotNull(matcher);
|
|
+ this.matcher = checkNotNull(matcher);
|
|
}
|
|
|
|
@Override
|
|
diff --git a/guava/src/com/google/common/base/Joiner.java b/guava/src/com/google/common/base/Joiner.java
|
|
index 8b29f68f8a..0e826848c7 100644
|
|
--- a/guava/src/com/google/common/base/Joiner.java
|
|
+++ b/guava/src/com/google/common/base/Joiner.java
|
|
@@ -501,8 +501,8 @@ public class Joiner {
|
|
return rest.length + 2;
|
|
}
|
|
|
|
- @Override
|
|
@CheckForNull
|
|
+ @Override
|
|
public Object get(int index) {
|
|
switch (index) {
|
|
case 0:
|
|
diff --git a/guava/src/com/google/common/base/Optional.java b/guava/src/com/google/common/base/Optional.java
|
|
index b47705e82f..8e19340919 100644
|
|
--- a/guava/src/com/google/common/base/Optional.java
|
|
+++ b/guava/src/com/google/common/base/Optional.java
|
|
@@ -342,8 +342,8 @@ public abstract class Optional<T> implements Serializable {
|
|
private final Iterator<? extends Optional<? extends T>> iterator =
|
|
checkNotNull(optionals.iterator());
|
|
|
|
- @Override
|
|
@CheckForNull
|
|
+ @Override
|
|
protected T computeNext() {
|
|
while (iterator.hasNext()) {
|
|
Optional<? extends T> optional = iterator.next();
|
|
diff --git a/guava/src/com/google/common/base/PairwiseEquivalence.java b/guava/src/com/google/common/base/PairwiseEquivalence.java
|
|
index 74be27fd7c..a9d2a4abcd 100644
|
|
--- a/guava/src/com/google/common/base/PairwiseEquivalence.java
|
|
+++ b/guava/src/com/google/common/base/PairwiseEquivalence.java
|
|
@@ -14,6 +14,8 @@
|
|
|
|
package com.google.common.base;
|
|
|
|
+import static com.google.common.base.Preconditions.checkNotNull;
|
|
+
|
|
import com.google.common.annotations.GwtCompatible;
|
|
import java.io.Serializable;
|
|
import java.util.Iterator;
|
|
@@ -27,7 +29,7 @@ final class PairwiseEquivalence<E, T extends @Nullable E> extends Equivalence<It
|
|
final Equivalence<E> elementEquivalence;
|
|
|
|
PairwiseEquivalence(Equivalence<E> elementEquivalence) {
|
|
- this.elementEquivalence = Preconditions.checkNotNull(elementEquivalence);
|
|
+ this.elementEquivalence = checkNotNull(elementEquivalence);
|
|
}
|
|
|
|
@Override
|
|
diff --git a/guava/src/com/google/common/base/Platform.java b/guava/src/com/google/common/base/Platform.java
|
|
index 644e89cbfa..cfd969f1f6 100644
|
|
--- a/guava/src/com/google/common/base/Platform.java
|
|
+++ b/guava/src/com/google/common/base/Platform.java
|
|
@@ -14,6 +14,8 @@
|
|
|
|
package com.google.common.base;
|
|
|
|
+import static com.google.common.base.Preconditions.checkNotNull;
|
|
+
|
|
import com.google.common.annotations.GwtCompatible;
|
|
import java.lang.ref.WeakReference;
|
|
import java.util.Locale;
|
|
@@ -81,7 +83,7 @@ final class Platform {
|
|
}
|
|
|
|
static CommonPattern compilePattern(String pattern) {
|
|
- Preconditions.checkNotNull(pattern);
|
|
+ checkNotNull(pattern);
|
|
return patternCompiler.compile(pattern);
|
|
}
|
|
|
|
diff --git a/guava/src/com/google/common/base/Predicates.java b/guava/src/com/google/common/base/Predicates.java
|
|
index 53598571d7..60902f5eec 100644
|
|
--- a/guava/src/com/google/common/base/Predicates.java
|
|
+++ b/guava/src/com/google/common/base/Predicates.java
|
|
@@ -195,8 +195,8 @@ public final class Predicates {
|
|
*
|
|
* @since 20.0 (since 10.0 under the incorrect name {@code assignableFrom})
|
|
*/
|
|
- @GwtIncompatible // Class.isAssignableFrom
|
|
- @Beta
|
|
+ @Beta // Class.isAssignableFrom
|
|
+ @GwtIncompatible
|
|
public static Predicate<Class<?>> subtypeOf(Class<?> clazz) {
|
|
return new SubtypeOfPredicate(clazz);
|
|
}
|
|
@@ -247,7 +247,7 @@ public final class Predicates {
|
|
*
|
|
* @since 3.0
|
|
*/
|
|
- @GwtIncompatible(value = "java.util.regex.Pattern")
|
|
+ @GwtIncompatible("java.util.regex.Pattern")
|
|
public static Predicate<CharSequence> contains(Pattern pattern) {
|
|
return new ContainsPatternPredicate(new JdkPattern(pattern));
|
|
}
|
|
diff --git a/guava/src/com/google/common/base/Present.java b/guava/src/com/google/common/base/Present.java
|
|
index 4e62da29e9..8eb17181c0 100644
|
|
--- a/guava/src/com/google/common/base/Present.java
|
|
+++ b/guava/src/com/google/common/base/Present.java
|
|
@@ -15,9 +15,9 @@
|
|
package com.google.common.base;
|
|
|
|
import static com.google.common.base.Preconditions.checkNotNull;
|
|
+import static java.util.Collections.singleton;
|
|
|
|
import com.google.common.annotations.GwtCompatible;
|
|
-import java.util.Collections;
|
|
import java.util.Set;
|
|
import javax.annotation.CheckForNull;
|
|
|
|
@@ -66,7 +66,7 @@ final class Present<T> extends Optional<T> {
|
|
|
|
@Override
|
|
public Set<T> asSet() {
|
|
- return Collections.singleton(reference);
|
|
+ return singleton(reference);
|
|
}
|
|
|
|
@Override
|
|
diff --git a/guava/src/com/google/common/base/Splitter.java b/guava/src/com/google/common/base/Splitter.java
|
|
index e60e9887df..db11edf7a4 100644
|
|
--- a/guava/src/com/google/common/base/Splitter.java
|
|
+++ b/guava/src/com/google/common/base/Splitter.java
|
|
@@ -16,12 +16,13 @@ package com.google.common.base;
|
|
|
|
import static com.google.common.base.Preconditions.checkArgument;
|
|
import static com.google.common.base.Preconditions.checkNotNull;
|
|
+import static java.util.Collections.unmodifiableList;
|
|
+import static java.util.Collections.unmodifiableMap;
|
|
|
|
import com.google.common.annotations.Beta;
|
|
import com.google.common.annotations.GwtCompatible;
|
|
import com.google.common.annotations.GwtIncompatible;
|
|
import java.util.ArrayList;
|
|
-import java.util.Collections;
|
|
import java.util.Iterator;
|
|
import java.util.LinkedHashMap;
|
|
import java.util.List;
|
|
@@ -422,7 +423,7 @@ public final class Splitter {
|
|
result.add(iterator.next());
|
|
}
|
|
|
|
- return Collections.unmodifiableList(result);
|
|
+ return unmodifiableList(result);
|
|
}
|
|
|
|
/**
|
|
@@ -531,7 +532,7 @@ public final class Splitter {
|
|
|
|
checkArgument(!entryFields.hasNext(), INVALID_ENTRY_MESSAGE, entry);
|
|
}
|
|
- return Collections.unmodifiableMap(map);
|
|
+ return unmodifiableMap(map);
|
|
}
|
|
}
|
|
|
|
diff --git a/guava/src/com/google/common/base/Suppliers.java b/guava/src/com/google/common/base/Suppliers.java
|
|
index 6ced905b98..f16d6d4f66 100644
|
|
--- a/guava/src/com/google/common/base/Suppliers.java
|
|
+++ b/guava/src/com/google/common/base/Suppliers.java
|
|
@@ -378,8 +378,8 @@ public final class Suppliers {
|
|
INSTANCE;
|
|
|
|
// Note: This makes T a "pass-through type"
|
|
- @Override
|
|
@CheckForNull
|
|
+ @Override
|
|
public Object apply(Supplier<@Nullable Object> input) {
|
|
return input.get();
|
|
}
|
|
diff --git a/guava/src/com/google/common/base/Throwables.java b/guava/src/com/google/common/base/Throwables.java
|
|
index e45ce800cb..3464a28737 100644
|
|
--- a/guava/src/com/google/common/base/Throwables.java
|
|
+++ b/guava/src/com/google/common/base/Throwables.java
|
|
@@ -30,7 +30,6 @@ import java.lang.reflect.InvocationTargetException;
|
|
import java.lang.reflect.Method;
|
|
import java.util.AbstractList;
|
|
import java.util.ArrayList;
|
|
-import java.util.Collections;
|
|
import java.util.List;
|
|
import javax.annotation.CheckForNull;
|
|
|
|
@@ -235,8 +234,8 @@ public final class Throwables {
|
|
* {@code Throwables.propagate}</a>.
|
|
*/
|
|
@CanIgnoreReturnValue
|
|
- @GwtIncompatible
|
|
@Deprecated
|
|
+ @GwtIncompatible
|
|
public static RuntimeException propagate(Throwable throwable) {
|
|
throwIfUnchecked(throwable);
|
|
throw new RuntimeException(throwable);
|
|
@@ -312,7 +311,7 @@ public final class Throwables {
|
|
}
|
|
advanceSlowPointer = !advanceSlowPointer; // only advance every other iteration
|
|
}
|
|
- return Collections.unmodifiableList(causes);
|
|
+ return unmodifiableList(causes);
|
|
}
|
|
|
|
/**
|
|
@@ -328,8 +327,8 @@ public final class Throwables {
|
|
* ClassCastException}'s cause is {@code throwable}.
|
|
* @since 22.0
|
|
*/
|
|
- @GwtIncompatible // Class.cast(Object)
|
|
- @CheckForNull
|
|
+ @CheckForNull // Class.cast(Object)
|
|
+ @GwtIncompatible
|
|
public static <X extends Throwable> X getCauseAs(
|
|
Throwable throwable, Class<X> expectedCauseType) {
|
|
try {
|
|
@@ -481,8 +480,8 @@ public final class Throwables {
|
|
* Returns the JavaLangAccess class that is present in all Sun JDKs. It is not allowed in
|
|
* AppEngine, and not present in non-Sun JDKs.
|
|
*/
|
|
- @GwtIncompatible // java.lang.reflect
|
|
- @CheckForNull
|
|
+ @CheckForNull // java.lang.reflect
|
|
+ @GwtIncompatible
|
|
private static Object getJLA() {
|
|
try {
|
|
/*
|
|
@@ -507,8 +506,8 @@ public final class Throwables {
|
|
* Returns the Method that can be used to resolve an individual StackTraceElement, or null if that
|
|
* method cannot be found (it is only to be found in fairly recent JDKs).
|
|
*/
|
|
- @GwtIncompatible // java.lang.reflect
|
|
- @CheckForNull
|
|
+ @CheckForNull // java.lang.reflect
|
|
+ @GwtIncompatible
|
|
private static Method getGetMethod() {
|
|
return getJlaMethod("getStackTraceElement", Throwable.class, int.class);
|
|
}
|
|
@@ -522,8 +521,8 @@ public final class Throwables {
|
|
* <p>See <a href="https://github.com/google/guava/issues/2887">Throwables#lazyStackTrace throws
|
|
* UnsupportedOperationException</a>.
|
|
*/
|
|
- @GwtIncompatible // java.lang.reflect
|
|
- @CheckForNull
|
|
+ @CheckForNull // java.lang.reflect
|
|
+ @GwtIncompatible
|
|
private static Method getSizeMethod(Object jla) {
|
|
try {
|
|
Method getStackTraceDepth = getJlaMethod("getStackTraceDepth", Throwable.class);
|
|
@@ -537,8 +536,8 @@ public final class Throwables {
|
|
}
|
|
}
|
|
|
|
- @GwtIncompatible // java.lang.reflect
|
|
- @CheckForNull
|
|
+ @CheckForNull // java.lang.reflect
|
|
+ @GwtIncompatible
|
|
private static Method getJlaMethod(String name, Class<?>... parameterTypes) throws ThreadDeath {
|
|
try {
|
|
return Class.forName(JAVA_LANG_ACCESS_CLASSNAME, false, null).getMethod(name, parameterTypes);
|
|
diff --git a/guava/src/com/google/common/base/internal/Finalizer.java b/guava/src/com/google/common/base/internal/Finalizer.java
|
|
index b45ec15787..342cf0ab99 100644
|
|
--- a/guava/src/com/google/common/base/internal/Finalizer.java
|
|
+++ b/guava/src/com/google/common/base/internal/Finalizer.java
|
|
@@ -138,8 +138,8 @@ public class Finalizer implements Runnable {
|
|
}
|
|
|
|
/** Loops continuously, pulling references off the queue and cleaning them up. */
|
|
- @SuppressWarnings("InfiniteLoopStatement")
|
|
@Override
|
|
+ @SuppressWarnings("InfiniteLoopStatement")
|
|
public void run() {
|
|
while (true) {
|
|
try {
|
|
diff --git a/guava/src/com/google/common/cache/AbstractCache.java b/guava/src/com/google/common/cache/AbstractCache.java
|
|
index 42829c0b23..bd389562fc 100644
|
|
--- a/guava/src/com/google/common/cache/AbstractCache.java
|
|
+++ b/guava/src/com/google/common/cache/AbstractCache.java
|
|
@@ -234,15 +234,15 @@ public abstract class AbstractCache<K, V> implements Cache<K, V> {
|
|
missCount.add(count);
|
|
}
|
|
|
|
- @SuppressWarnings("GoodTime") // b/122668874
|
|
- @Override
|
|
+ @Override // b/122668874
|
|
+ @SuppressWarnings("GoodTime")
|
|
public void recordLoadSuccess(long loadTime) {
|
|
loadSuccessCount.increment();
|
|
totalLoadTime.add(loadTime);
|
|
}
|
|
|
|
- @SuppressWarnings("GoodTime") // b/122668874
|
|
- @Override
|
|
+ @Override // b/122668874
|
|
+ @SuppressWarnings("GoodTime")
|
|
public void recordLoadException(long loadTime) {
|
|
loadExceptionCount.increment();
|
|
totalLoadTime.add(loadTime);
|
|
diff --git a/guava/src/com/google/common/cache/CacheBuilder.java b/guava/src/com/google/common/cache/CacheBuilder.java
|
|
index 0ccb9c8c45..64889baa77 100644
|
|
--- a/guava/src/com/google/common/cache/CacheBuilder.java
|
|
+++ b/guava/src/com/google/common/cache/CacheBuilder.java
|
|
@@ -212,12 +212,12 @@ public final class CacheBuilder<K, V> {
|
|
@Override
|
|
public void recordMisses(int count) {}
|
|
|
|
- @SuppressWarnings("GoodTime") // b/122668874
|
|
- @Override
|
|
+ @Override // b/122668874
|
|
+ @SuppressWarnings("GoodTime")
|
|
public void recordLoadSuccess(long loadTime) {}
|
|
|
|
- @SuppressWarnings("GoodTime") // b/122668874
|
|
- @Override
|
|
+ @Override // b/122668874
|
|
+ @SuppressWarnings("GoodTime")
|
|
public void recordLoadException(long loadTime) {}
|
|
|
|
@Override
|
|
@@ -313,8 +313,8 @@ public final class CacheBuilder<K, V> {
|
|
*
|
|
* @since 12.0
|
|
*/
|
|
- @GwtIncompatible // To be supported
|
|
- @CheckReturnValue
|
|
+ @CheckReturnValue // To be supported
|
|
+ @GwtIncompatible
|
|
public static CacheBuilder<Object, Object> from(CacheBuilderSpec spec) {
|
|
return spec.toCacheBuilder().lenientParsing();
|
|
}
|
|
@@ -326,8 +326,8 @@ public final class CacheBuilder<K, V> {
|
|
* @param spec a String in the format specified by {@link CacheBuilderSpec}
|
|
* @since 12.0
|
|
*/
|
|
- @GwtIncompatible // To be supported
|
|
- @CheckReturnValue
|
|
+ @CheckReturnValue // To be supported
|
|
+ @GwtIncompatible
|
|
public static CacheBuilder<Object, Object> from(String spec) {
|
|
return from(CacheBuilderSpec.parse(spec));
|
|
}
|
|
@@ -695,8 +695,8 @@ public final class CacheBuilder<K, V> {
|
|
* @throws ArithmeticException for durations greater than +/- approximately 292 years
|
|
* @since 25.0
|
|
*/
|
|
- @J2ObjCIncompatible
|
|
- @GwtIncompatible // java.time.Duration
|
|
+ @GwtIncompatible
|
|
+ @J2ObjCIncompatible // java.time.Duration
|
|
@SuppressWarnings("GoodTime") // java.time.Duration decomposition
|
|
public CacheBuilder<K, V> expireAfterWrite(java.time.Duration duration) {
|
|
return expireAfterWrite(toNanosSaturated(duration), TimeUnit.NANOSECONDS);
|
|
@@ -765,8 +765,8 @@ public final class CacheBuilder<K, V> {
|
|
* @throws ArithmeticException for durations greater than +/- approximately 292 years
|
|
* @since 25.0
|
|
*/
|
|
- @J2ObjCIncompatible
|
|
- @GwtIncompatible // java.time.Duration
|
|
+ @GwtIncompatible
|
|
+ @J2ObjCIncompatible // java.time.Duration
|
|
@SuppressWarnings("GoodTime") // java.time.Duration decomposition
|
|
public CacheBuilder<K, V> expireAfterAccess(java.time.Duration duration) {
|
|
return expireAfterAccess(toNanosSaturated(duration), TimeUnit.NANOSECONDS);
|
|
@@ -843,8 +843,8 @@ public final class CacheBuilder<K, V> {
|
|
* @throws ArithmeticException for durations greater than +/- approximately 292 years
|
|
* @since 25.0
|
|
*/
|
|
- @J2ObjCIncompatible
|
|
- @GwtIncompatible // java.time.Duration
|
|
+ @GwtIncompatible
|
|
+ @J2ObjCIncompatible // java.time.Duration
|
|
@SuppressWarnings("GoodTime") // java.time.Duration decomposition
|
|
public CacheBuilder<K, V> refreshAfterWrite(java.time.Duration duration) {
|
|
return refreshAfterWrite(toNanosSaturated(duration), TimeUnit.NANOSECONDS);
|
|
diff --git a/guava/src/com/google/common/cache/ForwardingCache.java b/guava/src/com/google/common/cache/ForwardingCache.java
|
|
index 2d3a2b5fd2..9988243074 100644
|
|
--- a/guava/src/com/google/common/cache/ForwardingCache.java
|
|
+++ b/guava/src/com/google/common/cache/ForwardingCache.java
|
|
@@ -14,8 +14,9 @@
|
|
|
|
package com.google.common.cache;
|
|
|
|
+import static com.google.common.base.Preconditions.checkNotNull;
|
|
+
|
|
import com.google.common.annotations.GwtIncompatible;
|
|
-import com.google.common.base.Preconditions;
|
|
import com.google.common.collect.ForwardingObject;
|
|
import com.google.common.collect.ImmutableMap;
|
|
import java.util.Map;
|
|
@@ -45,8 +46,8 @@ public abstract class ForwardingCache<K, V> extends ForwardingObject implements
|
|
/**
|
|
* @since 11.0
|
|
*/
|
|
- @Override
|
|
@CheckForNull
|
|
+ @Override
|
|
public V getIfPresent(Object key) {
|
|
return delegate().getIfPresent(key);
|
|
}
|
|
@@ -136,7 +137,7 @@ public abstract class ForwardingCache<K, V> extends ForwardingObject implements
|
|
private final Cache<K, V> delegate;
|
|
|
|
protected SimpleForwardingCache(Cache<K, V> delegate) {
|
|
- this.delegate = Preconditions.checkNotNull(delegate);
|
|
+ this.delegate = checkNotNull(delegate);
|
|
}
|
|
|
|
@Override
|
|
diff --git a/guava/src/com/google/common/cache/ForwardingLoadingCache.java b/guava/src/com/google/common/cache/ForwardingLoadingCache.java
|
|
index ecd44ca8d8..78d0bb911d 100644
|
|
--- a/guava/src/com/google/common/cache/ForwardingLoadingCache.java
|
|
+++ b/guava/src/com/google/common/cache/ForwardingLoadingCache.java
|
|
@@ -14,8 +14,9 @@
|
|
|
|
package com.google.common.cache;
|
|
|
|
+import static com.google.common.base.Preconditions.checkNotNull;
|
|
+
|
|
import com.google.common.annotations.GwtIncompatible;
|
|
-import com.google.common.base.Preconditions;
|
|
import com.google.common.collect.ImmutableMap;
|
|
import java.util.concurrent.ExecutionException;
|
|
|
|
@@ -77,7 +78,7 @@ public abstract class ForwardingLoadingCache<K, V> extends ForwardingCache<K, V>
|
|
private final LoadingCache<K, V> delegate;
|
|
|
|
protected SimpleForwardingLoadingCache(LoadingCache<K, V> delegate) {
|
|
- this.delegate = Preconditions.checkNotNull(delegate);
|
|
+ this.delegate = checkNotNull(delegate);
|
|
}
|
|
|
|
@Override
|
|
diff --git a/guava/src/com/google/common/cache/LocalCache.java b/guava/src/com/google/common/cache/LocalCache.java
|
|
index 584298e4da..4bd3b963ea 100644
|
|
--- a/guava/src/com/google/common/cache/LocalCache.java
|
|
+++ b/guava/src/com/google/common/cache/LocalCache.java
|
|
@@ -3374,8 +3374,8 @@ class LocalCache<K, V> extends AbstractMap<K, V> implements ConcurrentMap<K, V>
|
|
}
|
|
}
|
|
|
|
- @VisibleForTesting
|
|
@GuardedBy("this")
|
|
+ @VisibleForTesting
|
|
boolean removeEntry(ReferenceEntry<K, V> entry, int hash, RemovalCause cause) {
|
|
int newCount = this.count - 1;
|
|
AtomicReferenceArray<ReferenceEntry<K, V>> table = this.table;
|
|
@@ -4299,8 +4299,8 @@ class LocalCache<K, V> extends AbstractMap<K, V> implements ConcurrentMap<K, V>
|
|
|
|
@RetainedWith @Nullable Set<Entry<K, V>> entrySet;
|
|
|
|
- @Override
|
|
- @GwtIncompatible // Not supported.
|
|
+ @GwtIncompatible
|
|
+ @Override // Not supported.
|
|
public Set<Entry<K, V>> entrySet() {
|
|
// does not impact recency ordering
|
|
Set<Entry<K, V>> es = entrySet;
|
|
diff --git a/guava/src/com/google/common/collect/AbstractBiMap.java b/guava/src/com/google/common/collect/AbstractBiMap.java
|
|
index bf97e1a7c8..b8b39bc14a 100644
|
|
--- a/guava/src/com/google/common/collect/AbstractBiMap.java
|
|
+++ b/guava/src/com/google/common/collect/AbstractBiMap.java
|
|
@@ -117,15 +117,15 @@ abstract class AbstractBiMap<K extends @Nullable Object, V extends @Nullable Obj
|
|
// Modification Operations
|
|
|
|
@CanIgnoreReturnValue
|
|
- @Override
|
|
@CheckForNull
|
|
+ @Override
|
|
public V put(@ParametricNullness K key, @ParametricNullness V value) {
|
|
return putInBothMaps(key, value, false);
|
|
}
|
|
|
|
@CanIgnoreReturnValue
|
|
- @Override
|
|
@CheckForNull
|
|
+ @Override
|
|
public V forcePut(@ParametricNullness K key, @ParametricNullness V value) {
|
|
return putInBothMaps(key, value, true);
|
|
}
|
|
@@ -161,8 +161,8 @@ abstract class AbstractBiMap<K extends @Nullable Object, V extends @Nullable Obj
|
|
}
|
|
|
|
@CanIgnoreReturnValue
|
|
- @Override
|
|
@CheckForNull
|
|
+ @Override
|
|
public V remove(@CheckForNull Object key) {
|
|
return containsKey(key) ? removeFromBothMaps(key) : null;
|
|
}
|
|
diff --git a/guava/src/com/google/common/collect/AbstractListMultimap.java b/guava/src/com/google/common/collect/AbstractListMultimap.java
|
|
index 46c4ee2448..51cf8c4d11 100644
|
|
--- a/guava/src/com/google/common/collect/AbstractListMultimap.java
|
|
+++ b/guava/src/com/google/common/collect/AbstractListMultimap.java
|
|
@@ -16,10 +16,12 @@
|
|
|
|
package com.google.common.collect;
|
|
|
|
+import static java.util.Collections.emptyList;
|
|
+import static java.util.Collections.unmodifiableList;
|
|
+
|
|
import com.google.common.annotations.GwtCompatible;
|
|
import com.google.errorprone.annotations.CanIgnoreReturnValue;
|
|
import java.util.Collection;
|
|
-import java.util.Collections;
|
|
import java.util.List;
|
|
import java.util.Map;
|
|
import javax.annotation.CheckForNull;
|
|
@@ -51,13 +53,13 @@ abstract class AbstractListMultimap<K extends @Nullable Object, V extends @Nulla
|
|
|
|
@Override
|
|
List<V> createUnmodifiableEmptyCollection() {
|
|
- return Collections.emptyList();
|
|
+ return emptyList();
|
|
}
|
|
|
|
@Override
|
|
<E extends @Nullable Object> Collection<E> unmodifiableCollectionSubclass(
|
|
Collection<E> collection) {
|
|
- return Collections.unmodifiableList((List<E>) collection);
|
|
+ return unmodifiableList((List<E>) collection);
|
|
}
|
|
|
|
@Override
|
|
diff --git a/guava/src/com/google/common/collect/AbstractMapBasedMultimap.java b/guava/src/com/google/common/collect/AbstractMapBasedMultimap.java
|
|
index 4c5a0f0418..32c78b6a85 100644
|
|
--- a/guava/src/com/google/common/collect/AbstractMapBasedMultimap.java
|
|
+++ b/guava/src/com/google/common/collect/AbstractMapBasedMultimap.java
|
|
@@ -20,6 +20,7 @@ import static com.google.common.base.Preconditions.checkArgument;
|
|
import static com.google.common.base.Preconditions.checkNotNull;
|
|
import static com.google.common.base.Preconditions.checkState;
|
|
import static com.google.common.collect.NullnessCasts.uncheckedCastNullableTToT;
|
|
+import static java.util.Collections.unmodifiableCollection;
|
|
import static java.util.Objects.requireNonNull;
|
|
|
|
import com.google.common.annotations.GwtCompatible;
|
|
@@ -28,7 +29,6 @@ import com.google.j2objc.annotations.WeakOuter;
|
|
import java.io.Serializable;
|
|
import java.util.AbstractCollection;
|
|
import java.util.Collection;
|
|
-import java.util.Collections;
|
|
import java.util.Comparator;
|
|
import java.util.ConcurrentModificationException;
|
|
import java.util.Iterator;
|
|
@@ -266,7 +266,7 @@ abstract class AbstractMapBasedMultimap<K extends @Nullable Object, V extends @N
|
|
|
|
<E extends @Nullable Object> Collection<E> unmodifiableCollectionSubclass(
|
|
Collection<E> collection) {
|
|
- return Collections.unmodifiableCollection(collection);
|
|
+ return unmodifiableCollection(collection);
|
|
}
|
|
|
|
@Override
|
|
@@ -635,8 +635,8 @@ abstract class AbstractMapBasedMultimap<K extends @Nullable Object, V extends @N
|
|
return (SortedSet<V>) getDelegate();
|
|
}
|
|
|
|
- @Override
|
|
@CheckForNull
|
|
+ @Override
|
|
public Comparator<? super V> comparator() {
|
|
return getSortedSetDelegate().comparator();
|
|
}
|
|
@@ -697,38 +697,38 @@ abstract class AbstractMapBasedMultimap<K extends @Nullable Object, V extends @N
|
|
return (NavigableSet<V>) super.getSortedSetDelegate();
|
|
}
|
|
|
|
- @Override
|
|
@CheckForNull
|
|
+ @Override
|
|
public V lower(@ParametricNullness V v) {
|
|
return getSortedSetDelegate().lower(v);
|
|
}
|
|
|
|
- @Override
|
|
@CheckForNull
|
|
+ @Override
|
|
public V floor(@ParametricNullness V v) {
|
|
return getSortedSetDelegate().floor(v);
|
|
}
|
|
|
|
- @Override
|
|
@CheckForNull
|
|
+ @Override
|
|
public V ceiling(@ParametricNullness V v) {
|
|
return getSortedSetDelegate().ceiling(v);
|
|
}
|
|
|
|
- @Override
|
|
@CheckForNull
|
|
+ @Override
|
|
public V higher(@ParametricNullness V v) {
|
|
return getSortedSetDelegate().higher(v);
|
|
}
|
|
|
|
- @Override
|
|
@CheckForNull
|
|
+ @Override
|
|
public V pollFirst() {
|
|
return Iterators.pollNext(iterator());
|
|
}
|
|
|
|
- @Override
|
|
@CheckForNull
|
|
+ @Override
|
|
public V pollLast() {
|
|
return Iterators.pollNext(descendingIterator());
|
|
}
|
|
@@ -1028,8 +1028,8 @@ abstract class AbstractMapBasedMultimap<K extends @Nullable Object, V extends @N
|
|
return (SortedMap<K, Collection<V>>) super.map();
|
|
}
|
|
|
|
- @Override
|
|
@CheckForNull
|
|
+ @Override
|
|
public Comparator<? super K> comparator() {
|
|
return sortedMap().comparator();
|
|
}
|
|
@@ -1073,38 +1073,38 @@ abstract class AbstractMapBasedMultimap<K extends @Nullable Object, V extends @N
|
|
return (NavigableMap<K, Collection<V>>) super.sortedMap();
|
|
}
|
|
|
|
- @Override
|
|
@CheckForNull
|
|
+ @Override
|
|
public K lower(@ParametricNullness K k) {
|
|
return sortedMap().lowerKey(k);
|
|
}
|
|
|
|
- @Override
|
|
@CheckForNull
|
|
+ @Override
|
|
public K floor(@ParametricNullness K k) {
|
|
return sortedMap().floorKey(k);
|
|
}
|
|
|
|
- @Override
|
|
@CheckForNull
|
|
+ @Override
|
|
public K ceiling(@ParametricNullness K k) {
|
|
return sortedMap().ceilingKey(k);
|
|
}
|
|
|
|
- @Override
|
|
@CheckForNull
|
|
+ @Override
|
|
public K higher(@ParametricNullness K k) {
|
|
return sortedMap().higherKey(k);
|
|
}
|
|
|
|
- @Override
|
|
@CheckForNull
|
|
+ @Override
|
|
public K pollFirst() {
|
|
return Iterators.pollNext(iterator());
|
|
}
|
|
|
|
- @Override
|
|
@CheckForNull
|
|
+ @Override
|
|
public K pollLast() {
|
|
return Iterators.pollNext(descendingIterator());
|
|
}
|
|
@@ -1361,8 +1361,8 @@ abstract class AbstractMapBasedMultimap<K extends @Nullable Object, V extends @N
|
|
return Maps.safeContainsKey(submap, key);
|
|
}
|
|
|
|
- @Override
|
|
@CheckForNull
|
|
+ @Override
|
|
public Collection<V> get(@CheckForNull Object key) {
|
|
Collection<V> collection = Maps.safeGet(submap, key);
|
|
if (collection == null) {
|
|
@@ -1383,8 +1383,8 @@ abstract class AbstractMapBasedMultimap<K extends @Nullable Object, V extends @N
|
|
return submap.size();
|
|
}
|
|
|
|
- @Override
|
|
@CheckForNull
|
|
+ @Override
|
|
public Collection<V> remove(@CheckForNull Object key) {
|
|
Collection<V> collection = submap.remove(key);
|
|
if (collection == null) {
|
|
@@ -1501,8 +1501,8 @@ abstract class AbstractMapBasedMultimap<K extends @Nullable Object, V extends @N
|
|
return (SortedMap<K, Collection<V>>) submap;
|
|
}
|
|
|
|
- @Override
|
|
@CheckForNull
|
|
+ @Override
|
|
public Comparator<? super K> comparator() {
|
|
return sortedMap().comparator();
|
|
}
|
|
@@ -1562,80 +1562,80 @@ abstract class AbstractMapBasedMultimap<K extends @Nullable Object, V extends @N
|
|
return (NavigableMap<K, Collection<V>>) super.sortedMap();
|
|
}
|
|
|
|
- @Override
|
|
@CheckForNull
|
|
+ @Override
|
|
public Entry<K, Collection<V>> lowerEntry(@ParametricNullness K key) {
|
|
Entry<K, Collection<V>> entry = sortedMap().lowerEntry(key);
|
|
return (entry == null) ? null : wrapEntry(entry);
|
|
}
|
|
|
|
- @Override
|
|
@CheckForNull
|
|
+ @Override
|
|
public K lowerKey(@ParametricNullness K key) {
|
|
return sortedMap().lowerKey(key);
|
|
}
|
|
|
|
- @Override
|
|
@CheckForNull
|
|
+ @Override
|
|
public Entry<K, Collection<V>> floorEntry(@ParametricNullness K key) {
|
|
Entry<K, Collection<V>> entry = sortedMap().floorEntry(key);
|
|
return (entry == null) ? null : wrapEntry(entry);
|
|
}
|
|
|
|
- @Override
|
|
@CheckForNull
|
|
+ @Override
|
|
public K floorKey(@ParametricNullness K key) {
|
|
return sortedMap().floorKey(key);
|
|
}
|
|
|
|
- @Override
|
|
@CheckForNull
|
|
+ @Override
|
|
public Entry<K, Collection<V>> ceilingEntry(@ParametricNullness K key) {
|
|
Entry<K, Collection<V>> entry = sortedMap().ceilingEntry(key);
|
|
return (entry == null) ? null : wrapEntry(entry);
|
|
}
|
|
|
|
- @Override
|
|
@CheckForNull
|
|
+ @Override
|
|
public K ceilingKey(@ParametricNullness K key) {
|
|
return sortedMap().ceilingKey(key);
|
|
}
|
|
|
|
- @Override
|
|
@CheckForNull
|
|
+ @Override
|
|
public Entry<K, Collection<V>> higherEntry(@ParametricNullness K key) {
|
|
Entry<K, Collection<V>> entry = sortedMap().higherEntry(key);
|
|
return (entry == null) ? null : wrapEntry(entry);
|
|
}
|
|
|
|
- @Override
|
|
@CheckForNull
|
|
+ @Override
|
|
public K higherKey(@ParametricNullness K key) {
|
|
return sortedMap().higherKey(key);
|
|
}
|
|
|
|
- @Override
|
|
@CheckForNull
|
|
+ @Override
|
|
public Entry<K, Collection<V>> firstEntry() {
|
|
Entry<K, Collection<V>> entry = sortedMap().firstEntry();
|
|
return (entry == null) ? null : wrapEntry(entry);
|
|
}
|
|
|
|
- @Override
|
|
@CheckForNull
|
|
+ @Override
|
|
public Entry<K, Collection<V>> lastEntry() {
|
|
Entry<K, Collection<V>> entry = sortedMap().lastEntry();
|
|
return (entry == null) ? null : wrapEntry(entry);
|
|
}
|
|
|
|
- @Override
|
|
@CheckForNull
|
|
+ @Override
|
|
public Entry<K, Collection<V>> pollFirstEntry() {
|
|
return pollAsMapEntry(entrySet().iterator());
|
|
}
|
|
|
|
- @Override
|
|
@CheckForNull
|
|
+ @Override
|
|
public Entry<K, Collection<V>> pollLastEntry() {
|
|
return pollAsMapEntry(descendingMap().entrySet().iterator());
|
|
}
|
|
diff --git a/guava/src/com/google/common/collect/AbstractNavigableMap.java b/guava/src/com/google/common/collect/AbstractNavigableMap.java
|
|
index 47048d06ac..83733923f6 100644
|
|
--- a/guava/src/com/google/common/collect/AbstractNavigableMap.java
|
|
+++ b/guava/src/com/google/common/collect/AbstractNavigableMap.java
|
|
@@ -37,30 +37,30 @@ import org.checkerframework.checker.nullness.qual.Nullable;
|
|
abstract class AbstractNavigableMap<K extends @Nullable Object, V extends @Nullable Object>
|
|
extends IteratorBasedAbstractMap<K, V> implements NavigableMap<K, V> {
|
|
|
|
- @Override
|
|
@CheckForNull
|
|
+ @Override
|
|
public abstract V get(@CheckForNull Object key);
|
|
|
|
- @Override
|
|
@CheckForNull
|
|
+ @Override
|
|
public Entry<K, V> firstEntry() {
|
|
return Iterators.getNext(entryIterator(), null);
|
|
}
|
|
|
|
- @Override
|
|
@CheckForNull
|
|
+ @Override
|
|
public Entry<K, V> lastEntry() {
|
|
return Iterators.getNext(descendingEntryIterator(), null);
|
|
}
|
|
|
|
- @Override
|
|
@CheckForNull
|
|
+ @Override
|
|
public Entry<K, V> pollFirstEntry() {
|
|
return Iterators.pollNext(entryIterator());
|
|
}
|
|
|
|
- @Override
|
|
@CheckForNull
|
|
+ @Override
|
|
public Entry<K, V> pollLastEntry() {
|
|
return Iterators.pollNext(descendingEntryIterator());
|
|
}
|
|
@@ -87,50 +87,50 @@ abstract class AbstractNavigableMap<K extends @Nullable Object, V extends @Nulla
|
|
}
|
|
}
|
|
|
|
- @Override
|
|
@CheckForNull
|
|
+ @Override
|
|
public Entry<K, V> lowerEntry(@ParametricNullness K key) {
|
|
return headMap(key, false).lastEntry();
|
|
}
|
|
|
|
- @Override
|
|
@CheckForNull
|
|
+ @Override
|
|
public Entry<K, V> floorEntry(@ParametricNullness K key) {
|
|
return headMap(key, true).lastEntry();
|
|
}
|
|
|
|
- @Override
|
|
@CheckForNull
|
|
+ @Override
|
|
public Entry<K, V> ceilingEntry(@ParametricNullness K key) {
|
|
return tailMap(key, true).firstEntry();
|
|
}
|
|
|
|
- @Override
|
|
@CheckForNull
|
|
+ @Override
|
|
public Entry<K, V> higherEntry(@ParametricNullness K key) {
|
|
return tailMap(key, false).firstEntry();
|
|
}
|
|
|
|
- @Override
|
|
@CheckForNull
|
|
+ @Override
|
|
public K lowerKey(@ParametricNullness K key) {
|
|
return Maps.keyOrNull(lowerEntry(key));
|
|
}
|
|
|
|
- @Override
|
|
@CheckForNull
|
|
+ @Override
|
|
public K floorKey(@ParametricNullness K key) {
|
|
return Maps.keyOrNull(floorEntry(key));
|
|
}
|
|
|
|
- @Override
|
|
@CheckForNull
|
|
+ @Override
|
|
public K ceilingKey(@ParametricNullness K key) {
|
|
return Maps.keyOrNull(ceilingEntry(key));
|
|
}
|
|
|
|
- @Override
|
|
@CheckForNull
|
|
+ @Override
|
|
public K higherKey(@ParametricNullness K key) {
|
|
return Maps.keyOrNull(higherEntry(key));
|
|
}
|
|
diff --git a/guava/src/com/google/common/collect/AbstractRangeSet.java b/guava/src/com/google/common/collect/AbstractRangeSet.java
|
|
index d112a11f18..8ce6cac8da 100644
|
|
--- a/guava/src/com/google/common/collect/AbstractRangeSet.java
|
|
+++ b/guava/src/com/google/common/collect/AbstractRangeSet.java
|
|
@@ -32,8 +32,8 @@ abstract class AbstractRangeSet<C extends Comparable> implements RangeSet<C> {
|
|
return rangeContaining(value) != null;
|
|
}
|
|
|
|
- @Override
|
|
@CheckForNull
|
|
+ @Override
|
|
public abstract Range<C> rangeContaining(C value);
|
|
|
|
@Override
|
|
diff --git a/guava/src/com/google/common/collect/AbstractSetMultimap.java b/guava/src/com/google/common/collect/AbstractSetMultimap.java
|
|
index 90aa9dcb2f..08e5315c7c 100644
|
|
--- a/guava/src/com/google/common/collect/AbstractSetMultimap.java
|
|
+++ b/guava/src/com/google/common/collect/AbstractSetMultimap.java
|
|
@@ -16,10 +16,12 @@
|
|
|
|
package com.google.common.collect;
|
|
|
|
+import static java.util.Collections.emptySet;
|
|
+import static java.util.Collections.unmodifiableSet;
|
|
+
|
|
import com.google.common.annotations.GwtCompatible;
|
|
import com.google.errorprone.annotations.CanIgnoreReturnValue;
|
|
import java.util.Collection;
|
|
-import java.util.Collections;
|
|
import java.util.Map;
|
|
import java.util.Map.Entry;
|
|
import java.util.Set;
|
|
@@ -51,13 +53,13 @@ abstract class AbstractSetMultimap<K extends @Nullable Object, V extends @Nullab
|
|
|
|
@Override
|
|
Set<V> createUnmodifiableEmptyCollection() {
|
|
- return Collections.emptySet();
|
|
+ return emptySet();
|
|
}
|
|
|
|
@Override
|
|
<E extends @Nullable Object> Collection<E> unmodifiableCollectionSubclass(
|
|
Collection<E> collection) {
|
|
- return Collections.unmodifiableSet((Set<E>) collection);
|
|
+ return unmodifiableSet((Set<E>) collection);
|
|
}
|
|
|
|
@Override
|
|
diff --git a/guava/src/com/google/common/collect/AbstractSortedMultiset.java b/guava/src/com/google/common/collect/AbstractSortedMultiset.java
|
|
index 621e8f98a5..688fcc49d3 100644
|
|
--- a/guava/src/com/google/common/collect/AbstractSortedMultiset.java
|
|
+++ b/guava/src/com/google/common/collect/AbstractSortedMultiset.java
|
|
@@ -64,22 +64,22 @@ abstract class AbstractSortedMultiset<E extends @Nullable Object> extends Abstra
|
|
return comparator;
|
|
}
|
|
|
|
- @Override
|
|
@CheckForNull
|
|
+ @Override
|
|
public Entry<E> firstEntry() {
|
|
Iterator<Entry<E>> entryIterator = entryIterator();
|
|
return entryIterator.hasNext() ? entryIterator.next() : null;
|
|
}
|
|
|
|
- @Override
|
|
@CheckForNull
|
|
+ @Override
|
|
public Entry<E> lastEntry() {
|
|
Iterator<Entry<E>> entryIterator = descendingEntryIterator();
|
|
return entryIterator.hasNext() ? entryIterator.next() : null;
|
|
}
|
|
|
|
- @Override
|
|
@CheckForNull
|
|
+ @Override
|
|
public Entry<E> pollFirstEntry() {
|
|
Iterator<Entry<E>> entryIterator = entryIterator();
|
|
if (entryIterator.hasNext()) {
|
|
@@ -91,8 +91,8 @@ abstract class AbstractSortedMultiset<E extends @Nullable Object> extends Abstra
|
|
return null;
|
|
}
|
|
|
|
- @Override
|
|
@CheckForNull
|
|
+ @Override
|
|
public Entry<E> pollLastEntry() {
|
|
Iterator<Entry<E>> entryIterator = descendingEntryIterator();
|
|
if (entryIterator.hasNext()) {
|
|
diff --git a/guava/src/com/google/common/collect/AbstractSortedSetMultimap.java b/guava/src/com/google/common/collect/AbstractSortedSetMultimap.java
|
|
index 32316133a0..e83c22e8fc 100644
|
|
--- a/guava/src/com/google/common/collect/AbstractSortedSetMultimap.java
|
|
+++ b/guava/src/com/google/common/collect/AbstractSortedSetMultimap.java
|
|
@@ -16,10 +16,11 @@
|
|
|
|
package com.google.common.collect;
|
|
|
|
+import static java.util.Collections.unmodifiableSortedSet;
|
|
+
|
|
import com.google.common.annotations.GwtCompatible;
|
|
import com.google.errorprone.annotations.CanIgnoreReturnValue;
|
|
import java.util.Collection;
|
|
-import java.util.Collections;
|
|
import java.util.Map;
|
|
import java.util.NavigableSet;
|
|
import java.util.SortedSet;
|
|
@@ -60,7 +61,7 @@ abstract class AbstractSortedSetMultimap<K extends @Nullable Object, V extends @
|
|
if (collection instanceof NavigableSet) {
|
|
return Sets.unmodifiableNavigableSet((NavigableSet<E>) collection);
|
|
} else {
|
|
- return Collections.unmodifiableSortedSet((SortedSet<E>) collection);
|
|
+ return unmodifiableSortedSet((SortedSet<E>) collection);
|
|
}
|
|
}
|
|
|
|
diff --git a/guava/src/com/google/common/collect/AbstractTable.java b/guava/src/com/google/common/collect/AbstractTable.java
|
|
index 99a1215906..5cc9ca4306 100644
|
|
--- a/guava/src/com/google/common/collect/AbstractTable.java
|
|
+++ b/guava/src/com/google/common/collect/AbstractTable.java
|
|
@@ -75,8 +75,8 @@ abstract class AbstractTable<
|
|
return row != null && Maps.safeContainsKey(row, columnKey);
|
|
}
|
|
|
|
- @Override
|
|
@CheckForNull
|
|
+ @Override
|
|
public V get(@CheckForNull Object rowKey, @CheckForNull Object columnKey) {
|
|
Map<C, V> row = Maps.safeGet(rowMap(), rowKey);
|
|
return (row == null) ? null : Maps.safeGet(row, columnKey);
|
|
@@ -93,16 +93,16 @@ abstract class AbstractTable<
|
|
}
|
|
|
|
@CanIgnoreReturnValue
|
|
- @Override
|
|
@CheckForNull
|
|
+ @Override
|
|
public V remove(@CheckForNull Object rowKey, @CheckForNull Object columnKey) {
|
|
Map<C, V> row = Maps.safeGet(rowMap(), rowKey);
|
|
return (row == null) ? null : Maps.safeRemove(row, columnKey);
|
|
}
|
|
|
|
@CanIgnoreReturnValue
|
|
- @Override
|
|
@CheckForNull
|
|
+ @Override
|
|
public V put(
|
|
@ParametricNullness R rowKey, @ParametricNullness C columnKey, @ParametricNullness V value) {
|
|
return row(rowKey).put(columnKey, value);
|
|
diff --git a/guava/src/com/google/common/collect/AllEqualOrdering.java b/guava/src/com/google/common/collect/AllEqualOrdering.java
|
|
index f6ca6faff7..dfb7c1f4af 100644
|
|
--- a/guava/src/com/google/common/collect/AllEqualOrdering.java
|
|
+++ b/guava/src/com/google/common/collect/AllEqualOrdering.java
|
|
@@ -48,8 +48,8 @@ final class AllEqualOrdering extends Ordering<@Nullable Object> implements Seria
|
|
return ImmutableList.copyOf(iterable);
|
|
}
|
|
|
|
- @SuppressWarnings("unchecked")
|
|
@Override
|
|
+ @SuppressWarnings("unchecked")
|
|
public <S extends @Nullable Object> Ordering<S> reverse() {
|
|
return (Ordering<S>) this;
|
|
}
|
|
diff --git a/guava/src/com/google/common/collect/ArrayTable.java b/guava/src/com/google/common/collect/ArrayTable.java
|
|
index 1349386d68..9eca162b46 100644
|
|
--- a/guava/src/com/google/common/collect/ArrayTable.java
|
|
+++ b/guava/src/com/google/common/collect/ArrayTable.java
|
|
@@ -276,8 +276,8 @@ public final class ArrayTable<R, C, V> extends AbstractTable<R, C, @Nullable V>
|
|
}
|
|
}
|
|
|
|
- @Override
|
|
@CheckForNull
|
|
+ @Override
|
|
public V put(K key, @ParametricNullness V value) {
|
|
Integer index = keyIndex.get(key);
|
|
if (index == null) {
|
|
@@ -287,8 +287,8 @@ public final class ArrayTable<R, C, V> extends AbstractTable<R, C, @Nullable V>
|
|
return setValue(index, value);
|
|
}
|
|
|
|
- @Override
|
|
@CheckForNull
|
|
+ @Override
|
|
public V remove(@CheckForNull Object key) {
|
|
throw new UnsupportedOperationException();
|
|
}
|
|
@@ -385,9 +385,9 @@ public final class ArrayTable<R, C, V> extends AbstractTable<R, C, @Nullable V>
|
|
* @throws UnsupportedOperationException always
|
|
* @deprecated Use {@link #eraseAll}
|
|
*/
|
|
+ @Deprecated
|
|
@DoNotCall("Always throws UnsupportedOperationException")
|
|
@Override
|
|
- @Deprecated
|
|
public void clear() {
|
|
throw new UnsupportedOperationException();
|
|
}
|
|
@@ -438,8 +438,8 @@ public final class ArrayTable<R, C, V> extends AbstractTable<R, C, @Nullable V>
|
|
return false;
|
|
}
|
|
|
|
- @Override
|
|
@CheckForNull
|
|
+ @Override
|
|
public V get(@CheckForNull Object rowKey, @CheckForNull Object columnKey) {
|
|
Integer rowIndex = rowKeyToIndex.get(rowKey);
|
|
Integer columnIndex = columnKeyToIndex.get(columnKey);
|
|
@@ -461,8 +461,8 @@ public final class ArrayTable<R, C, V> extends AbstractTable<R, C, @Nullable V>
|
|
* columnKey} is not in {@link #columnKeySet()}.
|
|
*/
|
|
@CanIgnoreReturnValue
|
|
- @Override
|
|
@CheckForNull
|
|
+ @Override
|
|
public V put(R rowKey, C columnKey, @CheckForNull V value) {
|
|
checkNotNull(rowKey);
|
|
checkNotNull(columnKey);
|
|
@@ -499,11 +499,11 @@ public final class ArrayTable<R, C, V> extends AbstractTable<R, C, @Nullable V>
|
|
* @throws UnsupportedOperationException always
|
|
* @deprecated Use {@link #erase}
|
|
*/
|
|
- @DoNotCall("Always throws UnsupportedOperationException")
|
|
@CanIgnoreReturnValue
|
|
- @Override
|
|
- @Deprecated
|
|
@CheckForNull
|
|
+ @Deprecated
|
|
+ @DoNotCall("Always throws UnsupportedOperationException")
|
|
+ @Override
|
|
public V remove(@CheckForNull Object rowKey, @CheckForNull Object columnKey) {
|
|
throw new UnsupportedOperationException();
|
|
}
|
|
@@ -586,8 +586,8 @@ public final class ArrayTable<R, C, V> extends AbstractTable<R, C, @Nullable V>
|
|
return columnList.get(columnIndex);
|
|
}
|
|
|
|
- @Override
|
|
@CheckForNull
|
|
+ @Override
|
|
public V getValue() {
|
|
return at(rowIndex, columnIndex);
|
|
}
|
|
@@ -636,14 +636,14 @@ public final class ArrayTable<R, C, V> extends AbstractTable<R, C, @Nullable V>
|
|
return "Row";
|
|
}
|
|
|
|
- @Override
|
|
@CheckForNull
|
|
+ @Override
|
|
V getValue(int index) {
|
|
return at(index, columnIndex);
|
|
}
|
|
|
|
- @Override
|
|
@CheckForNull
|
|
+ @Override
|
|
V setValue(int index, @CheckForNull V newValue) {
|
|
return set(index, columnIndex, newValue);
|
|
}
|
|
@@ -689,8 +689,8 @@ public final class ArrayTable<R, C, V> extends AbstractTable<R, C, @Nullable V>
|
|
throw new UnsupportedOperationException();
|
|
}
|
|
|
|
- @Override
|
|
@CheckForNull
|
|
+ @Override
|
|
public Map<R, @Nullable V> put(C key, Map<R, @Nullable V> value) {
|
|
throw new UnsupportedOperationException();
|
|
}
|
|
@@ -731,14 +731,14 @@ public final class ArrayTable<R, C, V> extends AbstractTable<R, C, @Nullable V>
|
|
return "Column";
|
|
}
|
|
|
|
- @Override
|
|
@CheckForNull
|
|
+ @Override
|
|
V getValue(int index) {
|
|
return at(rowIndex, index);
|
|
}
|
|
|
|
- @Override
|
|
@CheckForNull
|
|
+ @Override
|
|
V setValue(int index, @CheckForNull V newValue) {
|
|
return set(rowIndex, index, newValue);
|
|
}
|
|
@@ -784,8 +784,8 @@ public final class ArrayTable<R, C, V> extends AbstractTable<R, C, @Nullable V>
|
|
throw new UnsupportedOperationException();
|
|
}
|
|
|
|
- @Override
|
|
@CheckForNull
|
|
+ @Override
|
|
public Map<C, @Nullable V> put(R key, Map<C, @Nullable V> value) {
|
|
throw new UnsupportedOperationException();
|
|
}
|
|
@@ -808,8 +808,8 @@ public final class ArrayTable<R, C, V> extends AbstractTable<R, C, @Nullable V>
|
|
@Override
|
|
Iterator<@Nullable V> valuesIterator() {
|
|
return new AbstractIndexedListIterator<@Nullable V>(size()) {
|
|
- @Override
|
|
@CheckForNull
|
|
+ @Override
|
|
protected V get(int index) {
|
|
return getValue(index);
|
|
}
|
|
diff --git a/guava/src/com/google/common/collect/BiMap.java b/guava/src/com/google/common/collect/BiMap.java
|
|
index 12eb4e3e1b..7c24cf3e84 100644
|
|
--- a/guava/src/com/google/common/collect/BiMap.java
|
|
+++ b/guava/src/com/google/common/collect/BiMap.java
|
|
@@ -47,8 +47,8 @@ public interface BiMap<K extends @Nullable Object, V extends @Nullable Object> e
|
|
* #forcePut} instead.
|
|
*/
|
|
@CanIgnoreReturnValue
|
|
- @Override
|
|
@CheckForNull
|
|
+ @Override
|
|
V put(@ParametricNullness K key, @ParametricNullness V value);
|
|
|
|
/**
|
|
diff --git a/guava/src/com/google/common/collect/CollectCollectors.java b/guava/src/com/google/common/collect/CollectCollectors.java
|
|
index f582660c8e..6744b7910c 100644
|
|
--- a/guava/src/com/google/common/collect/CollectCollectors.java
|
|
+++ b/guava/src/com/google/common/collect/CollectCollectors.java
|
|
@@ -18,6 +18,7 @@ package com.google.common.collect;
|
|
|
|
import static com.google.common.base.Preconditions.checkNotNull;
|
|
import static java.util.stream.Collectors.collectingAndThen;
|
|
+import static java.util.stream.Collectors.toMap;
|
|
|
|
import com.google.common.annotations.GwtCompatible;
|
|
import com.google.common.annotations.GwtIncompatible;
|
|
@@ -33,7 +34,6 @@ import java.util.function.Function;
|
|
import java.util.function.Supplier;
|
|
import java.util.function.ToIntFunction;
|
|
import java.util.stream.Collector;
|
|
-import java.util.stream.Collectors;
|
|
import java.util.stream.Stream;
|
|
import javax.annotation.CheckForNull;
|
|
import org.checkerframework.checker.nullness.qual.Nullable;
|
|
@@ -196,8 +196,7 @@ final class CollectCollectors {
|
|
checkNotNull(valueFunction);
|
|
checkNotNull(mergeFunction);
|
|
return collectingAndThen(
|
|
- Collectors.toMap(keyFunction, valueFunction, mergeFunction, LinkedHashMap::new),
|
|
- ImmutableMap::copyOf);
|
|
+ toMap(keyFunction, valueFunction, mergeFunction, LinkedHashMap::new), ImmutableMap::copyOf);
|
|
}
|
|
|
|
static <T extends @Nullable Object, K, V>
|
|
@@ -231,8 +230,7 @@ final class CollectCollectors {
|
|
checkNotNull(valueFunction);
|
|
checkNotNull(mergeFunction);
|
|
return collectingAndThen(
|
|
- Collectors.toMap(
|
|
- keyFunction, valueFunction, mergeFunction, () -> new TreeMap<K, V>(comparator)),
|
|
+ toMap(keyFunction, valueFunction, mergeFunction, () -> new TreeMap<K, V>(comparator)),
|
|
ImmutableSortedMap::copyOfSorted);
|
|
}
|
|
|
|
diff --git a/guava/src/com/google/common/collect/CollectSpliterators.java b/guava/src/com/google/common/collect/CollectSpliterators.java
|
|
index 7d0e82f203..e695d84490 100644
|
|
--- a/guava/src/com/google/common/collect/CollectSpliterators.java
|
|
+++ b/guava/src/com/google/common/collect/CollectSpliterators.java
|
|
@@ -72,8 +72,8 @@ final class CollectSpliterators {
|
|
delegate.forEachRemaining((IntConsumer) i -> action.accept(function.apply(i)));
|
|
}
|
|
|
|
- @Override
|
|
@CheckForNull
|
|
+ @Override
|
|
public Spliterator<T> trySplit() {
|
|
Spliterator.OfInt split = delegate.trySplit();
|
|
return (split == null) ? null : new WithCharacteristics(split);
|
|
@@ -92,8 +92,8 @@ final class CollectSpliterators {
|
|
| extraCharacteristics;
|
|
}
|
|
|
|
- @Override
|
|
@CheckForNull
|
|
+ @Override
|
|
public Comparator<? super T> getComparator() {
|
|
if (hasCharacteristics(Spliterator.SORTED)) {
|
|
return comparator;
|
|
@@ -128,8 +128,8 @@ final class CollectSpliterators {
|
|
fromSpliterator.forEachRemaining(fromElement -> action.accept(function.apply(fromElement)));
|
|
}
|
|
|
|
- @Override
|
|
@CheckForNull
|
|
+ @Override
|
|
public Spliterator<OutElementT> trySplit() {
|
|
Spliterator<InElementT> fromSplit = fromSpliterator.trySplit();
|
|
return (fromSplit != null) ? map(fromSplit, function) : null;
|
|
@@ -178,8 +178,8 @@ final class CollectSpliterators {
|
|
return false;
|
|
}
|
|
|
|
- @Override
|
|
@CheckForNull
|
|
+ @Override
|
|
public Spliterator<T> trySplit() {
|
|
Spliterator<T> fromSplit = fromSpliterator.trySplit();
|
|
return (fromSplit == null) ? null : filter(fromSplit, predicate);
|
|
@@ -190,8 +190,8 @@ final class CollectSpliterators {
|
|
return fromSpliterator.estimateSize() / 2;
|
|
}
|
|
|
|
- @Override
|
|
@CheckForNull
|
|
+ @Override
|
|
public Comparator<? super T> getComparator() {
|
|
return fromSpliterator.getComparator();
|
|
}
|
|
@@ -381,8 +381,8 @@ final class CollectSpliterators {
|
|
estimatedSize = 0;
|
|
}
|
|
|
|
- @Override
|
|
@CheckForNull
|
|
+ @Override
|
|
public final OutSpliteratorT trySplit() {
|
|
Spliterator<InElementT> fromSplit = from.trySplit();
|
|
if (fromSplit != null) {
|
|
diff --git a/guava/src/com/google/common/collect/Collections2.java b/guava/src/com/google/common/collect/Collections2.java
|
|
index eb928596a3..eb36002988 100644
|
|
--- a/guava/src/com/google/common/collect/Collections2.java
|
|
+++ b/guava/src/com/google/common/collect/Collections2.java
|
|
@@ -19,6 +19,7 @@ package com.google.common.collect;
|
|
import static com.google.common.base.Preconditions.checkArgument;
|
|
import static com.google.common.base.Preconditions.checkNotNull;
|
|
import static com.google.common.collect.CollectPreconditions.checkNonnegative;
|
|
+import static java.util.Collections.reverse;
|
|
import static java.util.Objects.requireNonNull;
|
|
|
|
import com.google.common.annotations.Beta;
|
|
@@ -518,8 +519,8 @@ public final class Collections2 {
|
|
this.comparator = comparator;
|
|
}
|
|
|
|
- @Override
|
|
@CheckForNull
|
|
+ @Override
|
|
protected List<E> computeNext() {
|
|
if (nextPermutation == null) {
|
|
return endOfData();
|
|
@@ -544,7 +545,7 @@ public final class Collections2 {
|
|
int l = findNextL(j);
|
|
Collections.swap(nextPermutation, j, l);
|
|
int n = nextPermutation.size();
|
|
- Collections.reverse(nextPermutation.subList(j + 1, n));
|
|
+ reverse(nextPermutation.subList(j + 1, n));
|
|
}
|
|
|
|
int findNextJ() {
|
|
@@ -652,8 +653,8 @@ public final class Collections2 {
|
|
j = Integer.MAX_VALUE;
|
|
}
|
|
|
|
- @Override
|
|
@CheckForNull
|
|
+ @Override
|
|
protected List<E> computeNext() {
|
|
if (j <= 0) {
|
|
return endOfData();
|
|
diff --git a/guava/src/com/google/common/collect/CompactHashMap.java b/guava/src/com/google/common/collect/CompactHashMap.java
|
|
index c18c207a89..405d38f297 100644
|
|
--- a/guava/src/com/google/common/collect/CompactHashMap.java
|
|
+++ b/guava/src/com/google/common/collect/CompactHashMap.java
|
|
@@ -16,7 +16,9 @@
|
|
|
|
package com.google.common.collect;
|
|
|
|
+import static com.google.common.base.Preconditions.checkArgument;
|
|
import static com.google.common.base.Preconditions.checkNotNull;
|
|
+import static com.google.common.base.Preconditions.checkState;
|
|
import static com.google.common.collect.CollectPreconditions.checkRemove;
|
|
import static com.google.common.collect.CompactHashing.UNSET;
|
|
import static com.google.common.collect.Hashing.smearedHash;
|
|
@@ -27,7 +29,6 @@ import static java.util.Objects.requireNonNull;
|
|
import com.google.common.annotations.GwtIncompatible;
|
|
import com.google.common.annotations.VisibleForTesting;
|
|
import com.google.common.base.Objects;
|
|
-import com.google.common.base.Preconditions;
|
|
import com.google.common.primitives.Ints;
|
|
import com.google.errorprone.annotations.CanIgnoreReturnValue;
|
|
import com.google.j2objc.annotations.WeakOuter;
|
|
@@ -117,7 +118,7 @@ class CompactHashMap<K extends @Nullable Object, V extends @Nullable Object>
|
|
* Maximum allowed false positive probability of detecting a hash flooding attack given random
|
|
* input.
|
|
*/
|
|
- @VisibleForTesting() static final double HASH_FLOODING_FPP = 0.001;
|
|
+ @VisibleForTesting static final double HASH_FLOODING_FPP = 0.001;
|
|
|
|
/**
|
|
* Maximum allowed length of a hash table bucket before falling back to a j.u.LinkedHashMap-based
|
|
@@ -248,7 +249,7 @@ class CompactHashMap<K extends @Nullable Object, V extends @Nullable Object>
|
|
|
|
/** Pseudoconstructor for serialization support. */
|
|
void init(int expectedSize) {
|
|
- Preconditions.checkArgument(expectedSize >= 0, "Expected size must be >= 0");
|
|
+ checkArgument(expectedSize >= 0, "Expected size must be >= 0");
|
|
|
|
// Save expectedSize for use in allocArrays()
|
|
this.metadata = Ints.constrainToRange(expectedSize, 1, CompactHashing.MAX_SIZE);
|
|
@@ -263,7 +264,7 @@ class CompactHashMap<K extends @Nullable Object, V extends @Nullable Object>
|
|
/** Handle lazy allocation of arrays. */
|
|
@CanIgnoreReturnValue
|
|
int allocArrays() {
|
|
- Preconditions.checkState(needsAllocArrays(), "Arrays already allocated");
|
|
+ checkState(needsAllocArrays(), "Arrays already allocated");
|
|
|
|
int expectedSize = metadata;
|
|
int buckets = CompactHashing.tableSize(expectedSize);
|
|
@@ -277,9 +278,9 @@ class CompactHashMap<K extends @Nullable Object, V extends @Nullable Object>
|
|
return expectedSize;
|
|
}
|
|
|
|
+ @CheckForNull
|
|
@SuppressWarnings("unchecked")
|
|
@VisibleForTesting
|
|
- @CheckForNull
|
|
Map<K, V> delegateOrNull() {
|
|
if (table instanceof Map) {
|
|
return (Map<K, V>) table;
|
|
@@ -291,8 +292,8 @@ class CompactHashMap<K extends @Nullable Object, V extends @Nullable Object>
|
|
return new LinkedHashMap<>(tableSize, 1.0f);
|
|
}
|
|
|
|
- @VisibleForTesting
|
|
@CanIgnoreReturnValue
|
|
+ @VisibleForTesting
|
|
Map<K, V> convertToHashFloodingResistantImplementation() {
|
|
Map<K, V> newDelegate = createHashFloodingResistantDelegate(hashTableMask() + 1);
|
|
for (int i = firstEntryIndex(); i >= 0; i = getSuccessor(i)) {
|
|
@@ -331,8 +332,8 @@ class CompactHashMap<K extends @Nullable Object, V extends @Nullable Object>
|
|
}
|
|
|
|
@CanIgnoreReturnValue
|
|
- @Override
|
|
@CheckForNull
|
|
+ @Override
|
|
public V put(@ParametricNullness K key, @ParametricNullness V value) {
|
|
if (needsAllocArrays()) {
|
|
allocArrays();
|
|
@@ -506,8 +507,8 @@ class CompactHashMap<K extends @Nullable Object, V extends @Nullable Object>
|
|
return (delegate != null) ? delegate.containsKey(key) : indexOf(key) != -1;
|
|
}
|
|
|
|
- @Override
|
|
@CheckForNull
|
|
+ @Override
|
|
public V get(@CheckForNull Object key) {
|
|
Map<K, V> delegate = delegateOrNull();
|
|
if (delegate != null) {
|
|
@@ -522,9 +523,9 @@ class CompactHashMap<K extends @Nullable Object, V extends @Nullable Object>
|
|
}
|
|
|
|
@CanIgnoreReturnValue
|
|
- @SuppressWarnings("unchecked") // known to be a V
|
|
+ @CheckForNull // known to be a V
|
|
@Override
|
|
- @CheckForNull
|
|
+ @SuppressWarnings("unchecked")
|
|
public V remove(@CheckForNull Object key) {
|
|
Map<K, V> delegate = delegateOrNull();
|
|
if (delegate != null) {
|
|
diff --git a/guava/src/com/google/common/collect/CompactHashSet.java b/guava/src/com/google/common/collect/CompactHashSet.java
|
|
index 4ffd8e6e10..7f20800908 100644
|
|
--- a/guava/src/com/google/common/collect/CompactHashSet.java
|
|
+++ b/guava/src/com/google/common/collect/CompactHashSet.java
|
|
@@ -16,7 +16,9 @@
|
|
|
|
package com.google.common.collect;
|
|
|
|
+import static com.google.common.base.Preconditions.checkArgument;
|
|
import static com.google.common.base.Preconditions.checkNotNull;
|
|
+import static com.google.common.base.Preconditions.checkState;
|
|
import static com.google.common.collect.CollectPreconditions.checkRemove;
|
|
import static com.google.common.collect.CompactHashing.UNSET;
|
|
import static com.google.common.collect.Hashing.smearedHash;
|
|
@@ -25,7 +27,6 @@ import static java.util.Objects.requireNonNull;
|
|
import com.google.common.annotations.GwtIncompatible;
|
|
import com.google.common.annotations.VisibleForTesting;
|
|
import com.google.common.base.Objects;
|
|
-import com.google.common.base.Preconditions;
|
|
import com.google.common.primitives.Ints;
|
|
import com.google.errorprone.annotations.CanIgnoreReturnValue;
|
|
import java.io.IOException;
|
|
@@ -131,7 +132,7 @@ class CompactHashSet<E extends @Nullable Object> extends AbstractSet<E> implemen
|
|
* Maximum allowed false positive probability of detecting a hash flooding attack given random
|
|
* input.
|
|
*/
|
|
- @VisibleForTesting() static final double HASH_FLOODING_FPP = 0.001;
|
|
+ @VisibleForTesting static final double HASH_FLOODING_FPP = 0.001;
|
|
|
|
/**
|
|
* Maximum allowed length of a hash table bucket before falling back to a j.u.LinkedHashSet based
|
|
@@ -214,7 +215,7 @@ class CompactHashSet<E extends @Nullable Object> extends AbstractSet<E> implemen
|
|
|
|
/** Pseudoconstructor for serialization support. */
|
|
void init(int expectedSize) {
|
|
- Preconditions.checkArgument(expectedSize >= 0, "Expected size must be >= 0");
|
|
+ checkArgument(expectedSize >= 0, "Expected size must be >= 0");
|
|
|
|
// Save expectedSize for use in allocArrays()
|
|
this.metadata = Ints.constrainToRange(expectedSize, 1, CompactHashing.MAX_SIZE);
|
|
@@ -229,7 +230,7 @@ class CompactHashSet<E extends @Nullable Object> extends AbstractSet<E> implemen
|
|
/** Handle lazy allocation of arrays. */
|
|
@CanIgnoreReturnValue
|
|
int allocArrays() {
|
|
- Preconditions.checkState(needsAllocArrays(), "Arrays already allocated");
|
|
+ checkState(needsAllocArrays(), "Arrays already allocated");
|
|
|
|
int expectedSize = metadata;
|
|
int buckets = CompactHashing.tableSize(expectedSize);
|
|
@@ -242,9 +243,9 @@ class CompactHashSet<E extends @Nullable Object> extends AbstractSet<E> implemen
|
|
return expectedSize;
|
|
}
|
|
|
|
+ @CheckForNull
|
|
@SuppressWarnings("unchecked")
|
|
@VisibleForTesting
|
|
- @CheckForNull
|
|
Set<E> delegateOrNull() {
|
|
if (table instanceof Set) {
|
|
return (Set<E>) table;
|
|
@@ -256,8 +257,8 @@ class CompactHashSet<E extends @Nullable Object> extends AbstractSet<E> implemen
|
|
return new LinkedHashSet<>(tableSize, 1.0f);
|
|
}
|
|
|
|
- @VisibleForTesting
|
|
@CanIgnoreReturnValue
|
|
+ @VisibleForTesting
|
|
Set<E> convertToHashFloodingResistantImplementation() {
|
|
Set<E> newDelegate = createHashFloodingResistantDelegate(hashTableMask() + 1);
|
|
for (int i = firstEntryIndex(); i >= 0; i = getSuccessor(i)) {
|
|
diff --git a/guava/src/com/google/common/collect/CompactLinkedHashMap.java b/guava/src/com/google/common/collect/CompactLinkedHashMap.java
|
|
index 97b3a4b1c3..04ef58994c 100644
|
|
--- a/guava/src/com/google/common/collect/CompactLinkedHashMap.java
|
|
+++ b/guava/src/com/google/common/collect/CompactLinkedHashMap.java
|
|
@@ -131,8 +131,8 @@ class CompactLinkedHashMap<K extends @Nullable Object, V extends @Nullable Objec
|
|
return new LinkedHashMap<K, V>(tableSize, 1.0f, accessOrder);
|
|
}
|
|
|
|
- @Override
|
|
@CanIgnoreReturnValue
|
|
+ @Override
|
|
Map<K, V> convertToHashFloodingResistantImplementation() {
|
|
Map<K, V> result = super.convertToHashFloodingResistantImplementation();
|
|
links = null;
|
|
diff --git a/guava/src/com/google/common/collect/CompactLinkedHashSet.java b/guava/src/com/google/common/collect/CompactLinkedHashSet.java
|
|
index c1d813cdb4..150005213a 100644
|
|
--- a/guava/src/com/google/common/collect/CompactLinkedHashSet.java
|
|
+++ b/guava/src/com/google/common/collect/CompactLinkedHashSet.java
|
|
@@ -148,8 +148,8 @@ class CompactLinkedHashSet<E extends @Nullable Object> extends CompactHashSet<E>
|
|
return expectedSize;
|
|
}
|
|
|
|
- @Override
|
|
@CanIgnoreReturnValue
|
|
+ @Override
|
|
Set<E> convertToHashFloodingResistantImplementation() {
|
|
Set<E> result = super.convertToHashFloodingResistantImplementation();
|
|
this.predecessor = null;
|
|
diff --git a/guava/src/com/google/common/collect/Comparators.java b/guava/src/com/google/common/collect/Comparators.java
|
|
index 5779be31bf..e0ba002403 100644
|
|
--- a/guava/src/com/google/common/collect/Comparators.java
|
|
+++ b/guava/src/com/google/common/collect/Comparators.java
|
|
@@ -18,6 +18,8 @@ package com.google.common.collect;
|
|
|
|
import static com.google.common.base.Preconditions.checkNotNull;
|
|
import static com.google.common.collect.CollectPreconditions.checkNonnegative;
|
|
+import static java.util.Comparator.nullsFirst;
|
|
+import static java.util.Comparator.nullsLast;
|
|
|
|
import com.google.common.annotations.GwtCompatible;
|
|
import java.util.Comparator;
|
|
@@ -177,7 +179,7 @@ public final class Comparators {
|
|
public static <T> Comparator<Optional<T>> emptiesFirst(Comparator<? super T> valueComparator) {
|
|
checkNotNull(valueComparator);
|
|
return Comparator.<Optional<T>, @Nullable T>comparing(
|
|
- o -> o.orElse(null), Comparator.nullsFirst(valueComparator));
|
|
+ o -> o.orElse(null), nullsFirst(valueComparator));
|
|
}
|
|
|
|
/**
|
|
@@ -190,7 +192,7 @@ public final class Comparators {
|
|
public static <T> Comparator<Optional<T>> emptiesLast(Comparator<? super T> valueComparator) {
|
|
checkNotNull(valueComparator);
|
|
return Comparator.<Optional<T>, @Nullable T>comparing(
|
|
- o -> o.orElse(null), Comparator.nullsLast(valueComparator));
|
|
+ o -> o.orElse(null), nullsLast(valueComparator));
|
|
}
|
|
|
|
/**
|
|
diff --git a/guava/src/com/google/common/collect/ComparisonChain.java b/guava/src/com/google/common/collect/ComparisonChain.java
|
|
index 9c05205ec0..06fa13ae91 100644
|
|
--- a/guava/src/com/google/common/collect/ComparisonChain.java
|
|
+++ b/guava/src/com/google/common/collect/ComparisonChain.java
|
|
@@ -68,8 +68,8 @@ public abstract class ComparisonChain {
|
|
|
|
private static final ComparisonChain ACTIVE =
|
|
new ComparisonChain() {
|
|
- @SuppressWarnings("unchecked") // unsafe; see discussion on supertype
|
|
- @Override
|
|
+ @Override // unsafe; see discussion on supertype
|
|
+ @SuppressWarnings("unchecked")
|
|
public ComparisonChain compare(Comparable<?> left, Comparable<?> right) {
|
|
return classify(((Comparable<Object>) left).compareTo(right));
|
|
}
|
|
diff --git a/guava/src/com/google/common/collect/ConcurrentHashMultiset.java b/guava/src/com/google/common/collect/ConcurrentHashMultiset.java
|
|
index f60e2081e3..f212910ca9 100644
|
|
--- a/guava/src/com/google/common/collect/ConcurrentHashMultiset.java
|
|
+++ b/guava/src/com/google/common/collect/ConcurrentHashMultiset.java
|
|
@@ -510,8 +510,8 @@ public final class ConcurrentHashMultiset<E> extends AbstractMultiset<E> impleme
|
|
private final Iterator<Map.Entry<E, AtomicInteger>> mapEntries =
|
|
countMap.entrySet().iterator();
|
|
|
|
- @Override
|
|
@CheckForNull
|
|
+ @Override
|
|
protected Entry<E> computeNext() {
|
|
while (true) {
|
|
if (!mapEntries.hasNext()) {
|
|
diff --git a/guava/src/com/google/common/collect/ConsumingQueueIterator.java b/guava/src/com/google/common/collect/ConsumingQueueIterator.java
|
|
index 7721e1277c..3e79c7adc2 100644
|
|
--- a/guava/src/com/google/common/collect/ConsumingQueueIterator.java
|
|
+++ b/guava/src/com/google/common/collect/ConsumingQueueIterator.java
|
|
@@ -34,8 +34,8 @@ final class ConsumingQueueIterator<T extends @Nullable Object> extends AbstractI
|
|
this.queue = checkNotNull(queue);
|
|
}
|
|
|
|
- @Override
|
|
@CheckForNull
|
|
+ @Override
|
|
public T computeNext() {
|
|
// TODO(b/192579700): Use a ternary once it no longer confuses our nullness checker.
|
|
if (queue.isEmpty()) {
|
|
diff --git a/guava/src/com/google/common/collect/ContiguousSet.java b/guava/src/com/google/common/collect/ContiguousSet.java
|
|
index d08af0d0ce..d06b206600 100644
|
|
--- a/guava/src/com/google/common/collect/ContiguousSet.java
|
|
+++ b/guava/src/com/google/common/collect/ContiguousSet.java
|
|
@@ -245,8 +245,8 @@ public abstract class ContiguousSet<C extends Comparable> extends ImmutableSorte
|
|
*/
|
|
public abstract Range<C> range(BoundType lowerBoundType, BoundType upperBoundType);
|
|
|
|
- @Override
|
|
- @GwtIncompatible // NavigableSet
|
|
+ @GwtIncompatible
|
|
+ @Override // NavigableSet
|
|
ImmutableSortedSet<C> createDescendingSet() {
|
|
return new DescendingImmutableSortedSet<>(this);
|
|
}
|
|
diff --git a/guava/src/com/google/common/collect/Cut.java b/guava/src/com/google/common/collect/Cut.java
|
|
index 21fe5ff2dd..c5140cfe46 100644
|
|
--- a/guava/src/com/google/common/collect/Cut.java
|
|
+++ b/guava/src/com/google/common/collect/Cut.java
|
|
@@ -89,8 +89,8 @@ abstract class Cut<C extends Comparable> implements Comparable<Cut<C>>, Serializ
|
|
return endpoint;
|
|
}
|
|
|
|
- @SuppressWarnings("unchecked") // catching CCE
|
|
- @Override
|
|
+ @Override // catching CCE
|
|
+ @SuppressWarnings("unchecked")
|
|
public boolean equals(@CheckForNull Object obj) {
|
|
if (obj instanceof Cut) {
|
|
// It might not really be a Cut<C>, but we'll catch a CCE if it's not
|
|
@@ -372,8 +372,8 @@ abstract class Cut<C extends Comparable> implements Comparable<Cut<C>>, Serializ
|
|
return endpoint;
|
|
}
|
|
|
|
- @Override
|
|
@CheckForNull
|
|
+ @Override
|
|
C greatestValueBelow(DiscreteDomain<C> domain) {
|
|
return domain.previous(endpoint);
|
|
}
|
|
@@ -451,8 +451,8 @@ abstract class Cut<C extends Comparable> implements Comparable<Cut<C>>, Serializ
|
|
sb.append(endpoint).append(']');
|
|
}
|
|
|
|
- @Override
|
|
@CheckForNull
|
|
+ @Override
|
|
C leastValueAbove(DiscreteDomain<C> domain) {
|
|
return domain.next(endpoint);
|
|
}
|
|
diff --git a/guava/src/com/google/common/collect/DenseImmutableTable.java b/guava/src/com/google/common/collect/DenseImmutableTable.java
|
|
index 563bd6ef5f..f67ef90e2d 100644
|
|
--- a/guava/src/com/google/common/collect/DenseImmutableTable.java
|
|
+++ b/guava/src/com/google/common/collect/DenseImmutableTable.java
|
|
@@ -26,7 +26,7 @@ import org.checkerframework.checker.nullness.qual.Nullable;
|
|
|
|
/** A {@code RegularImmutableTable} optimized for dense data. */
|
|
@GwtCompatible
|
|
-@Immutable(containerOf = {"R", "C", "V"})
|
|
+@Immutable(containerOf = {"C", "R", "V"})
|
|
@ElementTypesAreNonnullByDefault
|
|
final class DenseImmutableTable<R, C, V> extends RegularImmutableTable<R, C, V> {
|
|
private final ImmutableMap<R, Integer> rowKeyToIndex;
|
|
@@ -117,8 +117,8 @@ final class DenseImmutableTable<R, C, V> extends RegularImmutableTable<R, C, V>
|
|
return size;
|
|
}
|
|
|
|
- @Override
|
|
@CheckForNull
|
|
+ @Override
|
|
public V get(@CheckForNull Object key) {
|
|
Integer keyIndex = keyToIndex().get(key);
|
|
return (keyIndex == null) ? null : getValue(keyIndex);
|
|
@@ -130,8 +130,8 @@ final class DenseImmutableTable<R, C, V> extends RegularImmutableTable<R, C, V>
|
|
private int index = -1;
|
|
private final int maxIndex = keyToIndex().size();
|
|
|
|
- @Override
|
|
@CheckForNull
|
|
+ @Override
|
|
protected Entry<K, V> computeNext() {
|
|
for (index++; index < maxIndex; index++) {
|
|
V value = getValue(index);
|
|
@@ -158,8 +158,8 @@ final class DenseImmutableTable<R, C, V> extends RegularImmutableTable<R, C, V>
|
|
return columnKeyToIndex;
|
|
}
|
|
|
|
- @Override
|
|
@CheckForNull
|
|
+ @Override
|
|
V getValue(int keyIndex) {
|
|
return values[rowIndex][keyIndex];
|
|
}
|
|
@@ -183,8 +183,8 @@ final class DenseImmutableTable<R, C, V> extends RegularImmutableTable<R, C, V>
|
|
return rowKeyToIndex;
|
|
}
|
|
|
|
- @Override
|
|
@CheckForNull
|
|
+ @Override
|
|
V getValue(int keyIndex) {
|
|
return values[keyIndex][columnIndex];
|
|
}
|
|
@@ -253,8 +253,8 @@ final class DenseImmutableTable<R, C, V> extends RegularImmutableTable<R, C, V>
|
|
return ImmutableMap.<R, Map<C, V>>copyOf(rowMap);
|
|
}
|
|
|
|
- @Override
|
|
@CheckForNull
|
|
+ @Override
|
|
public V get(@CheckForNull Object rowKey, @CheckForNull Object columnKey) {
|
|
Integer rowIndex = rowKeyToIndex.get(rowKey);
|
|
Integer columnIndex = columnKeyToIndex.get(columnKey);
|
|
diff --git a/guava/src/com/google/common/collect/DescendingImmutableSortedMultiset.java b/guava/src/com/google/common/collect/DescendingImmutableSortedMultiset.java
|
|
index 181731cc48..e5eaedbcbe 100644
|
|
--- a/guava/src/com/google/common/collect/DescendingImmutableSortedMultiset.java
|
|
+++ b/guava/src/com/google/common/collect/DescendingImmutableSortedMultiset.java
|
|
@@ -37,14 +37,14 @@ final class DescendingImmutableSortedMultiset<E> extends ImmutableSortedMultiset
|
|
return forward.count(element);
|
|
}
|
|
|
|
- @Override
|
|
@CheckForNull
|
|
+ @Override
|
|
public Entry<E> firstEntry() {
|
|
return forward.lastEntry();
|
|
}
|
|
|
|
- @Override
|
|
@CheckForNull
|
|
+ @Override
|
|
public Entry<E> lastEntry() {
|
|
return forward.firstEntry();
|
|
}
|
|
diff --git a/guava/src/com/google/common/collect/DescendingImmutableSortedSet.java b/guava/src/com/google/common/collect/DescendingImmutableSortedSet.java
|
|
index 88c7d6b5cc..0a9eefb847 100644
|
|
--- a/guava/src/com/google/common/collect/DescendingImmutableSortedSet.java
|
|
+++ b/guava/src/com/google/common/collect/DescendingImmutableSortedSet.java
|
|
@@ -65,44 +65,44 @@ final class DescendingImmutableSortedSet<E> extends ImmutableSortedSet<E> {
|
|
return forward.headSet(fromElement, inclusive).descendingSet();
|
|
}
|
|
|
|
- @Override
|
|
@GwtIncompatible("NavigableSet")
|
|
+ @Override
|
|
public ImmutableSortedSet<E> descendingSet() {
|
|
return forward;
|
|
}
|
|
|
|
- @Override
|
|
@GwtIncompatible("NavigableSet")
|
|
+ @Override
|
|
public UnmodifiableIterator<E> descendingIterator() {
|
|
return forward.iterator();
|
|
}
|
|
|
|
- @Override
|
|
@GwtIncompatible("NavigableSet")
|
|
+ @Override
|
|
ImmutableSortedSet<E> createDescendingSet() {
|
|
throw new AssertionError("should never be called");
|
|
}
|
|
|
|
- @Override
|
|
@CheckForNull
|
|
+ @Override
|
|
public E lower(E element) {
|
|
return forward.higher(element);
|
|
}
|
|
|
|
- @Override
|
|
@CheckForNull
|
|
+ @Override
|
|
public E floor(E element) {
|
|
return forward.ceiling(element);
|
|
}
|
|
|
|
- @Override
|
|
@CheckForNull
|
|
+ @Override
|
|
public E ceiling(E element) {
|
|
return forward.floor(element);
|
|
}
|
|
|
|
- @Override
|
|
@CheckForNull
|
|
+ @Override
|
|
public E higher(E element) {
|
|
return forward.lower(element);
|
|
}
|
|
diff --git a/guava/src/com/google/common/collect/DescendingMultiset.java b/guava/src/com/google/common/collect/DescendingMultiset.java
|
|
index 7db0fbbd49..8bfd959dce 100644
|
|
--- a/guava/src/com/google/common/collect/DescendingMultiset.java
|
|
+++ b/guava/src/com/google/common/collect/DescendingMultiset.java
|
|
@@ -59,14 +59,14 @@ abstract class DescendingMultiset<E extends @Nullable Object> extends Forwarding
|
|
return result;
|
|
}
|
|
|
|
- @Override
|
|
@CheckForNull
|
|
+ @Override
|
|
public Entry<E> pollFirstEntry() {
|
|
return forwardMultiset().pollLastEntry();
|
|
}
|
|
|
|
- @Override
|
|
@CheckForNull
|
|
+ @Override
|
|
public Entry<E> pollLastEntry() {
|
|
return forwardMultiset().pollFirstEntry();
|
|
}
|
|
@@ -102,14 +102,14 @@ abstract class DescendingMultiset<E extends @Nullable Object> extends Forwarding
|
|
return forwardMultiset();
|
|
}
|
|
|
|
- @Override
|
|
@CheckForNull
|
|
+ @Override
|
|
public Entry<E> firstEntry() {
|
|
return forwardMultiset().lastEntry();
|
|
}
|
|
|
|
- @Override
|
|
@CheckForNull
|
|
+ @Override
|
|
public Entry<E> lastEntry() {
|
|
return forwardMultiset().firstEntry();
|
|
}
|
|
diff --git a/guava/src/com/google/common/collect/DiscreteDomain.java b/guava/src/com/google/common/collect/DiscreteDomain.java
|
|
index 222ebe5283..cffa9379eb 100644
|
|
--- a/guava/src/com/google/common/collect/DiscreteDomain.java
|
|
+++ b/guava/src/com/google/common/collect/DiscreteDomain.java
|
|
@@ -63,15 +63,15 @@ public abstract class DiscreteDomain<C extends Comparable> {
|
|
super(true);
|
|
}
|
|
|
|
- @Override
|
|
@CheckForNull
|
|
+ @Override
|
|
public Integer next(Integer value) {
|
|
int i = value;
|
|
return (i == Integer.MAX_VALUE) ? null : i + 1;
|
|
}
|
|
|
|
- @Override
|
|
@CheckForNull
|
|
+ @Override
|
|
public Integer previous(Integer value) {
|
|
int i = value;
|
|
return (i == Integer.MIN_VALUE) ? null : i - 1;
|
|
@@ -126,15 +126,15 @@ public abstract class DiscreteDomain<C extends Comparable> {
|
|
super(true);
|
|
}
|
|
|
|
- @Override
|
|
@CheckForNull
|
|
+ @Override
|
|
public Long next(Long value) {
|
|
long l = value;
|
|
return (l == Long.MAX_VALUE) ? null : l + 1;
|
|
}
|
|
|
|
- @Override
|
|
@CheckForNull
|
|
+ @Override
|
|
public Long previous(Long value) {
|
|
long l = value;
|
|
return (l == Long.MIN_VALUE) ? null : l - 1;
|
|
diff --git a/guava/src/com/google/common/collect/EnumBiMap.java b/guava/src/com/google/common/collect/EnumBiMap.java
|
|
index 97d3c2e7cd..d2f9921f2a 100644
|
|
--- a/guava/src/com/google/common/collect/EnumBiMap.java
|
|
+++ b/guava/src/com/google/common/collect/EnumBiMap.java
|
|
@@ -126,8 +126,8 @@ public final class EnumBiMap<K extends Enum<K>, V extends Enum<V>> extends Abstr
|
|
Serialization.writeMap(this, stream);
|
|
}
|
|
|
|
- @SuppressWarnings("unchecked") // reading fields populated by writeObject
|
|
- @GwtIncompatible // java.io.ObjectInputStream
|
|
+ @GwtIncompatible // reading fields populated by writeObject
|
|
+ @SuppressWarnings("unchecked") // java.io.ObjectInputStream
|
|
private void readObject(ObjectInputStream stream) throws IOException, ClassNotFoundException {
|
|
stream.defaultReadObject();
|
|
keyType = (Class<K>) stream.readObject();
|
|
diff --git a/guava/src/com/google/common/collect/EnumHashBiMap.java b/guava/src/com/google/common/collect/EnumHashBiMap.java
|
|
index 5fbbb70c63..d62550cca2 100644
|
|
--- a/guava/src/com/google/common/collect/EnumHashBiMap.java
|
|
+++ b/guava/src/com/google/common/collect/EnumHashBiMap.java
|
|
@@ -89,19 +89,19 @@ public final class EnumHashBiMap<K extends Enum<K>, V extends @Nullable Object>
|
|
}
|
|
|
|
@CanIgnoreReturnValue
|
|
- @Override
|
|
- @SuppressWarnings("RedundantOverride") // b/192446478: RedundantOverride ignores some annotations.
|
|
- // TODO(b/192446998): Remove this override after tools understand nullness better.
|
|
@CheckForNull
|
|
+ @Override // b/192446478: RedundantOverride ignores some annotations.
|
|
+ // TODO(b/192446998): Remove this override after tools understand nullness better.
|
|
+ @SuppressWarnings("RedundantOverride")
|
|
public V put(K key, @ParametricNullness V value) {
|
|
return super.put(key, value);
|
|
}
|
|
|
|
@CanIgnoreReturnValue
|
|
- @Override
|
|
- @SuppressWarnings("RedundantOverride") // b/192446478: RedundantOverride ignores some annotations.
|
|
- // TODO(b/192446998): Remove this override after tools understand nullness better.
|
|
@CheckForNull
|
|
+ @Override // b/192446478: RedundantOverride ignores some annotations.
|
|
+ // TODO(b/192446998): Remove this override after tools understand nullness better.
|
|
+ @SuppressWarnings("RedundantOverride")
|
|
public V forcePut(K key, @ParametricNullness V value) {
|
|
return super.forcePut(key, value);
|
|
}
|
|
@@ -122,8 +122,8 @@ public final class EnumHashBiMap<K extends Enum<K>, V extends @Nullable Object>
|
|
Serialization.writeMap(this, stream);
|
|
}
|
|
|
|
- @SuppressWarnings("unchecked") // reading field populated by writeObject
|
|
- @GwtIncompatible // java.io.ObjectInputStream
|
|
+ @GwtIncompatible // reading field populated by writeObject
|
|
+ @SuppressWarnings("unchecked") // java.io.ObjectInputStream
|
|
private void readObject(ObjectInputStream stream) throws IOException, ClassNotFoundException {
|
|
stream.defaultReadObject();
|
|
keyType = (Class<K>) stream.readObject();
|
|
diff --git a/guava/src/com/google/common/collect/EvictingQueue.java b/guava/src/com/google/common/collect/EvictingQueue.java
|
|
index 5667dfa8c0..8a06c46ad3 100644
|
|
--- a/guava/src/com/google/common/collect/EvictingQueue.java
|
|
+++ b/guava/src/com/google/common/collect/EvictingQueue.java
|
|
@@ -89,8 +89,8 @@ public final class EvictingQueue<E> extends ForwardingQueue<E> implements Serial
|
|
*
|
|
* @return {@code true} always
|
|
*/
|
|
- @Override
|
|
@CanIgnoreReturnValue
|
|
+ @Override
|
|
public boolean offer(E e) {
|
|
return add(e);
|
|
}
|
|
@@ -101,8 +101,8 @@ public final class EvictingQueue<E> extends ForwardingQueue<E> implements Serial
|
|
*
|
|
* @return {@code true} always
|
|
*/
|
|
- @Override
|
|
@CanIgnoreReturnValue
|
|
+ @Override
|
|
public boolean add(E e) {
|
|
checkNotNull(e); // check before removing
|
|
if (maxSize == 0) {
|
|
@@ -115,8 +115,8 @@ public final class EvictingQueue<E> extends ForwardingQueue<E> implements Serial
|
|
return true;
|
|
}
|
|
|
|
- @Override
|
|
@CanIgnoreReturnValue
|
|
+ @Override
|
|
public boolean addAll(Collection<? extends E> collection) {
|
|
int size = collection.size();
|
|
if (size >= maxSize) {
|
|
diff --git a/guava/src/com/google/common/collect/FilteredEntryMultimap.java b/guava/src/com/google/common/collect/FilteredEntryMultimap.java
|
|
index de946a215f..05f0d66f43 100644
|
|
--- a/guava/src/com/google/common/collect/FilteredEntryMultimap.java
|
|
+++ b/guava/src/com/google/common/collect/FilteredEntryMultimap.java
|
|
@@ -20,6 +20,8 @@ import static com.google.common.base.Preconditions.checkNotNull;
|
|
import static com.google.common.base.Predicates.in;
|
|
import static com.google.common.base.Predicates.not;
|
|
import static com.google.common.collect.CollectPreconditions.checkNonnegative;
|
|
+import static java.util.Collections.unmodifiableList;
|
|
+import static java.util.Collections.unmodifiableSet;
|
|
|
|
import com.google.common.annotations.GwtCompatible;
|
|
import com.google.common.base.MoreObjects;
|
|
@@ -178,8 +180,8 @@ class FilteredEntryMultimap<K extends @Nullable Object, V extends @Nullable Obje
|
|
FilteredEntryMultimap.this.clear();
|
|
}
|
|
|
|
- @Override
|
|
@CheckForNull
|
|
+ @Override
|
|
public Collection<V> get(@CheckForNull Object key) {
|
|
Collection<V> result = unfiltered.asMap().get(key);
|
|
if (result == null) {
|
|
@@ -191,8 +193,8 @@ class FilteredEntryMultimap<K extends @Nullable Object, V extends @Nullable Obje
|
|
return result.isEmpty() ? null : result;
|
|
}
|
|
|
|
- @Override
|
|
@CheckForNull
|
|
+ @Override
|
|
public Collection<V> remove(@CheckForNull Object key) {
|
|
Collection<V> collection = unfiltered.asMap().get(key);
|
|
if (collection == null) {
|
|
@@ -212,9 +214,9 @@ class FilteredEntryMultimap<K extends @Nullable Object, V extends @Nullable Obje
|
|
if (result.isEmpty()) {
|
|
return null;
|
|
} else if (unfiltered instanceof SetMultimap) {
|
|
- return Collections.unmodifiableSet(Sets.newLinkedHashSet(result));
|
|
+ return unmodifiableSet(Sets.newLinkedHashSet(result));
|
|
} else {
|
|
- return Collections.unmodifiableList(result);
|
|
+ return unmodifiableList(result);
|
|
}
|
|
}
|
|
|
|
@@ -259,8 +261,8 @@ class FilteredEntryMultimap<K extends @Nullable Object, V extends @Nullable Obje
|
|
final Iterator<Entry<K, Collection<V>>> backingIterator =
|
|
unfiltered.asMap().entrySet().iterator();
|
|
|
|
- @Override
|
|
@CheckForNull
|
|
+ @Override
|
|
protected Entry<K, Collection<V>> computeNext() {
|
|
while (backingIterator.hasNext()) {
|
|
Entry<K, Collection<V>> entry = backingIterator.next();
|
|
diff --git a/guava/src/com/google/common/collect/FilteredKeyMultimap.java b/guava/src/com/google/common/collect/FilteredKeyMultimap.java
|
|
index 68fad75b14..8b699d48ba 100644
|
|
--- a/guava/src/com/google/common/collect/FilteredKeyMultimap.java
|
|
+++ b/guava/src/com/google/common/collect/FilteredKeyMultimap.java
|
|
@@ -24,7 +24,6 @@ import com.google.common.base.Predicate;
|
|
import com.google.errorprone.annotations.CanIgnoreReturnValue;
|
|
import com.google.j2objc.annotations.WeakOuter;
|
|
import java.util.Collection;
|
|
-import java.util.Collections;
|
|
import java.util.Iterator;
|
|
import java.util.List;
|
|
import java.util.Map;
|
|
@@ -134,7 +133,7 @@ class FilteredKeyMultimap<K extends @Nullable Object, V extends @Nullable Object
|
|
|
|
@Override
|
|
protected Set<V> delegate() {
|
|
- return Collections.emptySet();
|
|
+ return emptySet();
|
|
}
|
|
}
|
|
|
|
@@ -174,7 +173,7 @@ class FilteredKeyMultimap<K extends @Nullable Object, V extends @Nullable Object
|
|
|
|
@Override
|
|
protected List<V> delegate() {
|
|
- return Collections.emptyList();
|
|
+ return emptyList();
|
|
}
|
|
}
|
|
|
|
diff --git a/guava/src/com/google/common/collect/FilteredMultimapValues.java b/guava/src/com/google/common/collect/FilteredMultimapValues.java
|
|
index ecbfab2a1d..121f2311ed 100644
|
|
--- a/guava/src/com/google/common/collect/FilteredMultimapValues.java
|
|
+++ b/guava/src/com/google/common/collect/FilteredMultimapValues.java
|
|
@@ -15,6 +15,8 @@
|
|
package com.google.common.collect;
|
|
|
|
import static com.google.common.base.Preconditions.checkNotNull;
|
|
+import static com.google.common.base.Predicates.in;
|
|
+import static com.google.common.base.Predicates.not;
|
|
|
|
import com.google.common.annotations.GwtCompatible;
|
|
import com.google.common.base.Objects;
|
|
@@ -78,7 +80,7 @@ final class FilteredMultimapValues<K extends @Nullable Object, V extends @Nullab
|
|
multimap.unfiltered().entries(),
|
|
// explicit <Entry<K, V>> is required to build with JDK6
|
|
Predicates.<Entry<K, V>>and(
|
|
- multimap.entryPredicate(), Maps.<V>valuePredicateOnEntries(Predicates.in(c))));
|
|
+ multimap.entryPredicate(), Maps.<V>valuePredicateOnEntries(in(c))));
|
|
}
|
|
|
|
@Override
|
|
@@ -87,8 +89,7 @@ final class FilteredMultimapValues<K extends @Nullable Object, V extends @Nullab
|
|
multimap.unfiltered().entries(),
|
|
// explicit <Entry<K, V>> is required to build with JDK6
|
|
Predicates.<Entry<K, V>>and(
|
|
- multimap.entryPredicate(),
|
|
- Maps.<V>valuePredicateOnEntries(Predicates.not(Predicates.in(c)))));
|
|
+ multimap.entryPredicate(), Maps.<V>valuePredicateOnEntries(not(in(c)))));
|
|
}
|
|
|
|
@Override
|
|
diff --git a/guava/src/com/google/common/collect/FluentIterable.java b/guava/src/com/google/common/collect/FluentIterable.java
|
|
index 11bda3bde9..fee20a7ce7 100644
|
|
--- a/guava/src/com/google/common/collect/FluentIterable.java
|
|
+++ b/guava/src/com/google/common/collect/FluentIterable.java
|
|
@@ -175,7 +175,7 @@ public abstract class FluentIterable<E extends @Nullable Object> implements Iter
|
|
@Deprecated
|
|
@InlineMe(
|
|
replacement = "checkNotNull(iterable)",
|
|
- staticImports = {"com.google.common.base.Preconditions.checkNotNull"})
|
|
+ staticImports = "com.google.common.base.Preconditions.checkNotNull")
|
|
public static <E extends @Nullable Object> FluentIterable<E> from(FluentIterable<E> iterable) {
|
|
return checkNotNull(iterable);
|
|
}
|
|
diff --git a/guava/src/com/google/common/collect/ForwardingBlockingDeque.java b/guava/src/com/google/common/collect/ForwardingBlockingDeque.java
|
|
index 49d4bcf6c2..314e487787 100644
|
|
--- a/guava/src/com/google/common/collect/ForwardingBlockingDeque.java
|
|
+++ b/guava/src/com/google/common/collect/ForwardingBlockingDeque.java
|
|
@@ -92,14 +92,14 @@ public abstract class ForwardingBlockingDeque<E> extends ForwardingDeque<E>
|
|
return delegate().takeLast();
|
|
}
|
|
|
|
- @Override
|
|
@CheckForNull
|
|
+ @Override
|
|
public E pollFirst(long timeout, TimeUnit unit) throws InterruptedException {
|
|
return delegate().pollFirst(timeout, unit);
|
|
}
|
|
|
|
- @Override
|
|
@CheckForNull
|
|
+ @Override
|
|
public E pollLast(long timeout, TimeUnit unit) throws InterruptedException {
|
|
return delegate().pollLast(timeout, unit);
|
|
}
|
|
@@ -119,8 +119,8 @@ public abstract class ForwardingBlockingDeque<E> extends ForwardingDeque<E>
|
|
return delegate().take();
|
|
}
|
|
|
|
- @Override
|
|
@CheckForNull
|
|
+ @Override
|
|
public E poll(long timeout, TimeUnit unit) throws InterruptedException {
|
|
return delegate().poll(timeout, unit);
|
|
}
|
|
diff --git a/guava/src/com/google/common/collect/ForwardingConcurrentMap.java b/guava/src/com/google/common/collect/ForwardingConcurrentMap.java
|
|
index b662b0774a..fdeb097e02 100644
|
|
--- a/guava/src/com/google/common/collect/ForwardingConcurrentMap.java
|
|
+++ b/guava/src/com/google/common/collect/ForwardingConcurrentMap.java
|
|
@@ -48,8 +48,8 @@ public abstract class ForwardingConcurrentMap<K, V> extends ForwardingMap<K, V>
|
|
protected abstract ConcurrentMap<K, V> delegate();
|
|
|
|
@CanIgnoreReturnValue
|
|
- @Override
|
|
@CheckForNull
|
|
+ @Override
|
|
public V putIfAbsent(K key, V value) {
|
|
return delegate().putIfAbsent(key, value);
|
|
}
|
|
@@ -61,8 +61,8 @@ public abstract class ForwardingConcurrentMap<K, V> extends ForwardingMap<K, V>
|
|
}
|
|
|
|
@CanIgnoreReturnValue
|
|
- @Override
|
|
@CheckForNull
|
|
+ @Override
|
|
public V replace(K key, V value) {
|
|
return delegate().replace(key, value);
|
|
}
|
|
diff --git a/guava/src/com/google/common/collect/ForwardingDeque.java b/guava/src/com/google/common/collect/ForwardingDeque.java
|
|
index 571535cab9..8abe48892e 100644
|
|
--- a/guava/src/com/google/common/collect/ForwardingDeque.java
|
|
+++ b/guava/src/com/google/common/collect/ForwardingDeque.java
|
|
@@ -90,28 +90,28 @@ public abstract class ForwardingDeque<E extends @Nullable Object> extends Forwar
|
|
return delegate().offerLast(e);
|
|
}
|
|
|
|
- @Override
|
|
@CheckForNull
|
|
+ @Override
|
|
public E peekFirst() {
|
|
return delegate().peekFirst();
|
|
}
|
|
|
|
- @Override
|
|
@CheckForNull
|
|
+ @Override
|
|
public E peekLast() {
|
|
return delegate().peekLast();
|
|
}
|
|
|
|
@CanIgnoreReturnValue // TODO(cpovirk): Consider removing this?
|
|
- @Override
|
|
@CheckForNull
|
|
+ @Override
|
|
public E pollFirst() {
|
|
return delegate().pollFirst();
|
|
}
|
|
|
|
@CanIgnoreReturnValue // TODO(cpovirk): Consider removing this?
|
|
- @Override
|
|
@CheckForNull
|
|
+ @Override
|
|
public E pollLast() {
|
|
return delegate().pollLast();
|
|
}
|
|
diff --git a/guava/src/com/google/common/collect/ForwardingMap.java b/guava/src/com/google/common/collect/ForwardingMap.java
|
|
index 315a4fabca..a7b6936e01 100644
|
|
--- a/guava/src/com/google/common/collect/ForwardingMap.java
|
|
+++ b/guava/src/com/google/common/collect/ForwardingMap.java
|
|
@@ -78,8 +78,8 @@ public abstract class ForwardingMap<K extends @Nullable Object, V extends @Nulla
|
|
}
|
|
|
|
@CanIgnoreReturnValue
|
|
- @Override
|
|
@CheckForNull
|
|
+ @Override
|
|
public V remove(@CheckForNull Object key) {
|
|
return delegate().remove(key);
|
|
}
|
|
@@ -99,15 +99,15 @@ public abstract class ForwardingMap<K extends @Nullable Object, V extends @Nulla
|
|
return delegate().containsValue(value);
|
|
}
|
|
|
|
- @Override
|
|
@CheckForNull
|
|
+ @Override
|
|
public V get(@CheckForNull Object key) {
|
|
return delegate().get(key);
|
|
}
|
|
|
|
@CanIgnoreReturnValue
|
|
- @Override
|
|
@CheckForNull
|
|
+ @Override
|
|
public V put(@ParametricNullness K key, @ParametricNullness V value) {
|
|
return delegate().put(key, value);
|
|
}
|
|
diff --git a/guava/src/com/google/common/collect/ForwardingNavigableMap.java b/guava/src/com/google/common/collect/ForwardingNavigableMap.java
|
|
index c32468da1d..236cd91bc1 100644
|
|
--- a/guava/src/com/google/common/collect/ForwardingNavigableMap.java
|
|
+++ b/guava/src/com/google/common/collect/ForwardingNavigableMap.java
|
|
@@ -66,8 +66,8 @@ public abstract class ForwardingNavigableMap<K extends @Nullable Object, V exten
|
|
@Override
|
|
protected abstract NavigableMap<K, V> delegate();
|
|
|
|
- @Override
|
|
@CheckForNull
|
|
+ @Override
|
|
public Entry<K, V> lowerEntry(@ParametricNullness K key) {
|
|
return delegate().lowerEntry(key);
|
|
}
|
|
@@ -82,8 +82,8 @@ public abstract class ForwardingNavigableMap<K extends @Nullable Object, V exten
|
|
return headMap(key, false).lastEntry();
|
|
}
|
|
|
|
- @Override
|
|
@CheckForNull
|
|
+ @Override
|
|
public K lowerKey(@ParametricNullness K key) {
|
|
return delegate().lowerKey(key);
|
|
}
|
|
@@ -98,8 +98,8 @@ public abstract class ForwardingNavigableMap<K extends @Nullable Object, V exten
|
|
return keyOrNull(lowerEntry(key));
|
|
}
|
|
|
|
- @Override
|
|
@CheckForNull
|
|
+ @Override
|
|
public Entry<K, V> floorEntry(@ParametricNullness K key) {
|
|
return delegate().floorEntry(key);
|
|
}
|
|
@@ -114,8 +114,8 @@ public abstract class ForwardingNavigableMap<K extends @Nullable Object, V exten
|
|
return headMap(key, true).lastEntry();
|
|
}
|
|
|
|
- @Override
|
|
@CheckForNull
|
|
+ @Override
|
|
public K floorKey(@ParametricNullness K key) {
|
|
return delegate().floorKey(key);
|
|
}
|
|
@@ -130,8 +130,8 @@ public abstract class ForwardingNavigableMap<K extends @Nullable Object, V exten
|
|
return keyOrNull(floorEntry(key));
|
|
}
|
|
|
|
- @Override
|
|
@CheckForNull
|
|
+ @Override
|
|
public Entry<K, V> ceilingEntry(@ParametricNullness K key) {
|
|
return delegate().ceilingEntry(key);
|
|
}
|
|
@@ -146,8 +146,8 @@ public abstract class ForwardingNavigableMap<K extends @Nullable Object, V exten
|
|
return tailMap(key, true).firstEntry();
|
|
}
|
|
|
|
- @Override
|
|
@CheckForNull
|
|
+ @Override
|
|
public K ceilingKey(@ParametricNullness K key) {
|
|
return delegate().ceilingKey(key);
|
|
}
|
|
@@ -162,8 +162,8 @@ public abstract class ForwardingNavigableMap<K extends @Nullable Object, V exten
|
|
return keyOrNull(ceilingEntry(key));
|
|
}
|
|
|
|
- @Override
|
|
@CheckForNull
|
|
+ @Override
|
|
public Entry<K, V> higherEntry(@ParametricNullness K key) {
|
|
return delegate().higherEntry(key);
|
|
}
|
|
@@ -178,8 +178,8 @@ public abstract class ForwardingNavigableMap<K extends @Nullable Object, V exten
|
|
return tailMap(key, false).firstEntry();
|
|
}
|
|
|
|
- @Override
|
|
@CheckForNull
|
|
+ @Override
|
|
public K higherKey(@ParametricNullness K key) {
|
|
return delegate().higherKey(key);
|
|
}
|
|
@@ -194,8 +194,8 @@ public abstract class ForwardingNavigableMap<K extends @Nullable Object, V exten
|
|
return keyOrNull(higherEntry(key));
|
|
}
|
|
|
|
- @Override
|
|
@CheckForNull
|
|
+ @Override
|
|
public Entry<K, V> firstEntry() {
|
|
return delegate().firstEntry();
|
|
}
|
|
@@ -224,8 +224,8 @@ public abstract class ForwardingNavigableMap<K extends @Nullable Object, V exten
|
|
}
|
|
}
|
|
|
|
- @Override
|
|
@CheckForNull
|
|
+ @Override
|
|
public Entry<K, V> lastEntry() {
|
|
return delegate().lastEntry();
|
|
}
|
|
@@ -253,8 +253,8 @@ public abstract class ForwardingNavigableMap<K extends @Nullable Object, V exten
|
|
}
|
|
}
|
|
|
|
- @Override
|
|
@CheckForNull
|
|
+ @Override
|
|
public Entry<K, V> pollFirstEntry() {
|
|
return delegate().pollFirstEntry();
|
|
}
|
|
@@ -269,8 +269,8 @@ public abstract class ForwardingNavigableMap<K extends @Nullable Object, V exten
|
|
return Iterators.pollNext(entrySet().iterator());
|
|
}
|
|
|
|
- @Override
|
|
@CheckForNull
|
|
+ @Override
|
|
public Entry<K, V> pollLastEntry() {
|
|
return delegate().pollLastEntry();
|
|
}
|
|
diff --git a/guava/src/com/google/common/collect/ForwardingNavigableSet.java b/guava/src/com/google/common/collect/ForwardingNavigableSet.java
|
|
index 6822aa87d4..c8f509ddbb 100644
|
|
--- a/guava/src/com/google/common/collect/ForwardingNavigableSet.java
|
|
+++ b/guava/src/com/google/common/collect/ForwardingNavigableSet.java
|
|
@@ -61,8 +61,8 @@ public abstract class ForwardingNavigableSet<E extends @Nullable Object>
|
|
@Override
|
|
protected abstract NavigableSet<E> delegate();
|
|
|
|
- @Override
|
|
@CheckForNull
|
|
+ @Override
|
|
public E lower(@ParametricNullness E e) {
|
|
return delegate().lower(e);
|
|
}
|
|
@@ -77,8 +77,8 @@ public abstract class ForwardingNavigableSet<E extends @Nullable Object>
|
|
return Iterators.getNext(headSet(e, false).descendingIterator(), null);
|
|
}
|
|
|
|
- @Override
|
|
@CheckForNull
|
|
+ @Override
|
|
public E floor(@ParametricNullness E e) {
|
|
return delegate().floor(e);
|
|
}
|
|
@@ -93,8 +93,8 @@ public abstract class ForwardingNavigableSet<E extends @Nullable Object>
|
|
return Iterators.getNext(headSet(e, true).descendingIterator(), null);
|
|
}
|
|
|
|
- @Override
|
|
@CheckForNull
|
|
+ @Override
|
|
public E ceiling(@ParametricNullness E e) {
|
|
return delegate().ceiling(e);
|
|
}
|
|
@@ -109,8 +109,8 @@ public abstract class ForwardingNavigableSet<E extends @Nullable Object>
|
|
return Iterators.getNext(tailSet(e, true).iterator(), null);
|
|
}
|
|
|
|
- @Override
|
|
@CheckForNull
|
|
+ @Override
|
|
public E higher(@ParametricNullness E e) {
|
|
return delegate().higher(e);
|
|
}
|
|
@@ -125,8 +125,8 @@ public abstract class ForwardingNavigableSet<E extends @Nullable Object>
|
|
return Iterators.getNext(tailSet(e, false).iterator(), null);
|
|
}
|
|
|
|
- @Override
|
|
@CheckForNull
|
|
+ @Override
|
|
public E pollFirst() {
|
|
return delegate().pollFirst();
|
|
}
|
|
@@ -141,8 +141,8 @@ public abstract class ForwardingNavigableSet<E extends @Nullable Object>
|
|
return Iterators.pollNext(iterator());
|
|
}
|
|
|
|
- @Override
|
|
@CheckForNull
|
|
+ @Override
|
|
public E pollLast() {
|
|
return delegate().pollLast();
|
|
}
|
|
diff --git a/guava/src/com/google/common/collect/ForwardingQueue.java b/guava/src/com/google/common/collect/ForwardingQueue.java
|
|
index 43c2eaafb5..47c5caf393 100644
|
|
--- a/guava/src/com/google/common/collect/ForwardingQueue.java
|
|
+++ b/guava/src/com/google/common/collect/ForwardingQueue.java
|
|
@@ -63,8 +63,8 @@ public abstract class ForwardingQueue<E extends @Nullable Object> extends Forwar
|
|
}
|
|
|
|
@CanIgnoreReturnValue // TODO(cpovirk): Consider removing this?
|
|
- @Override
|
|
@CheckForNull
|
|
+ @Override
|
|
public E poll() {
|
|
return delegate().poll();
|
|
}
|
|
@@ -76,8 +76,8 @@ public abstract class ForwardingQueue<E extends @Nullable Object> extends Forwar
|
|
return delegate().remove();
|
|
}
|
|
|
|
- @Override
|
|
@CheckForNull
|
|
+ @Override
|
|
public E peek() {
|
|
return delegate().peek();
|
|
}
|
|
diff --git a/guava/src/com/google/common/collect/ForwardingSortedMap.java b/guava/src/com/google/common/collect/ForwardingSortedMap.java
|
|
index e0882abc7a..9f8e64c3c3 100644
|
|
--- a/guava/src/com/google/common/collect/ForwardingSortedMap.java
|
|
+++ b/guava/src/com/google/common/collect/ForwardingSortedMap.java
|
|
@@ -63,8 +63,8 @@ public abstract class ForwardingSortedMap<K extends @Nullable Object, V extends
|
|
@Override
|
|
protected abstract SortedMap<K, V> delegate();
|
|
|
|
- @Override
|
|
@CheckForNull
|
|
+ @Override
|
|
public Comparator<? super K> comparator() {
|
|
return delegate().comparator();
|
|
}
|
|
@@ -112,7 +112,7 @@ public abstract class ForwardingSortedMap<K extends @Nullable Object, V extends
|
|
}
|
|
|
|
// unsafe, but worst case is a CCE or NPE is thrown, which callers will be expecting
|
|
- @SuppressWarnings({"unchecked", "nullness"})
|
|
+ @SuppressWarnings({"nullness", "unchecked"})
|
|
static int unsafeCompare(
|
|
@CheckForNull Comparator<?> comparator, @CheckForNull Object o1, @CheckForNull Object o2) {
|
|
if (comparator == null) {
|
|
@@ -129,12 +129,12 @@ public abstract class ForwardingSortedMap<K extends @Nullable Object, V extends
|
|
*
|
|
* @since 7.0
|
|
*/
|
|
- @Override
|
|
@Beta
|
|
+ @Override
|
|
protected boolean standardContainsKey(@CheckForNull Object key) {
|
|
try {
|
|
// any CCE or NPE will be caught
|
|
- @SuppressWarnings({"unchecked", "nullness"})
|
|
+ @SuppressWarnings({"nullness", "unchecked"})
|
|
SortedMap<@Nullable Object, V> self = (SortedMap<@Nullable Object, V>) this;
|
|
Object ceilingKey = self.tailMap(key).firstKey();
|
|
return unsafeCompare(comparator(), ceilingKey, key) == 0;
|
|
diff --git a/guava/src/com/google/common/collect/ForwardingSortedMultiset.java b/guava/src/com/google/common/collect/ForwardingSortedMultiset.java
|
|
index 4626d3193a..e7e82b560d 100644
|
|
--- a/guava/src/com/google/common/collect/ForwardingSortedMultiset.java
|
|
+++ b/guava/src/com/google/common/collect/ForwardingSortedMultiset.java
|
|
@@ -112,8 +112,8 @@ public abstract class ForwardingSortedMultiset<E extends @Nullable Object>
|
|
}
|
|
}
|
|
|
|
- @Override
|
|
@CheckForNull
|
|
+ @Override
|
|
public Entry<E> firstEntry() {
|
|
return delegate().firstEntry();
|
|
}
|
|
@@ -134,8 +134,8 @@ public abstract class ForwardingSortedMultiset<E extends @Nullable Object>
|
|
return Multisets.immutableEntry(entry.getElement(), entry.getCount());
|
|
}
|
|
|
|
- @Override
|
|
@CheckForNull
|
|
+ @Override
|
|
public Entry<E> lastEntry() {
|
|
return delegate().lastEntry();
|
|
}
|
|
@@ -157,8 +157,8 @@ public abstract class ForwardingSortedMultiset<E extends @Nullable Object>
|
|
return Multisets.immutableEntry(entry.getElement(), entry.getCount());
|
|
}
|
|
|
|
- @Override
|
|
@CheckForNull
|
|
+ @Override
|
|
public Entry<E> pollFirstEntry() {
|
|
return delegate().pollFirstEntry();
|
|
}
|
|
@@ -181,8 +181,8 @@ public abstract class ForwardingSortedMultiset<E extends @Nullable Object>
|
|
return entry;
|
|
}
|
|
|
|
- @Override
|
|
@CheckForNull
|
|
+ @Override
|
|
public Entry<E> pollLastEntry() {
|
|
return delegate().pollLastEntry();
|
|
}
|
|
diff --git a/guava/src/com/google/common/collect/ForwardingSortedSet.java b/guava/src/com/google/common/collect/ForwardingSortedSet.java
|
|
index 32625afd16..d5695a3788 100644
|
|
--- a/guava/src/com/google/common/collect/ForwardingSortedSet.java
|
|
+++ b/guava/src/com/google/common/collect/ForwardingSortedSet.java
|
|
@@ -65,8 +65,8 @@ public abstract class ForwardingSortedSet<E extends @Nullable Object> extends Fo
|
|
@Override
|
|
protected abstract SortedSet<E> delegate();
|
|
|
|
- @Override
|
|
@CheckForNull
|
|
+ @Override
|
|
public Comparator<? super E> comparator() {
|
|
return delegate().comparator();
|
|
}
|
|
@@ -105,12 +105,12 @@ public abstract class ForwardingSortedSet<E extends @Nullable Object> extends Fo
|
|
*
|
|
* @since 7.0
|
|
*/
|
|
- @Override
|
|
@Beta
|
|
+ @Override
|
|
protected boolean standardContains(@CheckForNull Object object) {
|
|
try {
|
|
// any ClassCastExceptions and NullPointerExceptions are caught
|
|
- @SuppressWarnings({"unchecked", "nullness"})
|
|
+ @SuppressWarnings({"nullness", "unchecked"})
|
|
SortedSet<@Nullable Object> self = (SortedSet<@Nullable Object>) this;
|
|
Object ceiling = self.tailSet(object).first();
|
|
return unsafeCompare(comparator(), ceiling, object) == 0;
|
|
@@ -126,12 +126,12 @@ public abstract class ForwardingSortedSet<E extends @Nullable Object> extends Fo
|
|
*
|
|
* @since 7.0
|
|
*/
|
|
- @Override
|
|
@Beta
|
|
+ @Override
|
|
protected boolean standardRemove(@CheckForNull Object object) {
|
|
try {
|
|
// any ClassCastExceptions and NullPointerExceptions are caught
|
|
- @SuppressWarnings({"unchecked", "nullness"})
|
|
+ @SuppressWarnings({"nullness", "unchecked"})
|
|
SortedSet<@Nullable Object> self = (SortedSet<@Nullable Object>) this;
|
|
Iterator<?> iterator = self.tailSet(object).iterator();
|
|
if (iterator.hasNext()) {
|
|
diff --git a/guava/src/com/google/common/collect/ForwardingSortedSetMultimap.java b/guava/src/com/google/common/collect/ForwardingSortedSetMultimap.java
|
|
index b91a68b344..05d64a8742 100644
|
|
--- a/guava/src/com/google/common/collect/ForwardingSortedSetMultimap.java
|
|
+++ b/guava/src/com/google/common/collect/ForwardingSortedSetMultimap.java
|
|
@@ -61,8 +61,8 @@ public abstract class ForwardingSortedSetMultimap<
|
|
return delegate().replaceValues(key, values);
|
|
}
|
|
|
|
- @Override
|
|
@CheckForNull
|
|
+ @Override
|
|
public Comparator<? super V> valueComparator() {
|
|
return delegate().valueComparator();
|
|
}
|
|
diff --git a/guava/src/com/google/common/collect/ForwardingTable.java b/guava/src/com/google/common/collect/ForwardingTable.java
|
|
index 4fcb858b72..adf7be43b6 100644
|
|
--- a/guava/src/com/google/common/collect/ForwardingTable.java
|
|
+++ b/guava/src/com/google/common/collect/ForwardingTable.java
|
|
@@ -88,8 +88,8 @@ public abstract class ForwardingTable<
|
|
return delegate().containsValue(value);
|
|
}
|
|
|
|
- @Override
|
|
@CheckForNull
|
|
+ @Override
|
|
public V get(@CheckForNull Object rowKey, @CheckForNull Object columnKey) {
|
|
return delegate().get(rowKey, columnKey);
|
|
}
|
|
@@ -100,8 +100,8 @@ public abstract class ForwardingTable<
|
|
}
|
|
|
|
@CanIgnoreReturnValue
|
|
- @Override
|
|
@CheckForNull
|
|
+ @Override
|
|
public V put(
|
|
@ParametricNullness R rowKey, @ParametricNullness C columnKey, @ParametricNullness V value) {
|
|
return delegate().put(rowKey, columnKey, value);
|
|
@@ -113,8 +113,8 @@ public abstract class ForwardingTable<
|
|
}
|
|
|
|
@CanIgnoreReturnValue
|
|
- @Override
|
|
@CheckForNull
|
|
+ @Override
|
|
public V remove(@CheckForNull Object rowKey, @CheckForNull Object columnKey) {
|
|
return delegate().remove(rowKey, columnKey);
|
|
}
|
|
diff --git a/guava/src/com/google/common/collect/HashBiMap.java b/guava/src/com/google/common/collect/HashBiMap.java
|
|
index b0a5dd50ed..1ffffe8687 100644
|
|
--- a/guava/src/com/google/common/collect/HashBiMap.java
|
|
+++ b/guava/src/com/google/common/collect/HashBiMap.java
|
|
@@ -277,15 +277,15 @@ public final class HashBiMap<K extends @Nullable Object, V extends @Nullable Obj
|
|
return seekByValue(value, smearedHash(value)) != null;
|
|
}
|
|
|
|
- @Override
|
|
@CheckForNull
|
|
+ @Override
|
|
public V get(@CheckForNull Object key) {
|
|
return Maps.valueOrNull(seekByKey(key, smearedHash(key)));
|
|
}
|
|
|
|
@CanIgnoreReturnValue
|
|
- @Override
|
|
@CheckForNull
|
|
+ @Override
|
|
public V put(@ParametricNullness K key, @ParametricNullness V value) {
|
|
return put(key, value, false);
|
|
}
|
|
@@ -326,8 +326,8 @@ public final class HashBiMap<K extends @Nullable Object, V extends @Nullable Obj
|
|
}
|
|
|
|
@CanIgnoreReturnValue
|
|
- @Override
|
|
@CheckForNull
|
|
+ @Override
|
|
public V forcePut(@ParametricNullness K key, @ParametricNullness V value) {
|
|
return put(key, value, true);
|
|
}
|
|
@@ -396,14 +396,14 @@ public final class HashBiMap<K extends @Nullable Object, V extends @Nullable Obj
|
|
}
|
|
}
|
|
|
|
- @SuppressWarnings({"unchecked", "rawtypes"})
|
|
+ @SuppressWarnings({"rawtypes", "unchecked"})
|
|
private @Nullable BiEntry<K, V>[] createTable(int length) {
|
|
return new @Nullable BiEntry[length];
|
|
}
|
|
|
|
@CanIgnoreReturnValue
|
|
- @Override
|
|
@CheckForNull
|
|
+ @Override
|
|
public V remove(@CheckForNull Object key) {
|
|
BiEntry<K, V> entry = seekByKey(key, smearedHash(key));
|
|
if (entry == null) {
|
|
@@ -616,27 +616,27 @@ public final class HashBiMap<K extends @Nullable Object, V extends @Nullable Obj
|
|
return forward().containsValue(value);
|
|
}
|
|
|
|
- @Override
|
|
@CheckForNull
|
|
+ @Override
|
|
public K get(@CheckForNull Object value) {
|
|
return Maps.keyOrNull(seekByValue(value, smearedHash(value)));
|
|
}
|
|
|
|
@CanIgnoreReturnValue
|
|
- @Override
|
|
@CheckForNull
|
|
+ @Override
|
|
public K put(@ParametricNullness V value, @ParametricNullness K key) {
|
|
return putInverse(value, key, false);
|
|
}
|
|
|
|
- @Override
|
|
@CheckForNull
|
|
+ @Override
|
|
public K forcePut(@ParametricNullness V value, @ParametricNullness K key) {
|
|
return putInverse(value, key, true);
|
|
}
|
|
|
|
- @Override
|
|
@CheckForNull
|
|
+ @Override
|
|
public K remove(@CheckForNull Object value) {
|
|
BiEntry<K, V> entry = seekByValue(value, smearedHash(value));
|
|
if (entry == null) {
|
|
diff --git a/guava/src/com/google/common/collect/HashMultimap.java b/guava/src/com/google/common/collect/HashMultimap.java
|
|
index 9e4c1c2233..ff604b807f 100644
|
|
--- a/guava/src/com/google/common/collect/HashMultimap.java
|
|
+++ b/guava/src/com/google/common/collect/HashMultimap.java
|
|
@@ -16,10 +16,11 @@
|
|
|
|
package com.google.common.collect;
|
|
|
|
+import static com.google.common.base.Preconditions.checkArgument;
|
|
+
|
|
import com.google.common.annotations.GwtCompatible;
|
|
import com.google.common.annotations.GwtIncompatible;
|
|
import com.google.common.annotations.VisibleForTesting;
|
|
-import com.google.common.base.Preconditions;
|
|
import java.io.IOException;
|
|
import java.io.ObjectInputStream;
|
|
import java.io.ObjectOutputStream;
|
|
@@ -105,7 +106,7 @@ public final class HashMultimap<K extends @Nullable Object, V extends @Nullable
|
|
|
|
private HashMultimap(int expectedKeys, int expectedValuesPerKey) {
|
|
super(Platform.<K, Collection<V>>newHashMapWithExpectedSize(expectedKeys));
|
|
- Preconditions.checkArgument(expectedValuesPerKey >= 0);
|
|
+ checkArgument(expectedValuesPerKey >= 0);
|
|
this.expectedValuesPerKey = expectedValuesPerKey;
|
|
}
|
|
|
|
diff --git a/guava/src/com/google/common/collect/ImmutableBiMap.java b/guava/src/com/google/common/collect/ImmutableBiMap.java
|
|
index 4c222c1bf9..5a7fc393d8 100644
|
|
--- a/guava/src/com/google/common/collect/ImmutableBiMap.java
|
|
+++ b/guava/src/com/google/common/collect/ImmutableBiMap.java
|
|
@@ -390,8 +390,8 @@ public abstract class ImmutableBiMap<K, V> extends ImmutableBiMapFauxverideShim<
|
|
* @throws NullPointerException if any key, value, or entry is null
|
|
* @since 19.0
|
|
*/
|
|
- @CanIgnoreReturnValue
|
|
@Beta
|
|
+ @CanIgnoreReturnValue
|
|
@Override
|
|
public Builder<K, V> putAll(Iterable<? extends Entry<? extends K, ? extends V>> entries) {
|
|
super.putAll(entries);
|
|
@@ -408,16 +408,16 @@ public abstract class ImmutableBiMap<K, V> extends ImmutableBiMapFauxverideShim<
|
|
* @throws IllegalStateException if this method was already called
|
|
* @since 19.0
|
|
*/
|
|
- @CanIgnoreReturnValue
|
|
@Beta
|
|
+ @CanIgnoreReturnValue
|
|
@Override
|
|
public Builder<K, V> orderEntriesByValue(Comparator<? super V> valueComparator) {
|
|
super.orderEntriesByValue(valueComparator);
|
|
return this;
|
|
}
|
|
|
|
- @Override
|
|
@CanIgnoreReturnValue
|
|
+ @Override
|
|
Builder<K, V> combine(ImmutableMap.Builder<K, V> builder) {
|
|
super.combine(builder);
|
|
return this;
|
|
@@ -488,8 +488,8 @@ public abstract class ImmutableBiMap<K, V> extends ImmutableBiMapFauxverideShim<
|
|
* @deprecated This method does not make sense for bimaps and should not be called.
|
|
* @since 31.1
|
|
*/
|
|
- @DoNotCall
|
|
@Deprecated
|
|
+ @DoNotCall
|
|
@Override
|
|
public ImmutableBiMap<K, V> buildKeepingLast() {
|
|
throw new UnsupportedOperationException("Not supported for bimaps");
|
|
@@ -604,10 +604,10 @@ public abstract class ImmutableBiMap<K, V> extends ImmutableBiMapFauxverideShim<
|
|
* @deprecated Unsupported operation.
|
|
*/
|
|
@CanIgnoreReturnValue
|
|
+ @CheckForNull
|
|
@Deprecated
|
|
- @Override
|
|
@DoNotCall("Always throws UnsupportedOperationException")
|
|
- @CheckForNull
|
|
+ @Override
|
|
public final V forcePut(K key, V value) {
|
|
throw new UnsupportedOperationException();
|
|
}
|
|
diff --git a/guava/src/com/google/common/collect/ImmutableClassToInstanceMap.java b/guava/src/com/google/common/collect/ImmutableClassToInstanceMap.java
|
|
index c59e9fdaba..48eb0f55c3 100644
|
|
--- a/guava/src/com/google/common/collect/ImmutableClassToInstanceMap.java
|
|
+++ b/guava/src/com/google/common/collect/ImmutableClassToInstanceMap.java
|
|
@@ -172,9 +172,9 @@ public final class ImmutableClassToInstanceMap<B> extends ForwardingMap<Class<?
|
|
return delegate;
|
|
}
|
|
|
|
- @Override
|
|
- @SuppressWarnings("unchecked") // value could not get in if not a T
|
|
@CheckForNull
|
|
+ @Override // value could not get in if not a T
|
|
+ @SuppressWarnings("unchecked")
|
|
public <T extends B> T getInstance(Class<T> type) {
|
|
return (T) delegate.get(checkNotNull(type));
|
|
}
|
|
@@ -186,10 +186,10 @@ public final class ImmutableClassToInstanceMap<B> extends ForwardingMap<Class<?
|
|
* @deprecated Unsupported operation.
|
|
*/
|
|
@CanIgnoreReturnValue
|
|
+ @CheckForNull
|
|
@Deprecated
|
|
- @Override
|
|
@DoNotCall("Always throws UnsupportedOperationException")
|
|
- @CheckForNull
|
|
+ @Override
|
|
public <T extends B> T putInstance(Class<T> type, T value) {
|
|
throw new UnsupportedOperationException();
|
|
}
|
|
diff --git a/guava/src/com/google/common/collect/ImmutableCollection.java b/guava/src/com/google/common/collect/ImmutableCollection.java
|
|
index 314f83cce9..c432e5e1e4 100644
|
|
--- a/guava/src/com/google/common/collect/ImmutableCollection.java
|
|
+++ b/guava/src/com/google/common/collect/ImmutableCollection.java
|
|
@@ -258,8 +258,8 @@ public abstract class ImmutableCollection<E> extends AbstractCollection<E> imple
|
|
*/
|
|
@CanIgnoreReturnValue
|
|
@Deprecated
|
|
- @Override
|
|
@DoNotCall("Always throws UnsupportedOperationException")
|
|
+ @Override
|
|
public final boolean add(E e) {
|
|
throw new UnsupportedOperationException();
|
|
}
|
|
@@ -272,8 +272,8 @@ public abstract class ImmutableCollection<E> extends AbstractCollection<E> imple
|
|
*/
|
|
@CanIgnoreReturnValue
|
|
@Deprecated
|
|
- @Override
|
|
@DoNotCall("Always throws UnsupportedOperationException")
|
|
+ @Override
|
|
public final boolean remove(@CheckForNull Object object) {
|
|
throw new UnsupportedOperationException();
|
|
}
|
|
@@ -286,8 +286,8 @@ public abstract class ImmutableCollection<E> extends AbstractCollection<E> imple
|
|
*/
|
|
@CanIgnoreReturnValue
|
|
@Deprecated
|
|
- @Override
|
|
@DoNotCall("Always throws UnsupportedOperationException")
|
|
+ @Override
|
|
public final boolean addAll(Collection<? extends E> newElements) {
|
|
throw new UnsupportedOperationException();
|
|
}
|
|
@@ -300,8 +300,8 @@ public abstract class ImmutableCollection<E> extends AbstractCollection<E> imple
|
|
*/
|
|
@CanIgnoreReturnValue
|
|
@Deprecated
|
|
- @Override
|
|
@DoNotCall("Always throws UnsupportedOperationException")
|
|
+ @Override
|
|
public final boolean removeAll(Collection<?> oldElements) {
|
|
throw new UnsupportedOperationException();
|
|
}
|
|
@@ -314,8 +314,8 @@ public abstract class ImmutableCollection<E> extends AbstractCollection<E> imple
|
|
*/
|
|
@CanIgnoreReturnValue
|
|
@Deprecated
|
|
- @Override
|
|
@DoNotCall("Always throws UnsupportedOperationException")
|
|
+ @Override
|
|
public final boolean removeIf(Predicate<? super E> filter) {
|
|
throw new UnsupportedOperationException();
|
|
}
|
|
@@ -327,8 +327,8 @@ public abstract class ImmutableCollection<E> extends AbstractCollection<E> imple
|
|
* @deprecated Unsupported operation.
|
|
*/
|
|
@Deprecated
|
|
- @Override
|
|
@DoNotCall("Always throws UnsupportedOperationException")
|
|
+ @Override
|
|
public final boolean retainAll(Collection<?> elementsToKeep) {
|
|
throw new UnsupportedOperationException();
|
|
}
|
|
@@ -340,8 +340,8 @@ public abstract class ImmutableCollection<E> extends AbstractCollection<E> imple
|
|
* @deprecated Unsupported operation.
|
|
*/
|
|
@Deprecated
|
|
- @Override
|
|
@DoNotCall("Always throws UnsupportedOperationException")
|
|
+ @Override
|
|
public final void clear() {
|
|
throw new UnsupportedOperationException();
|
|
}
|
|
diff --git a/guava/src/com/google/common/collect/ImmutableEnumMap.java b/guava/src/com/google/common/collect/ImmutableEnumMap.java
|
|
index d1e10f97d0..b932253cb7 100644
|
|
--- a/guava/src/com/google/common/collect/ImmutableEnumMap.java
|
|
+++ b/guava/src/com/google/common/collect/ImmutableEnumMap.java
|
|
@@ -74,8 +74,8 @@ final class ImmutableEnumMap<K extends Enum<K>, V> extends IteratorBasedImmutabl
|
|
return delegate.containsKey(key);
|
|
}
|
|
|
|
- @Override
|
|
@CheckForNull
|
|
+ @Override
|
|
public V get(@CheckForNull Object key) {
|
|
return delegate.get(key);
|
|
}
|
|
diff --git a/guava/src/com/google/common/collect/ImmutableList.java b/guava/src/com/google/common/collect/ImmutableList.java
|
|
index bc8166507d..e92d454e28 100644
|
|
--- a/guava/src/com/google/common/collect/ImmutableList.java
|
|
+++ b/guava/src/com/google/common/collect/ImmutableList.java
|
|
@@ -508,8 +508,8 @@ public abstract class ImmutableList<E> extends ImmutableCollection<E>
|
|
*/
|
|
@CanIgnoreReturnValue
|
|
@Deprecated
|
|
- @Override
|
|
@DoNotCall("Always throws UnsupportedOperationException")
|
|
+ @Override
|
|
public final boolean addAll(int index, Collection<? extends E> newElements) {
|
|
throw new UnsupportedOperationException();
|
|
}
|
|
@@ -522,8 +522,8 @@ public abstract class ImmutableList<E> extends ImmutableCollection<E>
|
|
*/
|
|
@CanIgnoreReturnValue
|
|
@Deprecated
|
|
- @Override
|
|
@DoNotCall("Always throws UnsupportedOperationException")
|
|
+ @Override
|
|
public final E set(int index, E element) {
|
|
throw new UnsupportedOperationException();
|
|
}
|
|
@@ -535,8 +535,8 @@ public abstract class ImmutableList<E> extends ImmutableCollection<E>
|
|
* @deprecated Unsupported operation.
|
|
*/
|
|
@Deprecated
|
|
- @Override
|
|
@DoNotCall("Always throws UnsupportedOperationException")
|
|
+ @Override
|
|
public final void add(int index, E element) {
|
|
throw new UnsupportedOperationException();
|
|
}
|
|
@@ -549,8 +549,8 @@ public abstract class ImmutableList<E> extends ImmutableCollection<E>
|
|
*/
|
|
@CanIgnoreReturnValue
|
|
@Deprecated
|
|
- @Override
|
|
@DoNotCall("Always throws UnsupportedOperationException")
|
|
+ @Override
|
|
public final E remove(int index) {
|
|
throw new UnsupportedOperationException();
|
|
}
|
|
@@ -562,8 +562,8 @@ public abstract class ImmutableList<E> extends ImmutableCollection<E>
|
|
* @deprecated Unsupported operation.
|
|
*/
|
|
@Deprecated
|
|
- @Override
|
|
@DoNotCall("Always throws UnsupportedOperationException")
|
|
+ @Override
|
|
public final void replaceAll(UnaryOperator<E> operator) {
|
|
throw new UnsupportedOperationException();
|
|
}
|
|
@@ -575,8 +575,8 @@ public abstract class ImmutableList<E> extends ImmutableCollection<E>
|
|
* @deprecated Unsupported operation.
|
|
*/
|
|
@Deprecated
|
|
- @Override
|
|
@DoNotCall("Always throws UnsupportedOperationException")
|
|
+ @Override
|
|
public final void sort(Comparator<? super E> c) {
|
|
throw new UnsupportedOperationException();
|
|
}
|
|
@@ -587,8 +587,8 @@ public abstract class ImmutableList<E> extends ImmutableCollection<E>
|
|
* @since 2.0
|
|
* @deprecated There is no reason to use this; it always returns {@code this}.
|
|
*/
|
|
- @InlineMe(replacement = "this")
|
|
@Deprecated
|
|
+ @InlineMe(replacement = "this")
|
|
@Override
|
|
public final ImmutableList<E> asList() {
|
|
return this;
|
|
diff --git a/guava/src/com/google/common/collect/ImmutableListMultimap.java b/guava/src/com/google/common/collect/ImmutableListMultimap.java
|
|
index 1acc1fc841..20916430e4 100644
|
|
--- a/guava/src/com/google/common/collect/ImmutableListMultimap.java
|
|
+++ b/guava/src/com/google/common/collect/ImmutableListMultimap.java
|
|
@@ -242,8 +242,8 @@ public class ImmutableListMultimap<K, V> extends ImmutableMultimap<K, V>
|
|
*
|
|
* @since 19.0
|
|
*/
|
|
- @CanIgnoreReturnValue
|
|
@Beta
|
|
+ @CanIgnoreReturnValue
|
|
@Override
|
|
public Builder<K, V> putAll(Iterable<? extends Entry<? extends K, ? extends V>> entries) {
|
|
super.putAll(entries);
|
|
@@ -432,8 +432,8 @@ public class ImmutableListMultimap<K, V> extends ImmutableMultimap<K, V>
|
|
*/
|
|
@CanIgnoreReturnValue
|
|
@Deprecated
|
|
- @Override
|
|
@DoNotCall("Always throws UnsupportedOperationException")
|
|
+ @Override
|
|
public final ImmutableList<V> removeAll(@CheckForNull Object key) {
|
|
throw new UnsupportedOperationException();
|
|
}
|
|
@@ -446,8 +446,8 @@ public class ImmutableListMultimap<K, V> extends ImmutableMultimap<K, V>
|
|
*/
|
|
@CanIgnoreReturnValue
|
|
@Deprecated
|
|
- @Override
|
|
@DoNotCall("Always throws UnsupportedOperationException")
|
|
+ @Override
|
|
public final ImmutableList<V> replaceValues(K key, Iterable<? extends V> values) {
|
|
throw new UnsupportedOperationException();
|
|
}
|
|
diff --git a/guava/src/com/google/common/collect/ImmutableMap.java b/guava/src/com/google/common/collect/ImmutableMap.java
|
|
index b24ed6c732..9ba5e20d55 100644
|
|
--- a/guava/src/com/google/common/collect/ImmutableMap.java
|
|
+++ b/guava/src/com/google/common/collect/ImmutableMap.java
|
|
@@ -422,7 +422,7 @@ public abstract class ImmutableMap<K, V> implements Map<K, V>, Serializable {
|
|
this(ImmutableCollection.Builder.DEFAULT_INITIAL_CAPACITY);
|
|
}
|
|
|
|
- @SuppressWarnings({"unchecked", "rawtypes"})
|
|
+ @SuppressWarnings({"rawtypes", "unchecked"})
|
|
Builder(int initialCapacity) {
|
|
this.entries = new @Nullable Entry[initialCapacity];
|
|
this.size = 0;
|
|
@@ -484,8 +484,8 @@ public abstract class ImmutableMap<K, V> implements Map<K, V>, Serializable {
|
|
* @throws NullPointerException if any key, value, or entry is null
|
|
* @since 19.0
|
|
*/
|
|
- @CanIgnoreReturnValue
|
|
@Beta
|
|
+ @CanIgnoreReturnValue
|
|
public Builder<K, V> putAll(Iterable<? extends Entry<? extends K, ? extends V>> entries) {
|
|
if (entries instanceof Collection) {
|
|
ensureCapacity(size + ((Collection<?>) entries).size());
|
|
@@ -506,8 +506,8 @@ public abstract class ImmutableMap<K, V> implements Map<K, V>, Serializable {
|
|
* @throws IllegalStateException if this method was already called
|
|
* @since 19.0
|
|
*/
|
|
- @CanIgnoreReturnValue
|
|
@Beta
|
|
+ @CanIgnoreReturnValue
|
|
public Builder<K, V> orderEntriesByValue(Comparator<? super V> valueComparator) {
|
|
checkState(this.valueComparator == null, "valueComparator was already set");
|
|
this.valueComparator = checkNotNull(valueComparator, "valueComparator");
|
|
@@ -772,10 +772,10 @@ public abstract class ImmutableMap<K, V> implements Map<K, V>, Serializable {
|
|
* @deprecated Unsupported operation.
|
|
*/
|
|
@CanIgnoreReturnValue
|
|
+ @CheckForNull
|
|
@Deprecated
|
|
- @Override
|
|
@DoNotCall("Always throws UnsupportedOperationException")
|
|
- @CheckForNull
|
|
+ @Override
|
|
public final V put(K k, V v) {
|
|
throw new UnsupportedOperationException();
|
|
}
|
|
@@ -787,10 +787,10 @@ public abstract class ImmutableMap<K, V> implements Map<K, V>, Serializable {
|
|
* @deprecated Unsupported operation.
|
|
*/
|
|
@CanIgnoreReturnValue
|
|
+ @CheckForNull
|
|
@Deprecated
|
|
- @Override
|
|
@DoNotCall("Always throws UnsupportedOperationException")
|
|
- @CheckForNull
|
|
+ @Override
|
|
public final V putIfAbsent(K key, V value) {
|
|
throw new UnsupportedOperationException();
|
|
}
|
|
@@ -802,8 +802,8 @@ public abstract class ImmutableMap<K, V> implements Map<K, V>, Serializable {
|
|
* @deprecated Unsupported operation.
|
|
*/
|
|
@Deprecated
|
|
- @Override
|
|
@DoNotCall("Always throws UnsupportedOperationException")
|
|
+ @Override
|
|
public final boolean replace(K key, V oldValue, V newValue) {
|
|
throw new UnsupportedOperationException();
|
|
}
|
|
@@ -814,10 +814,10 @@ public abstract class ImmutableMap<K, V> implements Map<K, V>, Serializable {
|
|
* @throws UnsupportedOperationException always
|
|
* @deprecated Unsupported operation.
|
|
*/
|
|
- @Deprecated
|
|
- @Override
|
|
@CheckForNull
|
|
+ @Deprecated
|
|
@DoNotCall("Always throws UnsupportedOperationException")
|
|
+ @Override
|
|
public final V replace(K key, V value) {
|
|
throw new UnsupportedOperationException();
|
|
}
|
|
@@ -829,8 +829,8 @@ public abstract class ImmutableMap<K, V> implements Map<K, V>, Serializable {
|
|
* @deprecated Unsupported operation.
|
|
*/
|
|
@Deprecated
|
|
- @Override
|
|
@DoNotCall("Always throws UnsupportedOperationException")
|
|
+ @Override
|
|
public final V computeIfAbsent(K key, Function<? super K, ? extends V> mappingFunction) {
|
|
throw new UnsupportedOperationException();
|
|
}
|
|
@@ -842,8 +842,8 @@ public abstract class ImmutableMap<K, V> implements Map<K, V>, Serializable {
|
|
* @deprecated Unsupported operation.
|
|
*/
|
|
@Deprecated
|
|
- @Override
|
|
@DoNotCall("Always throws UnsupportedOperationException")
|
|
+ @Override
|
|
public final V computeIfPresent(
|
|
K key, BiFunction<? super K, ? super V, ? extends V> remappingFunction) {
|
|
throw new UnsupportedOperationException();
|
|
@@ -856,8 +856,8 @@ public abstract class ImmutableMap<K, V> implements Map<K, V>, Serializable {
|
|
* @deprecated Unsupported operation.
|
|
*/
|
|
@Deprecated
|
|
- @Override
|
|
@DoNotCall("Always throws UnsupportedOperationException")
|
|
+ @Override
|
|
public final V compute(
|
|
K key, BiFunction<? super K, ? super @Nullable V, ? extends V> remappingFunction) {
|
|
throw new UnsupportedOperationException();
|
|
@@ -870,8 +870,8 @@ public abstract class ImmutableMap<K, V> implements Map<K, V>, Serializable {
|
|
* @deprecated Unsupported operation.
|
|
*/
|
|
@Deprecated
|
|
- @Override
|
|
@DoNotCall("Always throws UnsupportedOperationException")
|
|
+ @Override
|
|
public final V merge(
|
|
K key, V value, BiFunction<? super V, ? super V, ? extends V> remappingFunction) {
|
|
throw new UnsupportedOperationException();
|
|
@@ -884,8 +884,8 @@ public abstract class ImmutableMap<K, V> implements Map<K, V>, Serializable {
|
|
* @deprecated Unsupported operation.
|
|
*/
|
|
@Deprecated
|
|
- @Override
|
|
@DoNotCall("Always throws UnsupportedOperationException")
|
|
+ @Override
|
|
public final void putAll(Map<? extends K, ? extends V> map) {
|
|
throw new UnsupportedOperationException();
|
|
}
|
|
@@ -897,8 +897,8 @@ public abstract class ImmutableMap<K, V> implements Map<K, V>, Serializable {
|
|
* @deprecated Unsupported operation.
|
|
*/
|
|
@Deprecated
|
|
- @Override
|
|
@DoNotCall("Always throws UnsupportedOperationException")
|
|
+ @Override
|
|
public final void replaceAll(BiFunction<? super K, ? super V, ? extends V> function) {
|
|
throw new UnsupportedOperationException();
|
|
}
|
|
@@ -909,10 +909,10 @@ public abstract class ImmutableMap<K, V> implements Map<K, V>, Serializable {
|
|
* @throws UnsupportedOperationException always
|
|
* @deprecated Unsupported operation.
|
|
*/
|
|
+ @CheckForNull
|
|
@Deprecated
|
|
- @Override
|
|
@DoNotCall("Always throws UnsupportedOperationException")
|
|
- @CheckForNull
|
|
+ @Override
|
|
public final V remove(@CheckForNull Object o) {
|
|
throw new UnsupportedOperationException();
|
|
}
|
|
@@ -924,8 +924,8 @@ public abstract class ImmutableMap<K, V> implements Map<K, V>, Serializable {
|
|
* @deprecated Unsupported operation.
|
|
*/
|
|
@Deprecated
|
|
- @Override
|
|
@DoNotCall("Always throws UnsupportedOperationException")
|
|
+ @Override
|
|
public final boolean remove(@CheckForNull Object key, @CheckForNull Object value) {
|
|
throw new UnsupportedOperationException();
|
|
}
|
|
@@ -937,8 +937,8 @@ public abstract class ImmutableMap<K, V> implements Map<K, V>, Serializable {
|
|
* @deprecated Unsupported operation.
|
|
*/
|
|
@Deprecated
|
|
- @Override
|
|
@DoNotCall("Always throws UnsupportedOperationException")
|
|
+ @Override
|
|
public final void clear() {
|
|
throw new UnsupportedOperationException();
|
|
}
|
|
@@ -959,8 +959,8 @@ public abstract class ImmutableMap<K, V> implements Map<K, V>, Serializable {
|
|
}
|
|
|
|
// Overriding to mark it Nullable
|
|
- @Override
|
|
@CheckForNull
|
|
+ @Override
|
|
public abstract V get(@CheckForNull Object key);
|
|
|
|
/**
|
|
@@ -968,8 +968,8 @@ public abstract class ImmutableMap<K, V> implements Map<K, V>, Serializable {
|
|
* href="https://github.com/google/guava#guava-google-core-libraries-for-java">flavor</a>).
|
|
* Note, however, that Java 8 users can call this method with any version and flavor of Guava.
|
|
*/
|
|
- @Override
|
|
@CheckForNull
|
|
+ @Override
|
|
public final V getOrDefault(@CheckForNull Object key, @CheckForNull V defaultValue) {
|
|
/*
|
|
* Even though it's weird to pass a defaultValue that is null, some callers do so. Those who
|
|
@@ -1114,8 +1114,8 @@ public abstract class ImmutableMap<K, V> implements Map<K, V>, Serializable {
|
|
return ImmutableMap.this.containsKey(key);
|
|
}
|
|
|
|
- @Override
|
|
@CheckForNull
|
|
+ @Override
|
|
public ImmutableSet<V> get(@CheckForNull Object key) {
|
|
V outerValue = ImmutableMap.this.get(key);
|
|
return (outerValue == null) ? null : ImmutableSet.of(outerValue);
|
|
diff --git a/guava/src/com/google/common/collect/ImmutableMapEntry.java b/guava/src/com/google/common/collect/ImmutableMapEntry.java
|
|
index ac483d8fd8..13b5262a9d 100644
|
|
--- a/guava/src/com/google/common/collect/ImmutableMapEntry.java
|
|
+++ b/guava/src/com/google/common/collect/ImmutableMapEntry.java
|
|
@@ -92,8 +92,8 @@ class ImmutableMapEntry<K, V> extends ImmutableEntry<K, V> {
|
|
this.nextInKeyBucket = nextInKeyBucket;
|
|
}
|
|
|
|
- @Override
|
|
@CheckForNull
|
|
+ @Override
|
|
final ImmutableMapEntry<K, V> getNextInKeyBucket() {
|
|
return nextInKeyBucket;
|
|
}
|
|
@@ -117,8 +117,8 @@ class ImmutableMapEntry<K, V> extends ImmutableEntry<K, V> {
|
|
this.nextInValueBucket = nextInValueBucket;
|
|
}
|
|
|
|
- @Override
|
|
@CheckForNull
|
|
+ @Override
|
|
ImmutableMapEntry<K, V> getNextInValueBucket() {
|
|
return nextInValueBucket;
|
|
}
|
|
diff --git a/guava/src/com/google/common/collect/ImmutableMapEntrySet.java b/guava/src/com/google/common/collect/ImmutableMapEntrySet.java
|
|
index 6f5503af5c..b0fd79672c 100644
|
|
--- a/guava/src/com/google/common/collect/ImmutableMapEntrySet.java
|
|
+++ b/guava/src/com/google/common/collect/ImmutableMapEntrySet.java
|
|
@@ -52,8 +52,8 @@ abstract class ImmutableMapEntrySet<K, V> extends ImmutableSet.CachingAsList<Ent
|
|
return map;
|
|
}
|
|
|
|
- @Override
|
|
@GwtIncompatible("not used in GWT")
|
|
+ @Override
|
|
int copyIntoArray(@Nullable Object[] dst, int offset) {
|
|
return entries.copyIntoArray(dst, offset);
|
|
}
|
|
@@ -103,8 +103,8 @@ abstract class ImmutableMapEntrySet<K, V> extends ImmutableSet.CachingAsList<Ent
|
|
return map().isPartialView();
|
|
}
|
|
|
|
- @Override
|
|
- @GwtIncompatible // not used in GWT
|
|
+ @GwtIncompatible
|
|
+ @Override // not used in GWT
|
|
boolean isHashCodeFast() {
|
|
return map().isHashCodeFast();
|
|
}
|
|
diff --git a/guava/src/com/google/common/collect/ImmutableMultimap.java b/guava/src/com/google/common/collect/ImmutableMultimap.java
|
|
index d16e1bc562..f6489a080b 100644
|
|
--- a/guava/src/com/google/common/collect/ImmutableMultimap.java
|
|
+++ b/guava/src/com/google/common/collect/ImmutableMultimap.java
|
|
@@ -192,8 +192,8 @@ public abstract class ImmutableMultimap<K, V> extends BaseImmutableMultimap<K, V
|
|
*
|
|
* @since 19.0
|
|
*/
|
|
- @CanIgnoreReturnValue
|
|
@Beta
|
|
+ @CanIgnoreReturnValue
|
|
public Builder<K, V> putAll(Iterable<? extends Entry<? extends K, ? extends V>> entries) {
|
|
for (Entry<? extends K, ? extends V> entry : entries) {
|
|
put(entry);
|
|
@@ -366,8 +366,8 @@ public abstract class ImmutableMultimap<K, V> extends BaseImmutableMultimap<K, V
|
|
*/
|
|
@CanIgnoreReturnValue
|
|
@Deprecated
|
|
- @Override
|
|
@DoNotCall("Always throws UnsupportedOperationException")
|
|
+ @Override
|
|
// DoNotCall wants this to be final, but we want to override it to return more specific types.
|
|
// Inheritance is closed, and all subtypes are @DoNotCall, so this is safe to suppress.
|
|
@SuppressWarnings("DoNotCall")
|
|
@@ -383,8 +383,8 @@ public abstract class ImmutableMultimap<K, V> extends BaseImmutableMultimap<K, V
|
|
*/
|
|
@CanIgnoreReturnValue
|
|
@Deprecated
|
|
- @Override
|
|
@DoNotCall("Always throws UnsupportedOperationException")
|
|
+ @Override
|
|
// DoNotCall wants this to be final, but we want to override it to return more specific types.
|
|
// Inheritance is closed, and all subtypes are @DoNotCall, so this is safe to suppress.
|
|
@SuppressWarnings("DoNotCall")
|
|
@@ -399,8 +399,8 @@ public abstract class ImmutableMultimap<K, V> extends BaseImmutableMultimap<K, V
|
|
* @deprecated Unsupported operation.
|
|
*/
|
|
@Deprecated
|
|
- @Override
|
|
@DoNotCall("Always throws UnsupportedOperationException")
|
|
+ @Override
|
|
public final void clear() {
|
|
throw new UnsupportedOperationException();
|
|
}
|
|
@@ -429,8 +429,8 @@ public abstract class ImmutableMultimap<K, V> extends BaseImmutableMultimap<K, V
|
|
*/
|
|
@CanIgnoreReturnValue
|
|
@Deprecated
|
|
- @Override
|
|
@DoNotCall("Always throws UnsupportedOperationException")
|
|
+ @Override
|
|
public final boolean put(K key, V value) {
|
|
throw new UnsupportedOperationException();
|
|
}
|
|
@@ -443,8 +443,8 @@ public abstract class ImmutableMultimap<K, V> extends BaseImmutableMultimap<K, V
|
|
*/
|
|
@CanIgnoreReturnValue
|
|
@Deprecated
|
|
- @Override
|
|
@DoNotCall("Always throws UnsupportedOperationException")
|
|
+ @Override
|
|
public final boolean putAll(K key, Iterable<? extends V> values) {
|
|
throw new UnsupportedOperationException();
|
|
}
|
|
@@ -457,8 +457,8 @@ public abstract class ImmutableMultimap<K, V> extends BaseImmutableMultimap<K, V
|
|
*/
|
|
@CanIgnoreReturnValue
|
|
@Deprecated
|
|
- @Override
|
|
@DoNotCall("Always throws UnsupportedOperationException")
|
|
+ @Override
|
|
public final boolean putAll(Multimap<? extends K, ? extends V> multimap) {
|
|
throw new UnsupportedOperationException();
|
|
}
|
|
@@ -471,8 +471,8 @@ public abstract class ImmutableMultimap<K, V> extends BaseImmutableMultimap<K, V
|
|
*/
|
|
@CanIgnoreReturnValue
|
|
@Deprecated
|
|
- @Override
|
|
@DoNotCall("Always throws UnsupportedOperationException")
|
|
+ @Override
|
|
public final boolean remove(@CheckForNull Object key, @CheckForNull Object value) {
|
|
throw new UnsupportedOperationException();
|
|
}
|
|
diff --git a/guava/src/com/google/common/collect/ImmutableMultiset.java b/guava/src/com/google/common/collect/ImmutableMultiset.java
|
|
index c0bff4b173..9ef6bd3cf6 100644
|
|
--- a/guava/src/com/google/common/collect/ImmutableMultiset.java
|
|
+++ b/guava/src/com/google/common/collect/ImmutableMultiset.java
|
|
@@ -18,6 +18,7 @@ package com.google.common.collect;
|
|
|
|
import static com.google.common.base.Preconditions.checkNotNull;
|
|
import static java.util.Objects.requireNonNull;
|
|
+import static java.util.function.Function.identity;
|
|
|
|
import com.google.common.annotations.GwtCompatible;
|
|
import com.google.common.annotations.GwtIncompatible;
|
|
@@ -67,7 +68,7 @@ public abstract class ImmutableMultiset<E> extends ImmutableMultisetGwtSerializa
|
|
* @since 21.0
|
|
*/
|
|
public static <E> Collector<E, ?, ImmutableMultiset<E>> toImmutableMultiset() {
|
|
- return CollectCollectors.toImmutableMultiset(Function.identity(), e -> 1);
|
|
+ return CollectCollectors.toImmutableMultiset(identity(), e -> 1);
|
|
}
|
|
|
|
/**
|
|
@@ -275,8 +276,8 @@ public abstract class ImmutableMultiset<E> extends ImmutableMultisetGwtSerializa
|
|
*/
|
|
@CanIgnoreReturnValue
|
|
@Deprecated
|
|
- @Override
|
|
@DoNotCall("Always throws UnsupportedOperationException")
|
|
+ @Override
|
|
public final int add(E element, int occurrences) {
|
|
throw new UnsupportedOperationException();
|
|
}
|
|
@@ -289,8 +290,8 @@ public abstract class ImmutableMultiset<E> extends ImmutableMultisetGwtSerializa
|
|
*/
|
|
@CanIgnoreReturnValue
|
|
@Deprecated
|
|
- @Override
|
|
@DoNotCall("Always throws UnsupportedOperationException")
|
|
+ @Override
|
|
public final int remove(@CheckForNull Object element, int occurrences) {
|
|
throw new UnsupportedOperationException();
|
|
}
|
|
@@ -303,8 +304,8 @@ public abstract class ImmutableMultiset<E> extends ImmutableMultisetGwtSerializa
|
|
*/
|
|
@CanIgnoreReturnValue
|
|
@Deprecated
|
|
- @Override
|
|
@DoNotCall("Always throws UnsupportedOperationException")
|
|
+ @Override
|
|
public final int setCount(E element, int count) {
|
|
throw new UnsupportedOperationException();
|
|
}
|
|
@@ -317,8 +318,8 @@ public abstract class ImmutableMultiset<E> extends ImmutableMultisetGwtSerializa
|
|
*/
|
|
@CanIgnoreReturnValue
|
|
@Deprecated
|
|
- @Override
|
|
@DoNotCall("Always throws UnsupportedOperationException")
|
|
+ @Override
|
|
public final boolean setCount(E element, int oldCount, int newCount) {
|
|
throw new UnsupportedOperationException();
|
|
}
|
|
diff --git a/guava/src/com/google/common/collect/ImmutableRangeMap.java b/guava/src/com/google/common/collect/ImmutableRangeMap.java
|
|
index e1979ab65f..06255a7aae 100644
|
|
--- a/guava/src/com/google/common/collect/ImmutableRangeMap.java
|
|
+++ b/guava/src/com/google/common/collect/ImmutableRangeMap.java
|
|
@@ -177,8 +177,8 @@ public class ImmutableRangeMap<K extends Comparable<?>, V> implements RangeMap<K
|
|
this.values = values;
|
|
}
|
|
|
|
- @Override
|
|
@CheckForNull
|
|
+ @Override
|
|
public V get(K key) {
|
|
int index =
|
|
SortedLists.binarySearch(
|
|
@@ -195,8 +195,8 @@ public class ImmutableRangeMap<K extends Comparable<?>, V> implements RangeMap<K
|
|
}
|
|
}
|
|
|
|
- @Override
|
|
@CheckForNull
|
|
+ @Override
|
|
public Entry<Range<K>, V> getEntry(K key) {
|
|
int index =
|
|
SortedLists.binarySearch(
|
|
@@ -230,8 +230,8 @@ public class ImmutableRangeMap<K extends Comparable<?>, V> implements RangeMap<K
|
|
* @deprecated Unsupported operation.
|
|
*/
|
|
@Deprecated
|
|
- @Override
|
|
@DoNotCall("Always throws UnsupportedOperationException")
|
|
+ @Override
|
|
public final void put(Range<K> range, V value) {
|
|
throw new UnsupportedOperationException();
|
|
}
|
|
@@ -243,8 +243,8 @@ public class ImmutableRangeMap<K extends Comparable<?>, V> implements RangeMap<K
|
|
* @deprecated Unsupported operation.
|
|
*/
|
|
@Deprecated
|
|
- @Override
|
|
@DoNotCall("Always throws UnsupportedOperationException")
|
|
+ @Override
|
|
public final void putCoalescing(Range<K> range, V value) {
|
|
throw new UnsupportedOperationException();
|
|
}
|
|
@@ -256,8 +256,8 @@ public class ImmutableRangeMap<K extends Comparable<?>, V> implements RangeMap<K
|
|
* @deprecated Unsupported operation.
|
|
*/
|
|
@Deprecated
|
|
- @Override
|
|
@DoNotCall("Always throws UnsupportedOperationException")
|
|
+ @Override
|
|
public final void putAll(RangeMap<K, V> rangeMap) {
|
|
throw new UnsupportedOperationException();
|
|
}
|
|
@@ -269,8 +269,8 @@ public class ImmutableRangeMap<K extends Comparable<?>, V> implements RangeMap<K
|
|
* @deprecated Unsupported operation.
|
|
*/
|
|
@Deprecated
|
|
- @Override
|
|
@DoNotCall("Always throws UnsupportedOperationException")
|
|
+ @Override
|
|
public final void clear() {
|
|
throw new UnsupportedOperationException();
|
|
}
|
|
@@ -282,8 +282,8 @@ public class ImmutableRangeMap<K extends Comparable<?>, V> implements RangeMap<K
|
|
* @deprecated Unsupported operation.
|
|
*/
|
|
@Deprecated
|
|
- @Override
|
|
@DoNotCall("Always throws UnsupportedOperationException")
|
|
+ @Override
|
|
public final void remove(Range<K> range) {
|
|
throw new UnsupportedOperationException();
|
|
}
|
|
@@ -295,8 +295,8 @@ public class ImmutableRangeMap<K extends Comparable<?>, V> implements RangeMap<K
|
|
* @deprecated Unsupported operation.
|
|
*/
|
|
@Deprecated
|
|
- @Override
|
|
@DoNotCall("Always throws UnsupportedOperationException")
|
|
+ @Override
|
|
public final void merge(
|
|
Range<K> range,
|
|
@CheckForNull V value,
|
|
diff --git a/guava/src/com/google/common/collect/ImmutableRangeSet.java b/guava/src/com/google/common/collect/ImmutableRangeSet.java
|
|
index f279aae0c5..8b4397d447 100644
|
|
--- a/guava/src/com/google/common/collect/ImmutableRangeSet.java
|
|
+++ b/guava/src/com/google/common/collect/ImmutableRangeSet.java
|
|
@@ -187,8 +187,8 @@ public final class ImmutableRangeSet<C extends Comparable> extends AbstractRange
|
|
return index != -1 && ranges.get(index).encloses(otherRange);
|
|
}
|
|
|
|
- @Override
|
|
@CheckForNull
|
|
+ @Override
|
|
public Range<C> rangeContaining(C value) {
|
|
int index =
|
|
SortedLists.binarySearch(
|
|
@@ -225,8 +225,8 @@ public final class ImmutableRangeSet<C extends Comparable> extends AbstractRange
|
|
* @deprecated Unsupported operation.
|
|
*/
|
|
@Deprecated
|
|
- @Override
|
|
@DoNotCall("Always throws UnsupportedOperationException")
|
|
+ @Override
|
|
public void add(Range<C> range) {
|
|
throw new UnsupportedOperationException();
|
|
}
|
|
@@ -238,8 +238,8 @@ public final class ImmutableRangeSet<C extends Comparable> extends AbstractRange
|
|
* @deprecated Unsupported operation.
|
|
*/
|
|
@Deprecated
|
|
- @Override
|
|
@DoNotCall("Always throws UnsupportedOperationException")
|
|
+ @Override
|
|
public void addAll(RangeSet<C> other) {
|
|
throw new UnsupportedOperationException();
|
|
}
|
|
@@ -251,8 +251,8 @@ public final class ImmutableRangeSet<C extends Comparable> extends AbstractRange
|
|
* @deprecated Unsupported operation.
|
|
*/
|
|
@Deprecated
|
|
- @Override
|
|
@DoNotCall("Always throws UnsupportedOperationException")
|
|
+ @Override
|
|
public void addAll(Iterable<Range<C>> other) {
|
|
throw new UnsupportedOperationException();
|
|
}
|
|
@@ -264,8 +264,8 @@ public final class ImmutableRangeSet<C extends Comparable> extends AbstractRange
|
|
* @deprecated Unsupported operation.
|
|
*/
|
|
@Deprecated
|
|
- @Override
|
|
@DoNotCall("Always throws UnsupportedOperationException")
|
|
+ @Override
|
|
public void remove(Range<C> range) {
|
|
throw new UnsupportedOperationException();
|
|
}
|
|
@@ -277,8 +277,8 @@ public final class ImmutableRangeSet<C extends Comparable> extends AbstractRange
|
|
* @deprecated Unsupported operation.
|
|
*/
|
|
@Deprecated
|
|
- @Override
|
|
@DoNotCall("Always throws UnsupportedOperationException")
|
|
+ @Override
|
|
public void removeAll(RangeSet<C> other) {
|
|
throw new UnsupportedOperationException();
|
|
}
|
|
@@ -290,8 +290,8 @@ public final class ImmutableRangeSet<C extends Comparable> extends AbstractRange
|
|
* @deprecated Unsupported operation.
|
|
*/
|
|
@Deprecated
|
|
- @Override
|
|
@DoNotCall("Always throws UnsupportedOperationException")
|
|
+ @Override
|
|
public void removeAll(Iterable<Range<C>> other) {
|
|
throw new UnsupportedOperationException();
|
|
}
|
|
@@ -579,8 +579,8 @@ public final class ImmutableRangeSet<C extends Comparable> extends AbstractRange
|
|
final Iterator<Range<C>> rangeItr = ranges.iterator();
|
|
Iterator<C> elemItr = Iterators.emptyIterator();
|
|
|
|
- @Override
|
|
@CheckForNull
|
|
+ @Override
|
|
protected C computeNext() {
|
|
while (!elemItr.hasNext()) {
|
|
if (rangeItr.hasNext()) {
|
|
@@ -594,15 +594,15 @@ public final class ImmutableRangeSet<C extends Comparable> extends AbstractRange
|
|
};
|
|
}
|
|
|
|
- @Override
|
|
@GwtIncompatible("NavigableSet")
|
|
+ @Override
|
|
public UnmodifiableIterator<C> descendingIterator() {
|
|
return new AbstractIterator<C>() {
|
|
final Iterator<Range<C>> rangeItr = ranges.reverse().iterator();
|
|
Iterator<C> elemItr = Iterators.emptyIterator();
|
|
|
|
- @Override
|
|
@CheckForNull
|
|
+ @Override
|
|
protected C computeNext() {
|
|
while (!elemItr.hasNext()) {
|
|
if (rangeItr.hasNext()) {
|
|
diff --git a/guava/src/com/google/common/collect/ImmutableSet.java b/guava/src/com/google/common/collect/ImmutableSet.java
|
|
index 73d5b09bf2..1cf249b5c3 100644
|
|
--- a/guava/src/com/google/common/collect/ImmutableSet.java
|
|
+++ b/guava/src/com/google/common/collect/ImmutableSet.java
|
|
@@ -75,7 +75,7 @@ public abstract class ImmutableSet<E> extends ImmutableCollection<E> implements
|
|
*
|
|
* <p><b>Performance note:</b> the instance returned is a singleton.
|
|
*/
|
|
- @SuppressWarnings({"unchecked"}) // fully variant implementation (never actually produces any Es)
|
|
+ @SuppressWarnings("unchecked") // fully variant implementation (never actually produces any Es)
|
|
public static <E> ImmutableSet<E> of() {
|
|
return (ImmutableSet<E>) RegularImmutableSet.EMPTY;
|
|
}
|
|
@@ -510,8 +510,8 @@ public abstract class ImmutableSet<E> extends ImmutableCollection<E> implements
|
|
impl = impl.copy();
|
|
}
|
|
|
|
- @Override
|
|
@CanIgnoreReturnValue
|
|
+ @Override
|
|
public Builder<E> add(E element) {
|
|
requireNonNull(impl); // see the comment on the field
|
|
checkNotNull(element);
|
|
@@ -520,8 +520,8 @@ public abstract class ImmutableSet<E> extends ImmutableCollection<E> implements
|
|
return this;
|
|
}
|
|
|
|
- @Override
|
|
@CanIgnoreReturnValue
|
|
+ @Override
|
|
public Builder<E> add(E... elements) {
|
|
super.add(elements);
|
|
return this;
|
|
@@ -535,15 +535,15 @@ public abstract class ImmutableSet<E> extends ImmutableCollection<E> implements
|
|
* @return this {@code Builder} object
|
|
* @throws NullPointerException if {@code elements} is null or contains a null element
|
|
*/
|
|
- @Override
|
|
@CanIgnoreReturnValue
|
|
+ @Override
|
|
public Builder<E> addAll(Iterable<? extends E> elements) {
|
|
super.addAll(elements);
|
|
return this;
|
|
}
|
|
|
|
- @Override
|
|
@CanIgnoreReturnValue
|
|
+ @Override
|
|
public Builder<E> addAll(Iterator<? extends E> elements) {
|
|
super.addAll(elements);
|
|
return this;
|
|
diff --git a/guava/src/com/google/common/collect/ImmutableSetMultimap.java b/guava/src/com/google/common/collect/ImmutableSetMultimap.java
|
|
index 52d6e55c34..f28c00ea62 100644
|
|
--- a/guava/src/com/google/common/collect/ImmutableSetMultimap.java
|
|
+++ b/guava/src/com/google/common/collect/ImmutableSetMultimap.java
|
|
@@ -277,8 +277,8 @@ public class ImmutableSetMultimap<K, V> extends ImmutableMultimap<K, V>
|
|
*
|
|
* @since 19.0
|
|
*/
|
|
- @CanIgnoreReturnValue
|
|
@Beta
|
|
+ @CanIgnoreReturnValue
|
|
@Override
|
|
public Builder<K, V> putAll(Iterable<? extends Entry<? extends K, ? extends V>> entries) {
|
|
super.putAll(entries);
|
|
@@ -492,8 +492,8 @@ public class ImmutableSetMultimap<K, V> extends ImmutableMultimap<K, V>
|
|
*/
|
|
@CanIgnoreReturnValue
|
|
@Deprecated
|
|
- @Override
|
|
@DoNotCall("Always throws UnsupportedOperationException")
|
|
+ @Override
|
|
public final ImmutableSet<V> removeAll(@CheckForNull Object key) {
|
|
throw new UnsupportedOperationException();
|
|
}
|
|
@@ -506,8 +506,8 @@ public class ImmutableSetMultimap<K, V> extends ImmutableMultimap<K, V>
|
|
*/
|
|
@CanIgnoreReturnValue
|
|
@Deprecated
|
|
- @Override
|
|
@DoNotCall("Always throws UnsupportedOperationException")
|
|
+ @Override
|
|
public final ImmutableSet<V> replaceValues(K key, Iterable<? extends V> values) {
|
|
throw new UnsupportedOperationException();
|
|
}
|
|
diff --git a/guava/src/com/google/common/collect/ImmutableSortedMap.java b/guava/src/com/google/common/collect/ImmutableSortedMap.java
|
|
index ab971937d0..942803b421 100644
|
|
--- a/guava/src/com/google/common/collect/ImmutableSortedMap.java
|
|
+++ b/guava/src/com/google/common/collect/ImmutableSortedMap.java
|
|
@@ -678,8 +678,8 @@ public final class ImmutableSortedMap<K, V> extends ImmutableSortedMapFauxveride
|
|
* @throws NullPointerException if any key, value, or entry is null
|
|
* @since 19.0
|
|
*/
|
|
- @CanIgnoreReturnValue
|
|
@Beta
|
|
+ @CanIgnoreReturnValue
|
|
@Override
|
|
public Builder<K, V> putAll(Iterable<? extends Entry<? extends K, ? extends V>> entries) {
|
|
super.putAll(entries);
|
|
@@ -692,11 +692,11 @@ public final class ImmutableSortedMap<K, V> extends ImmutableSortedMapFauxveride
|
|
* @since 19.0
|
|
* @deprecated Unsupported by ImmutableSortedMap.Builder.
|
|
*/
|
|
- @CanIgnoreReturnValue
|
|
@Beta
|
|
- @Override
|
|
+ @CanIgnoreReturnValue
|
|
@Deprecated
|
|
@DoNotCall("Always throws UnsupportedOperationException")
|
|
+ @Override
|
|
public final Builder<K, V> orderEntriesByValue(Comparator<? super V> valueComparator) {
|
|
throw new UnsupportedOperationException("Not available on ImmutableSortedMap.Builder");
|
|
}
|
|
@@ -753,8 +753,8 @@ public final class ImmutableSortedMap<K, V> extends ImmutableSortedMapFauxveride
|
|
* @since 31.1
|
|
* @deprecated This method is not currently implemented, and may never be.
|
|
*/
|
|
- @DoNotCall
|
|
@Deprecated
|
|
+ @DoNotCall
|
|
@Override
|
|
public final ImmutableSortedMap<K, V> buildKeepingLast() {
|
|
// TODO(emcmanus): implement
|
|
@@ -794,8 +794,8 @@ public final class ImmutableSortedMap<K, V> extends ImmutableSortedMapFauxveride
|
|
}
|
|
}
|
|
|
|
- @Override
|
|
@CheckForNull
|
|
+ @Override
|
|
public V get(@CheckForNull Object key) {
|
|
int index = keySet.indexOf(key);
|
|
return (index == -1) ? null : valueList.get(index);
|
|
@@ -1017,62 +1017,62 @@ public final class ImmutableSortedMap<K, V> extends ImmutableSortedMapFauxveride
|
|
return getSubMap(keySet.tailIndex(checkNotNull(fromKey), inclusive), size());
|
|
}
|
|
|
|
- @Override
|
|
@CheckForNull
|
|
+ @Override
|
|
public Entry<K, V> lowerEntry(K key) {
|
|
return headMap(key, false).lastEntry();
|
|
}
|
|
|
|
- @Override
|
|
@CheckForNull
|
|
+ @Override
|
|
public K lowerKey(K key) {
|
|
return keyOrNull(lowerEntry(key));
|
|
}
|
|
|
|
- @Override
|
|
@CheckForNull
|
|
+ @Override
|
|
public Entry<K, V> floorEntry(K key) {
|
|
return headMap(key, true).lastEntry();
|
|
}
|
|
|
|
- @Override
|
|
@CheckForNull
|
|
+ @Override
|
|
public K floorKey(K key) {
|
|
return keyOrNull(floorEntry(key));
|
|
}
|
|
|
|
- @Override
|
|
@CheckForNull
|
|
+ @Override
|
|
public Entry<K, V> ceilingEntry(K key) {
|
|
return tailMap(key, true).firstEntry();
|
|
}
|
|
|
|
- @Override
|
|
@CheckForNull
|
|
+ @Override
|
|
public K ceilingKey(K key) {
|
|
return keyOrNull(ceilingEntry(key));
|
|
}
|
|
|
|
- @Override
|
|
@CheckForNull
|
|
+ @Override
|
|
public Entry<K, V> higherEntry(K key) {
|
|
return tailMap(key, false).firstEntry();
|
|
}
|
|
|
|
- @Override
|
|
@CheckForNull
|
|
+ @Override
|
|
public K higherKey(K key) {
|
|
return keyOrNull(higherEntry(key));
|
|
}
|
|
|
|
- @Override
|
|
@CheckForNull
|
|
+ @Override
|
|
public Entry<K, V> firstEntry() {
|
|
return isEmpty() ? null : entrySet().asList().get(0);
|
|
}
|
|
|
|
- @Override
|
|
@CheckForNull
|
|
+ @Override
|
|
public Entry<K, V> lastEntry() {
|
|
return isEmpty() ? null : entrySet().asList().get(size() - 1);
|
|
}
|
|
@@ -1084,10 +1084,10 @@ public final class ImmutableSortedMap<K, V> extends ImmutableSortedMapFauxveride
|
|
* @deprecated Unsupported operation.
|
|
*/
|
|
@CanIgnoreReturnValue
|
|
+ @CheckForNull
|
|
@Deprecated
|
|
- @Override
|
|
@DoNotCall("Always throws UnsupportedOperationException")
|
|
- @CheckForNull
|
|
+ @Override
|
|
public final Entry<K, V> pollFirstEntry() {
|
|
throw new UnsupportedOperationException();
|
|
}
|
|
@@ -1099,10 +1099,10 @@ public final class ImmutableSortedMap<K, V> extends ImmutableSortedMapFauxveride
|
|
* @deprecated Unsupported operation.
|
|
*/
|
|
@CanIgnoreReturnValue
|
|
+ @CheckForNull
|
|
@Deprecated
|
|
- @Override
|
|
@DoNotCall("Always throws UnsupportedOperationException")
|
|
- @CheckForNull
|
|
+ @Override
|
|
public final Entry<K, V> pollLastEntry() {
|
|
throw new UnsupportedOperationException();
|
|
}
|
|
diff --git a/guava/src/com/google/common/collect/ImmutableSortedMapFauxverideShim.java b/guava/src/com/google/common/collect/ImmutableSortedMapFauxverideShim.java
|
|
index 7b2e4d7552..98b9f5d155 100644
|
|
--- a/guava/src/com/google/common/collect/ImmutableSortedMapFauxverideShim.java
|
|
+++ b/guava/src/com/google/common/collect/ImmutableSortedMapFauxverideShim.java
|
|
@@ -41,8 +41,8 @@ abstract class ImmutableSortedMapFauxverideShim<K, V> extends ImmutableMap<K, V>
|
|
* @throws UnsupportedOperationException always
|
|
* @deprecated Use {@link ImmutableSortedMap#toImmutableSortedMap}.
|
|
*/
|
|
- @DoNotCall("Use toImmutableSortedMap")
|
|
@Deprecated
|
|
+ @DoNotCall("Use toImmutableSortedMap")
|
|
public static <T extends @Nullable Object, K, V>
|
|
Collector<T, ?, ImmutableMap<K, V>> toImmutableMap(
|
|
Function<? super T, ? extends K> keyFunction,
|
|
@@ -58,8 +58,8 @@ abstract class ImmutableSortedMapFauxverideShim<K, V> extends ImmutableMap<K, V>
|
|
* @throws UnsupportedOperationException always
|
|
* @deprecated Use {@link ImmutableSortedMap#toImmutableSortedMap}.
|
|
*/
|
|
- @DoNotCall("Use toImmutableSortedMap")
|
|
@Deprecated
|
|
+ @DoNotCall("Use toImmutableSortedMap")
|
|
public static <T extends @Nullable Object, K, V>
|
|
Collector<T, ?, ImmutableMap<K, V>> toImmutableMap(
|
|
Function<? super T, ? extends K> keyFunction,
|
|
@@ -76,8 +76,8 @@ abstract class ImmutableSortedMapFauxverideShim<K, V> extends ImmutableMap<K, V>
|
|
* @throws UnsupportedOperationException always
|
|
* @deprecated Use {@link ImmutableSortedMap#naturalOrder}, which offers better type-safety.
|
|
*/
|
|
- @DoNotCall("Use naturalOrder")
|
|
@Deprecated
|
|
+ @DoNotCall("Use naturalOrder")
|
|
public static <K, V> ImmutableSortedMap.Builder<K, V> builder() {
|
|
throw new UnsupportedOperationException();
|
|
}
|
|
@@ -88,8 +88,8 @@ abstract class ImmutableSortedMapFauxverideShim<K, V> extends ImmutableMap<K, V>
|
|
* @throws UnsupportedOperationException always
|
|
* @deprecated Not supported for ImmutableSortedMap.
|
|
*/
|
|
- @DoNotCall("Use naturalOrder (which does not accept an expected size)")
|
|
@Deprecated
|
|
+ @DoNotCall("Use naturalOrder (which does not accept an expected size)")
|
|
public static <K, V> ImmutableSortedMap.Builder<K, V> builderWithExpectedSize(int expectedSize) {
|
|
throw new UnsupportedOperationException();
|
|
}
|
|
@@ -103,8 +103,8 @@ abstract class ImmutableSortedMapFauxverideShim<K, V> extends ImmutableMap<K, V>
|
|
* @deprecated <b>Pass a key of type {@code Comparable} to use {@link
|
|
* ImmutableSortedMap#of(Comparable, Object)}.</b>
|
|
*/
|
|
- @DoNotCall("Pass a key of type Comparable")
|
|
@Deprecated
|
|
+ @DoNotCall("Pass a key of type Comparable")
|
|
public static <K, V> ImmutableSortedMap<K, V> of(K k1, V v1) {
|
|
throw new UnsupportedOperationException();
|
|
}
|
|
@@ -118,8 +118,8 @@ abstract class ImmutableSortedMapFauxverideShim<K, V> extends ImmutableMap<K, V>
|
|
* @deprecated <b>Pass keys of type {@code Comparable} to use {@link
|
|
* ImmutableSortedMap#of(Comparable, Object, Comparable, Object)}.</b>
|
|
*/
|
|
- @DoNotCall("Pass keys of type Comparable")
|
|
@Deprecated
|
|
+ @DoNotCall("Pass keys of type Comparable")
|
|
public static <K, V> ImmutableSortedMap<K, V> of(K k1, V v1, K k2, V v2) {
|
|
throw new UnsupportedOperationException();
|
|
}
|
|
@@ -133,8 +133,8 @@ abstract class ImmutableSortedMapFauxverideShim<K, V> extends ImmutableMap<K, V>
|
|
* @deprecated <b>Pass keys of type {@code Comparable} to use {@link
|
|
* ImmutableSortedMap#of(Comparable, Object, Comparable, Object, Comparable, Object)}.</b>
|
|
*/
|
|
- @DoNotCall("Pass keys of type Comparable")
|
|
@Deprecated
|
|
+ @DoNotCall("Pass keys of type Comparable")
|
|
public static <K, V> ImmutableSortedMap<K, V> of(K k1, V v1, K k2, V v2, K k3, V v3) {
|
|
throw new UnsupportedOperationException();
|
|
}
|
|
@@ -149,8 +149,8 @@ abstract class ImmutableSortedMapFauxverideShim<K, V> extends ImmutableMap<K, V>
|
|
* ImmutableSortedMap#of(Comparable, Object, Comparable, Object, Comparable, Object,
|
|
* Comparable, Object)}.</b>
|
|
*/
|
|
- @DoNotCall("Pass keys of type Comparable")
|
|
@Deprecated
|
|
+ @DoNotCall("Pass keys of type Comparable")
|
|
public static <K, V> ImmutableSortedMap<K, V> of(K k1, V v1, K k2, V v2, K k3, V v3, K k4, V v4) {
|
|
throw new UnsupportedOperationException();
|
|
}
|
|
@@ -165,8 +165,8 @@ abstract class ImmutableSortedMapFauxverideShim<K, V> extends ImmutableMap<K, V>
|
|
* ImmutableSortedMap#of(Comparable, Object, Comparable, Object, Comparable, Object,
|
|
* Comparable, Object, Comparable, Object)}.</b>
|
|
*/
|
|
- @DoNotCall("Pass keys of type Comparable")
|
|
@Deprecated
|
|
+ @DoNotCall("Pass keys of type Comparable")
|
|
public static <K, V> ImmutableSortedMap<K, V> of(
|
|
K k1, V v1, K k2, V v2, K k3, V v3, K k4, V v4, K k5, V v5) {
|
|
throw new UnsupportedOperationException();
|
|
@@ -182,8 +182,8 @@ abstract class ImmutableSortedMapFauxverideShim<K, V> extends ImmutableMap<K, V>
|
|
* ImmutableSortedMap#of(Comparable, Object, Comparable, Object, Comparable, Object,
|
|
* Comparable, Object, Comparable, Object)}.</b>
|
|
*/
|
|
- @DoNotCall("Pass keys of type Comparable")
|
|
@Deprecated
|
|
+ @DoNotCall("Pass keys of type Comparable")
|
|
public static <K, V> ImmutableSortedMap<K, V> of(
|
|
K k1, V v1, K k2, V v2, K k3, V v3, K k4, V v4, K k5, V v5, K k6, V v6) {
|
|
throw new UnsupportedOperationException();
|
|
@@ -199,8 +199,8 @@ abstract class ImmutableSortedMapFauxverideShim<K, V> extends ImmutableMap<K, V>
|
|
* ImmutableSortedMap#of(Comparable, Object, Comparable, Object, Comparable, Object,
|
|
* Comparable, Object, Comparable, Object)}.</b>
|
|
*/
|
|
- @DoNotCall("Pass keys of type Comparable")
|
|
@Deprecated
|
|
+ @DoNotCall("Pass keys of type Comparable")
|
|
public static <K, V> ImmutableSortedMap<K, V> of(
|
|
K k1, V v1, K k2, V v2, K k3, V v3, K k4, V v4, K k5, V v5, K k6, V v6, K k7, V v7) {
|
|
throw new UnsupportedOperationException();
|
|
@@ -216,8 +216,8 @@ abstract class ImmutableSortedMapFauxverideShim<K, V> extends ImmutableMap<K, V>
|
|
* ImmutableSortedMap#of(Comparable, Object, Comparable, Object, Comparable, Object,
|
|
* Comparable, Object, Comparable, Object)}.</b>
|
|
*/
|
|
- @DoNotCall("Pass keys of type Comparable")
|
|
@Deprecated
|
|
+ @DoNotCall("Pass keys of type Comparable")
|
|
public static <K, V> ImmutableSortedMap<K, V> of(
|
|
K k1,
|
|
V v1,
|
|
@@ -248,8 +248,8 @@ abstract class ImmutableSortedMapFauxverideShim<K, V> extends ImmutableMap<K, V>
|
|
* ImmutableSortedMap#of(Comparable, Object, Comparable, Object, Comparable, Object,
|
|
* Comparable, Object, Comparable, Object)}.</b>
|
|
*/
|
|
- @DoNotCall("Pass keys of type Comparable")
|
|
@Deprecated
|
|
+ @DoNotCall("Pass keys of type Comparable")
|
|
public static <K, V> ImmutableSortedMap<K, V> of(
|
|
K k1,
|
|
V v1,
|
|
@@ -282,8 +282,8 @@ abstract class ImmutableSortedMapFauxverideShim<K, V> extends ImmutableMap<K, V>
|
|
* ImmutableSortedMap#of(Comparable, Object, Comparable, Object, Comparable, Object,
|
|
* Comparable, Object, Comparable, Object)}.</b>
|
|
*/
|
|
- @DoNotCall("Pass keys of type Comparable")
|
|
@Deprecated
|
|
+ @DoNotCall("Pass keys of type Comparable")
|
|
public static <K, V> ImmutableSortedMap<K, V> of(
|
|
K k1,
|
|
V v1,
|
|
@@ -313,8 +313,8 @@ abstract class ImmutableSortedMapFauxverideShim<K, V> extends ImmutableMap<K, V>
|
|
*
|
|
* @deprecated Use {@code ImmutableSortedMap.copyOf(ImmutableMap.ofEntries(...))}.
|
|
*/
|
|
- @DoNotCall("ImmutableSortedMap.ofEntries not currently available; use ImmutableSortedMap.copyOf")
|
|
@Deprecated
|
|
+ @DoNotCall("ImmutableSortedMap.ofEntries not currently available; use ImmutableSortedMap.copyOf")
|
|
public static <K, V> ImmutableSortedMap<K, V> ofEntries(
|
|
Entry<? extends K, ? extends V>... entries) {
|
|
throw new UnsupportedOperationException();
|
|
diff --git a/guava/src/com/google/common/collect/ImmutableSortedMultiset.java b/guava/src/com/google/common/collect/ImmutableSortedMultiset.java
|
|
index 0638df04e0..b3e2ce151e 100644
|
|
--- a/guava/src/com/google/common/collect/ImmutableSortedMultiset.java
|
|
+++ b/guava/src/com/google/common/collect/ImmutableSortedMultiset.java
|
|
@@ -16,6 +16,7 @@ package com.google.common.collect;
|
|
|
|
import static com.google.common.base.Preconditions.checkArgument;
|
|
import static com.google.common.base.Preconditions.checkNotNull;
|
|
+import static java.util.function.Function.identity;
|
|
|
|
import com.google.common.annotations.GwtIncompatible;
|
|
import com.google.errorprone.annotations.CanIgnoreReturnValue;
|
|
@@ -67,7 +68,7 @@ public abstract class ImmutableSortedMultiset<E> extends ImmutableSortedMultiset
|
|
*/
|
|
public static <E> Collector<E, ?, ImmutableSortedMultiset<E>> toImmutableSortedMultiset(
|
|
Comparator<? super E> comparator) {
|
|
- return toImmutableSortedMultiset(comparator, Function.identity(), e -> 1);
|
|
+ return toImmutableSortedMultiset(comparator, identity(), e -> 1);
|
|
}
|
|
|
|
/**
|
|
@@ -354,10 +355,10 @@ public abstract class ImmutableSortedMultiset<E> extends ImmutableSortedMultiset
|
|
* @deprecated Unsupported operation.
|
|
*/
|
|
@CanIgnoreReturnValue
|
|
+ @CheckForNull
|
|
@Deprecated
|
|
- @Override
|
|
@DoNotCall("Always throws UnsupportedOperationException")
|
|
- @CheckForNull
|
|
+ @Override
|
|
public final Entry<E> pollFirstEntry() {
|
|
throw new UnsupportedOperationException();
|
|
}
|
|
@@ -371,10 +372,10 @@ public abstract class ImmutableSortedMultiset<E> extends ImmutableSortedMultiset
|
|
* @deprecated Unsupported operation.
|
|
*/
|
|
@CanIgnoreReturnValue
|
|
+ @CheckForNull
|
|
@Deprecated
|
|
- @Override
|
|
@DoNotCall("Always throws UnsupportedOperationException")
|
|
- @CheckForNull
|
|
+ @Override
|
|
public final Entry<E> pollLastEntry() {
|
|
throw new UnsupportedOperationException();
|
|
}
|
|
diff --git a/guava/src/com/google/common/collect/ImmutableSortedMultisetFauxverideShim.java b/guava/src/com/google/common/collect/ImmutableSortedMultisetFauxverideShim.java
|
|
index 94a2f560da..3ae13a3edf 100644
|
|
--- a/guava/src/com/google/common/collect/ImmutableSortedMultisetFauxverideShim.java
|
|
+++ b/guava/src/com/google/common/collect/ImmutableSortedMultisetFauxverideShim.java
|
|
@@ -50,8 +50,8 @@ abstract class ImmutableSortedMultisetFauxverideShim<E> extends ImmutableMultise
|
|
* @deprecated Use {@link ImmutableSortedMultiset#toImmutableSortedMultiset}.
|
|
* @since 21.0
|
|
*/
|
|
- @DoNotCall("Use toImmutableSortedMultiset.")
|
|
@Deprecated
|
|
+ @DoNotCall("Use toImmutableSortedMultiset.")
|
|
public static <E> Collector<E, ?, ImmutableMultiset<E>> toImmutableMultiset() {
|
|
throw new UnsupportedOperationException();
|
|
}
|
|
@@ -65,8 +65,8 @@ abstract class ImmutableSortedMultisetFauxverideShim<E> extends ImmutableMultise
|
|
* @deprecated Use {@link ImmutableSortedMultiset#toImmutableSortedMultiset}.
|
|
* @since 22.0
|
|
*/
|
|
- @DoNotCall("Use toImmutableSortedMultiset.")
|
|
@Deprecated
|
|
+ @DoNotCall("Use toImmutableSortedMultiset.")
|
|
public static <T extends @Nullable Object, E>
|
|
Collector<T, ?, ImmutableMultiset<E>> toImmutableMultiset(
|
|
Function<? super T, ? extends E> elementFunction,
|
|
@@ -82,8 +82,8 @@ abstract class ImmutableSortedMultisetFauxverideShim<E> extends ImmutableMultise
|
|
* @throws UnsupportedOperationException always
|
|
* @deprecated Use {@link ImmutableSortedMultiset#naturalOrder}, which offers better type-safety.
|
|
*/
|
|
- @DoNotCall("Use naturalOrder.")
|
|
@Deprecated
|
|
+ @DoNotCall("Use naturalOrder.")
|
|
public static <E> ImmutableSortedMultiset.Builder<E> builder() {
|
|
throw new UnsupportedOperationException();
|
|
}
|
|
@@ -97,8 +97,8 @@ abstract class ImmutableSortedMultisetFauxverideShim<E> extends ImmutableMultise
|
|
* @deprecated <b>Pass a parameter of type {@code Comparable} to use {@link
|
|
* ImmutableSortedMultiset#of(Comparable)}.</b>
|
|
*/
|
|
- @DoNotCall("Elements must be Comparable. (Or, pass a Comparator to orderedBy or copyOf.)")
|
|
@Deprecated
|
|
+ @DoNotCall("Elements must be Comparable. (Or, pass a Comparator to orderedBy or copyOf.)")
|
|
public static <E> ImmutableSortedMultiset<E> of(E element) {
|
|
throw new UnsupportedOperationException();
|
|
}
|
|
@@ -112,8 +112,8 @@ abstract class ImmutableSortedMultisetFauxverideShim<E> extends ImmutableMultise
|
|
* @deprecated <b>Pass the parameters of type {@code Comparable} to use {@link
|
|
* ImmutableSortedMultiset#of(Comparable, Comparable)}.</b>
|
|
*/
|
|
- @DoNotCall("Elements must be Comparable. (Or, pass a Comparator to orderedBy or copyOf.)")
|
|
@Deprecated
|
|
+ @DoNotCall("Elements must be Comparable. (Or, pass a Comparator to orderedBy or copyOf.)")
|
|
public static <E> ImmutableSortedMultiset<E> of(E e1, E e2) {
|
|
throw new UnsupportedOperationException();
|
|
}
|
|
@@ -127,8 +127,8 @@ abstract class ImmutableSortedMultisetFauxverideShim<E> extends ImmutableMultise
|
|
* @deprecated <b>Pass the parameters of type {@code Comparable} to use {@link
|
|
* ImmutableSortedMultiset#of(Comparable, Comparable, Comparable)}.</b>
|
|
*/
|
|
- @DoNotCall("Elements must be Comparable. (Or, pass a Comparator to orderedBy or copyOf.)")
|
|
@Deprecated
|
|
+ @DoNotCall("Elements must be Comparable. (Or, pass a Comparator to orderedBy or copyOf.)")
|
|
public static <E> ImmutableSortedMultiset<E> of(E e1, E e2, E e3) {
|
|
throw new UnsupportedOperationException();
|
|
}
|
|
@@ -142,8 +142,8 @@ abstract class ImmutableSortedMultisetFauxverideShim<E> extends ImmutableMultise
|
|
* @deprecated <b>Pass the parameters of type {@code Comparable} to use {@link
|
|
* ImmutableSortedMultiset#of(Comparable, Comparable, Comparable, Comparable)}. </b>
|
|
*/
|
|
- @DoNotCall("Elements must be Comparable. (Or, pass a Comparator to orderedBy or copyOf.)")
|
|
@Deprecated
|
|
+ @DoNotCall("Elements must be Comparable. (Or, pass a Comparator to orderedBy or copyOf.)")
|
|
public static <E> ImmutableSortedMultiset<E> of(E e1, E e2, E e3, E e4) {
|
|
throw new UnsupportedOperationException();
|
|
}
|
|
@@ -158,8 +158,8 @@ abstract class ImmutableSortedMultisetFauxverideShim<E> extends ImmutableMultise
|
|
* ImmutableSortedMultiset#of(Comparable, Comparable, Comparable, Comparable, Comparable)} .
|
|
* </b>
|
|
*/
|
|
- @DoNotCall("Elements must be Comparable. (Or, pass a Comparator to orderedBy or copyOf.)")
|
|
@Deprecated
|
|
+ @DoNotCall("Elements must be Comparable. (Or, pass a Comparator to orderedBy or copyOf.)")
|
|
public static <E> ImmutableSortedMultiset<E> of(E e1, E e2, E e3, E e4, E e5) {
|
|
throw new UnsupportedOperationException();
|
|
}
|
|
@@ -174,8 +174,8 @@ abstract class ImmutableSortedMultisetFauxverideShim<E> extends ImmutableMultise
|
|
* ImmutableSortedMultiset#of(Comparable, Comparable, Comparable, Comparable, Comparable,
|
|
* Comparable, Comparable...)} . </b>
|
|
*/
|
|
- @DoNotCall("Elements must be Comparable. (Or, pass a Comparator to orderedBy or copyOf.)")
|
|
@Deprecated
|
|
+ @DoNotCall("Elements must be Comparable. (Or, pass a Comparator to orderedBy or copyOf.)")
|
|
public static <E> ImmutableSortedMultiset<E> of(
|
|
E e1, E e2, E e3, E e4, E e5, E e6, E... remaining) {
|
|
throw new UnsupportedOperationException();
|
|
@@ -190,8 +190,8 @@ abstract class ImmutableSortedMultisetFauxverideShim<E> extends ImmutableMultise
|
|
* @deprecated <b>Pass parameters of type {@code Comparable} to use {@link
|
|
* ImmutableSortedMultiset#copyOf(Comparable[])}.</b>
|
|
*/
|
|
- @DoNotCall("Elements must be Comparable. (Or, pass a Comparator to orderedBy or copyOf.)")
|
|
@Deprecated
|
|
+ @DoNotCall("Elements must be Comparable. (Or, pass a Comparator to orderedBy or copyOf.)")
|
|
public static <E> ImmutableSortedMultiset<E> copyOf(E[] elements) {
|
|
throw new UnsupportedOperationException();
|
|
}
|
|
diff --git a/guava/src/com/google/common/collect/ImmutableSortedSet.java b/guava/src/com/google/common/collect/ImmutableSortedSet.java
|
|
index 695dadc67b..5b0a1e8cd2 100644
|
|
--- a/guava/src/com/google/common/collect/ImmutableSortedSet.java
|
|
+++ b/guava/src/com/google/common/collect/ImmutableSortedSet.java
|
|
@@ -585,7 +585,7 @@ public abstract class ImmutableSortedSet<E> extends ImmutableSortedSetFauxveride
|
|
// Pretend the comparator can compare anything. If it turns out it can't
|
|
// compare a and b, we should get a CCE or NPE on the subsequent line. Only methods
|
|
// that are spec'd to throw CCE and NPE should call this.
|
|
- @SuppressWarnings({"unchecked", "nullness"})
|
|
+ @SuppressWarnings({"nullness", "unchecked"})
|
|
Comparator<@Nullable Object> unsafeComparator = (Comparator<@Nullable Object>) comparator;
|
|
return unsafeComparator.compare(a, b);
|
|
}
|
|
@@ -699,9 +699,9 @@ public abstract class ImmutableSortedSet<E> extends ImmutableSortedSetFauxveride
|
|
/**
|
|
* @since 12.0
|
|
*/
|
|
- @GwtIncompatible // NavigableSet
|
|
+ @CheckForNull // NavigableSet
|
|
+ @GwtIncompatible
|
|
@Override
|
|
- @CheckForNull
|
|
public E lower(E e) {
|
|
return Iterators.getNext(headSet(e, false).descendingIterator(), null);
|
|
}
|
|
@@ -709,8 +709,8 @@ public abstract class ImmutableSortedSet<E> extends ImmutableSortedSetFauxveride
|
|
/**
|
|
* @since 12.0
|
|
*/
|
|
- @Override
|
|
@CheckForNull
|
|
+ @Override
|
|
public E floor(E e) {
|
|
return Iterators.getNext(headSet(e, true).descendingIterator(), null);
|
|
}
|
|
@@ -718,8 +718,8 @@ public abstract class ImmutableSortedSet<E> extends ImmutableSortedSetFauxveride
|
|
/**
|
|
* @since 12.0
|
|
*/
|
|
- @Override
|
|
@CheckForNull
|
|
+ @Override
|
|
public E ceiling(E e) {
|
|
return Iterables.getFirst(tailSet(e, true), null);
|
|
}
|
|
@@ -727,9 +727,9 @@ public abstract class ImmutableSortedSet<E> extends ImmutableSortedSetFauxveride
|
|
/**
|
|
* @since 12.0
|
|
*/
|
|
- @GwtIncompatible // NavigableSet
|
|
+ @CheckForNull // NavigableSet
|
|
+ @GwtIncompatible
|
|
@Override
|
|
- @CheckForNull
|
|
public E higher(E e) {
|
|
return Iterables.getFirst(tailSet(e, false), null);
|
|
}
|
|
@@ -752,11 +752,11 @@ public abstract class ImmutableSortedSet<E> extends ImmutableSortedSetFauxveride
|
|
* @deprecated Unsupported operation.
|
|
*/
|
|
@CanIgnoreReturnValue
|
|
- @Deprecated
|
|
- @GwtIncompatible // NavigableSet
|
|
- @Override
|
|
- @DoNotCall("Always throws UnsupportedOperationException")
|
|
@CheckForNull
|
|
+ @Deprecated // NavigableSet
|
|
+ @DoNotCall("Always throws UnsupportedOperationException")
|
|
+ @GwtIncompatible
|
|
+ @Override
|
|
public final E pollFirst() {
|
|
throw new UnsupportedOperationException();
|
|
}
|
|
@@ -769,11 +769,11 @@ public abstract class ImmutableSortedSet<E> extends ImmutableSortedSetFauxveride
|
|
* @deprecated Unsupported operation.
|
|
*/
|
|
@CanIgnoreReturnValue
|
|
- @Deprecated
|
|
- @GwtIncompatible // NavigableSet
|
|
- @Override
|
|
- @DoNotCall("Always throws UnsupportedOperationException")
|
|
@CheckForNull
|
|
+ @Deprecated // NavigableSet
|
|
+ @DoNotCall("Always throws UnsupportedOperationException")
|
|
+ @GwtIncompatible
|
|
+ @Override
|
|
public final E pollLast() {
|
|
throw new UnsupportedOperationException();
|
|
}
|
|
diff --git a/guava/src/com/google/common/collect/ImmutableSortedSetFauxverideShim.java b/guava/src/com/google/common/collect/ImmutableSortedSetFauxverideShim.java
|
|
index ff3ac12d5e..e73333271e 100644
|
|
--- a/guava/src/com/google/common/collect/ImmutableSortedSetFauxverideShim.java
|
|
+++ b/guava/src/com/google/common/collect/ImmutableSortedSetFauxverideShim.java
|
|
@@ -48,8 +48,8 @@ abstract class ImmutableSortedSetFauxverideShim<E> extends ImmutableSet.CachingA
|
|
* @deprecated Use {@link ImmutableSortedSet#toImmutableSortedSet}.
|
|
* @since 21.0
|
|
*/
|
|
- @DoNotCall("Use toImmutableSortedSet")
|
|
@Deprecated
|
|
+ @DoNotCall("Use toImmutableSortedSet")
|
|
public static <E> Collector<E, ?, ImmutableSet<E>> toImmutableSet() {
|
|
throw new UnsupportedOperationException();
|
|
}
|
|
@@ -62,8 +62,8 @@ abstract class ImmutableSortedSetFauxverideShim<E> extends ImmutableSet.CachingA
|
|
* @throws UnsupportedOperationException always
|
|
* @deprecated Use {@link ImmutableSortedSet#naturalOrder}, which offers better type-safety.
|
|
*/
|
|
- @DoNotCall("Use naturalOrder")
|
|
@Deprecated
|
|
+ @DoNotCall("Use naturalOrder")
|
|
public static <E> ImmutableSortedSet.Builder<E> builder() {
|
|
throw new UnsupportedOperationException();
|
|
}
|
|
@@ -75,8 +75,8 @@ abstract class ImmutableSortedSetFauxverideShim<E> extends ImmutableSet.CachingA
|
|
* @throws UnsupportedOperationException always
|
|
* @deprecated Not supported by ImmutableSortedSet.
|
|
*/
|
|
- @DoNotCall("Use naturalOrder (which does not accept an expected size)")
|
|
@Deprecated
|
|
+ @DoNotCall("Use naturalOrder (which does not accept an expected size)")
|
|
public static <E> ImmutableSortedSet.Builder<E> builderWithExpectedSize(int expectedSize) {
|
|
throw new UnsupportedOperationException();
|
|
}
|
|
@@ -90,8 +90,8 @@ abstract class ImmutableSortedSetFauxverideShim<E> extends ImmutableSet.CachingA
|
|
* @deprecated <b>Pass a parameter of type {@code Comparable} to use {@link
|
|
* ImmutableSortedSet#of(Comparable)}.</b>
|
|
*/
|
|
- @DoNotCall("Pass a parameter of type Comparable")
|
|
@Deprecated
|
|
+ @DoNotCall("Pass a parameter of type Comparable")
|
|
public static <E> ImmutableSortedSet<E> of(E element) {
|
|
throw new UnsupportedOperationException();
|
|
}
|
|
@@ -105,8 +105,8 @@ abstract class ImmutableSortedSetFauxverideShim<E> extends ImmutableSet.CachingA
|
|
* @deprecated <b>Pass the parameters of type {@code Comparable} to use {@link
|
|
* ImmutableSortedSet#of(Comparable, Comparable)}.</b>
|
|
*/
|
|
- @DoNotCall("Pass parameters of type Comparable")
|
|
@Deprecated
|
|
+ @DoNotCall("Pass parameters of type Comparable")
|
|
public static <E> ImmutableSortedSet<E> of(E e1, E e2) {
|
|
throw new UnsupportedOperationException();
|
|
}
|
|
@@ -120,8 +120,8 @@ abstract class ImmutableSortedSetFauxverideShim<E> extends ImmutableSet.CachingA
|
|
* @deprecated <b>Pass the parameters of type {@code Comparable} to use {@link
|
|
* ImmutableSortedSet#of(Comparable, Comparable, Comparable)}.</b>
|
|
*/
|
|
- @DoNotCall("Pass parameters of type Comparable")
|
|
@Deprecated
|
|
+ @DoNotCall("Pass parameters of type Comparable")
|
|
public static <E> ImmutableSortedSet<E> of(E e1, E e2, E e3) {
|
|
throw new UnsupportedOperationException();
|
|
}
|
|
@@ -135,8 +135,8 @@ abstract class ImmutableSortedSetFauxverideShim<E> extends ImmutableSet.CachingA
|
|
* @deprecated <b>Pass the parameters of type {@code Comparable} to use {@link
|
|
* ImmutableSortedSet#of(Comparable, Comparable, Comparable, Comparable)}. </b>
|
|
*/
|
|
- @DoNotCall("Pass parameters of type Comparable")
|
|
@Deprecated
|
|
+ @DoNotCall("Pass parameters of type Comparable")
|
|
public static <E> ImmutableSortedSet<E> of(E e1, E e2, E e3, E e4) {
|
|
throw new UnsupportedOperationException();
|
|
}
|
|
@@ -150,8 +150,8 @@ abstract class ImmutableSortedSetFauxverideShim<E> extends ImmutableSet.CachingA
|
|
* @deprecated <b>Pass the parameters of type {@code Comparable} to use {@link
|
|
* ImmutableSortedSet#of( Comparable, Comparable, Comparable, Comparable, Comparable)}. </b>
|
|
*/
|
|
- @DoNotCall("Pass parameters of type Comparable")
|
|
@Deprecated
|
|
+ @DoNotCall("Pass parameters of type Comparable")
|
|
public static <E> ImmutableSortedSet<E> of(E e1, E e2, E e3, E e4, E e5) {
|
|
throw new UnsupportedOperationException();
|
|
}
|
|
@@ -166,8 +166,8 @@ abstract class ImmutableSortedSetFauxverideShim<E> extends ImmutableSet.CachingA
|
|
* ImmutableSortedSet#of(Comparable, Comparable, Comparable, Comparable, Comparable,
|
|
* Comparable, Comparable...)}. </b>
|
|
*/
|
|
- @DoNotCall("Pass parameters of type Comparable")
|
|
@Deprecated
|
|
+ @DoNotCall("Pass parameters of type Comparable")
|
|
public static <E> ImmutableSortedSet<E> of(E e1, E e2, E e3, E e4, E e5, E e6, E... remaining) {
|
|
throw new UnsupportedOperationException();
|
|
}
|
|
@@ -181,8 +181,8 @@ abstract class ImmutableSortedSetFauxverideShim<E> extends ImmutableSet.CachingA
|
|
* @deprecated <b>Pass parameters of type {@code Comparable} to use {@link
|
|
* ImmutableSortedSet#copyOf(Comparable[])}.</b>
|
|
*/
|
|
- @DoNotCall("Pass parameters of type Comparable")
|
|
@Deprecated
|
|
+ @DoNotCall("Pass parameters of type Comparable")
|
|
public static <E> ImmutableSortedSet<E> copyOf(E[] elements) {
|
|
throw new UnsupportedOperationException();
|
|
}
|
|
diff --git a/guava/src/com/google/common/collect/ImmutableTable.java b/guava/src/com/google/common/collect/ImmutableTable.java
|
|
index 033c271e6f..b49e440db3 100644
|
|
--- a/guava/src/com/google/common/collect/ImmutableTable.java
|
|
+++ b/guava/src/com/google/common/collect/ImmutableTable.java
|
|
@@ -392,8 +392,8 @@ public abstract class ImmutableTable<R, C, V> extends AbstractTable<R, C, V>
|
|
* @deprecated Unsupported operation.
|
|
*/
|
|
@Deprecated
|
|
- @Override
|
|
@DoNotCall("Always throws UnsupportedOperationException")
|
|
+ @Override
|
|
public final void clear() {
|
|
throw new UnsupportedOperationException();
|
|
}
|
|
@@ -405,10 +405,10 @@ public abstract class ImmutableTable<R, C, V> extends AbstractTable<R, C, V>
|
|
* @deprecated Unsupported operation.
|
|
*/
|
|
@CanIgnoreReturnValue
|
|
+ @CheckForNull
|
|
@Deprecated
|
|
- @Override
|
|
@DoNotCall("Always throws UnsupportedOperationException")
|
|
- @CheckForNull
|
|
+ @Override
|
|
public final V put(R rowKey, C columnKey, V value) {
|
|
throw new UnsupportedOperationException();
|
|
}
|
|
@@ -420,8 +420,8 @@ public abstract class ImmutableTable<R, C, V> extends AbstractTable<R, C, V>
|
|
* @deprecated Unsupported operation.
|
|
*/
|
|
@Deprecated
|
|
- @Override
|
|
@DoNotCall("Always throws UnsupportedOperationException")
|
|
+ @Override
|
|
public final void putAll(Table<? extends R, ? extends C, ? extends V> table) {
|
|
throw new UnsupportedOperationException();
|
|
}
|
|
@@ -433,10 +433,10 @@ public abstract class ImmutableTable<R, C, V> extends AbstractTable<R, C, V>
|
|
* @deprecated Unsupported operation.
|
|
*/
|
|
@CanIgnoreReturnValue
|
|
+ @CheckForNull
|
|
@Deprecated
|
|
- @Override
|
|
@DoNotCall("Always throws UnsupportedOperationException")
|
|
- @CheckForNull
|
|
+ @Override
|
|
public final V remove(@CheckForNull Object rowKey, @CheckForNull Object columnKey) {
|
|
throw new UnsupportedOperationException();
|
|
}
|
|
diff --git a/guava/src/com/google/common/collect/IndexedImmutableSet.java b/guava/src/com/google/common/collect/IndexedImmutableSet.java
|
|
index 20dfacbab8..eb8fed17ba 100644
|
|
--- a/guava/src/com/google/common/collect/IndexedImmutableSet.java
|
|
+++ b/guava/src/com/google/common/collect/IndexedImmutableSet.java
|
|
@@ -48,8 +48,8 @@ abstract class IndexedImmutableSet<E> extends ImmutableSet.CachingAsList<E> {
|
|
}
|
|
}
|
|
|
|
- @Override
|
|
@GwtIncompatible
|
|
+ @Override
|
|
int copyIntoArray(@Nullable Object[] dst, int offset) {
|
|
return asList().copyIntoArray(dst, offset);
|
|
}
|
|
diff --git a/guava/src/com/google/common/collect/Iterables.java b/guava/src/com/google/common/collect/Iterables.java
|
|
index 7928b15d67..8fd6aad01e 100644
|
|
--- a/guava/src/com/google/common/collect/Iterables.java
|
|
+++ b/guava/src/com/google/common/collect/Iterables.java
|
|
@@ -18,6 +18,7 @@ package com.google.common.collect;
|
|
|
|
import static com.google.common.base.Preconditions.checkArgument;
|
|
import static com.google.common.base.Preconditions.checkNotNull;
|
|
+import static com.google.common.base.Predicates.instanceOf;
|
|
import static com.google.common.collect.CollectPreconditions.checkRemove;
|
|
|
|
import com.google.common.annotations.Beta;
|
|
@@ -26,7 +27,6 @@ import com.google.common.annotations.GwtIncompatible;
|
|
import com.google.common.base.Function;
|
|
import com.google.common.base.Optional;
|
|
import com.google.common.base.Predicate;
|
|
-import com.google.common.base.Predicates;
|
|
import com.google.errorprone.annotations.CanIgnoreReturnValue;
|
|
import java.util.Collection;
|
|
import java.util.Comparator;
|
|
@@ -110,8 +110,8 @@ public final class Iterables {
|
|
iterable.forEach(action);
|
|
}
|
|
|
|
- @SuppressWarnings("unchecked") // safe upcast, assuming no one has a crazy Spliterator subclass
|
|
- @Override
|
|
+ @Override // safe upcast, assuming no one has a crazy Spliterator subclass
|
|
+ @SuppressWarnings("unchecked")
|
|
public Spliterator<T> spliterator() {
|
|
return (Spliterator<T>) iterable.spliterator();
|
|
}
|
|
@@ -390,7 +390,7 @@ public final class Iterables {
|
|
|
|
@Override
|
|
public String toString() {
|
|
- return iterable.toString() + " (cycled)";
|
|
+ return iterable + " (cycled)";
|
|
}
|
|
};
|
|
}
|
|
@@ -616,12 +616,12 @@ public final class Iterables {
|
|
* (ImmutableList) stream.filter(NewType.class::isInstance).collect(toImmutableList());}
|
|
* </pre>
|
|
*/
|
|
- @SuppressWarnings("unchecked")
|
|
- @GwtIncompatible // Class.isInstance
|
|
+ @GwtIncompatible
|
|
+ @SuppressWarnings("unchecked") // Class.isInstance
|
|
public static <T> Iterable<T> filter(final Iterable<?> unfiltered, final Class<T> desiredType) {
|
|
checkNotNull(unfiltered);
|
|
checkNotNull(desiredType);
|
|
- return (Iterable<T>) filter(unfiltered, Predicates.instanceOf(desiredType));
|
|
+ return (Iterable<T>) filter(unfiltered, instanceOf(desiredType));
|
|
}
|
|
|
|
/**
|
|
diff --git a/guava/src/com/google/common/collect/Iterators.java b/guava/src/com/google/common/collect/Iterators.java
|
|
index 916e513349..3dbfdc791a 100644
|
|
--- a/guava/src/com/google/common/collect/Iterators.java
|
|
+++ b/guava/src/com/google/common/collect/Iterators.java
|
|
@@ -18,10 +18,13 @@ package com.google.common.collect;
|
|
|
|
import static com.google.common.base.Preconditions.checkArgument;
|
|
import static com.google.common.base.Preconditions.checkNotNull;
|
|
+import static com.google.common.base.Preconditions.checkPositionIndex;
|
|
+import static com.google.common.base.Preconditions.checkPositionIndexes;
|
|
import static com.google.common.base.Preconditions.checkState;
|
|
import static com.google.common.base.Predicates.instanceOf;
|
|
import static com.google.common.collect.CollectPreconditions.checkRemove;
|
|
import static com.google.common.collect.NullnessCasts.uncheckedCastNullableTToT;
|
|
+import static java.util.Collections.unmodifiableList;
|
|
import static java.util.Objects.requireNonNull;
|
|
|
|
import com.google.common.annotations.Beta;
|
|
@@ -30,7 +33,6 @@ import com.google.common.annotations.GwtIncompatible;
|
|
import com.google.common.base.Function;
|
|
import com.google.common.base.Objects;
|
|
import com.google.common.base.Optional;
|
|
-import com.google.common.base.Preconditions;
|
|
import com.google.common.base.Predicate;
|
|
import com.google.common.primitives.Ints;
|
|
import com.google.errorprone.annotations.CanIgnoreReturnValue;
|
|
@@ -644,7 +646,7 @@ public final class Iterators {
|
|
array[i] = null; // for GWT
|
|
}
|
|
|
|
- List<@Nullable T> list = Collections.unmodifiableList(Arrays.asList(array));
|
|
+ List<@Nullable T> list = unmodifiableList(Arrays.asList(array));
|
|
// TODO(b/192579700): Use a ternary once it no longer confuses our nullness checker.
|
|
if (pad || count == size) {
|
|
return list;
|
|
@@ -664,8 +666,8 @@ public final class Iterators {
|
|
checkNotNull(unfiltered);
|
|
checkNotNull(retainIfTrue);
|
|
return new AbstractIterator<T>() {
|
|
- @Override
|
|
@CheckForNull
|
|
+ @Override
|
|
protected T computeNext() {
|
|
while (unfiltered.hasNext()) {
|
|
T element = unfiltered.next();
|
|
@@ -682,8 +684,8 @@ public final class Iterators {
|
|
* Returns a view of {@code unfiltered} containing all elements that are of the type {@code
|
|
* desiredType}.
|
|
*/
|
|
- @SuppressWarnings("unchecked") // can cast to <T> because non-Ts are removed
|
|
- @GwtIncompatible // Class.isInstance
|
|
+ @GwtIncompatible // can cast to <T> because non-Ts are removed
|
|
+ @SuppressWarnings("unchecked") // Class.isInstance
|
|
public static <T> UnmodifiableIterator<T> filter(Iterator<?> unfiltered, Class<T> desiredType) {
|
|
return (UnmodifiableIterator<T>) filter(unfiltered, instanceOf(desiredType));
|
|
}
|
|
@@ -822,8 +824,8 @@ public final class Iterators {
|
|
Iterator<F> fromIterator, Function<? super F, ? extends T> function) {
|
|
checkNotNull(function);
|
|
return new TransformedIterator<F, T>(fromIterator) {
|
|
- @ParametricNullness
|
|
@Override
|
|
+ @ParametricNullness
|
|
T transform(@ParametricNullness F from) {
|
|
return function.apply(from);
|
|
}
|
|
@@ -1070,8 +1072,8 @@ public final class Iterators {
|
|
int end = offset + length;
|
|
|
|
// Technically we should give a slightly more descriptive error on overflow
|
|
- Preconditions.checkPositionIndexes(offset, end, array.length);
|
|
- Preconditions.checkPositionIndex(index, length);
|
|
+ checkPositionIndexes(offset, end, array.length);
|
|
+ checkPositionIndex(index, length);
|
|
if (length == 0) {
|
|
return emptyListIterator();
|
|
}
|
|
diff --git a/guava/src/com/google/common/collect/JdkBackedImmutableBiMap.java b/guava/src/com/google/common/collect/JdkBackedImmutableBiMap.java
|
|
index f126fdea3b..e97a6f428d 100644
|
|
--- a/guava/src/com/google/common/collect/JdkBackedImmutableBiMap.java
|
|
+++ b/guava/src/com/google/common/collect/JdkBackedImmutableBiMap.java
|
|
@@ -104,8 +104,8 @@ final class JdkBackedImmutableBiMap<K, V> extends ImmutableBiMap<K, V> {
|
|
}
|
|
}
|
|
|
|
- @Override
|
|
@CheckForNull
|
|
+ @Override
|
|
public V get(@CheckForNull Object key) {
|
|
return forwardDelegate.get(key);
|
|
}
|
|
diff --git a/guava/src/com/google/common/collect/JdkBackedImmutableMap.java b/guava/src/com/google/common/collect/JdkBackedImmutableMap.java
|
|
index 222c4deb8a..d7abde3a3d 100644
|
|
--- a/guava/src/com/google/common/collect/JdkBackedImmutableMap.java
|
|
+++ b/guava/src/com/google/common/collect/JdkBackedImmutableMap.java
|
|
@@ -99,8 +99,8 @@ final class JdkBackedImmutableMap<K, V> extends ImmutableMap<K, V> {
|
|
return entries.size();
|
|
}
|
|
|
|
- @Override
|
|
@CheckForNull
|
|
+ @Override
|
|
public V get(@CheckForNull Object key) {
|
|
return delegateMap.get(key);
|
|
}
|
|
diff --git a/guava/src/com/google/common/collect/LinkedListMultimap.java b/guava/src/com/google/common/collect/LinkedListMultimap.java
|
|
index a69243469c..f6cbca6142 100644
|
|
--- a/guava/src/com/google/common/collect/LinkedListMultimap.java
|
|
+++ b/guava/src/com/google/common/collect/LinkedListMultimap.java
|
|
@@ -684,7 +684,7 @@ public class LinkedListMultimap<K extends @Nullable Object, V extends @Nullable
|
|
* to call getCopy and removeAllNodes only with a true K, then we could check containsKey first.
|
|
* But that check wouldn't eliminate the warnings.)
|
|
*/
|
|
- @SuppressWarnings({"unchecked", "nullness"})
|
|
+ @SuppressWarnings({"nullness", "unchecked"})
|
|
K castKey = (K) key;
|
|
List<V> oldValues = getCopy(castKey);
|
|
removeAllNodes(castKey);
|
|
diff --git a/guava/src/com/google/common/collect/Lists.java b/guava/src/com/google/common/collect/Lists.java
|
|
index e7f3817fd0..57b5c2dd80 100644
|
|
--- a/guava/src/com/google/common/collect/Lists.java
|
|
+++ b/guava/src/com/google/common/collect/Lists.java
|
|
@@ -99,8 +99,8 @@ public final class Lists {
|
|
* (...))}, or for creating an empty list then calling {@link Collections#addAll}. This method is
|
|
* not actually very useful and will likely be deprecated in the future.
|
|
*/
|
|
- @SafeVarargs
|
|
@GwtCompatible(serializable = true)
|
|
+ @SafeVarargs
|
|
public static <E extends @Nullable Object> ArrayList<E> newArrayList(E... elements) {
|
|
checkNotNull(elements); // for GWT
|
|
// Avoid integer overflow when a large array is passed in
|
|
diff --git a/guava/src/com/google/common/collect/MapMakerInternalMap.java b/guava/src/com/google/common/collect/MapMakerInternalMap.java
|
|
index 5e7daa50da..cc1f4534ae 100644
|
|
--- a/guava/src/com/google/common/collect/MapMakerInternalMap.java
|
|
+++ b/guava/src/com/google/common/collect/MapMakerInternalMap.java
|
|
@@ -583,8 +583,6 @@ class MapMakerInternalMap<
|
|
return Dummy.VALUE;
|
|
}
|
|
|
|
- void setValue(Dummy value) {}
|
|
-
|
|
StrongKeyDummyValueEntry<K> copy(StrongKeyDummyValueEntry<K> newNext) {
|
|
return new StrongKeyDummyValueEntry<K>(this.key, this.hash, newNext);
|
|
}
|
|
@@ -687,8 +685,6 @@ class MapMakerInternalMap<
|
|
return Dummy.VALUE;
|
|
}
|
|
|
|
- void setValue(Dummy value) {}
|
|
-
|
|
WeakKeyDummyValueEntry<K> copy(
|
|
ReferenceQueue<K> queueForKeys, WeakKeyDummyValueEntry<K> newNext) {
|
|
return new WeakKeyDummyValueEntry<K>(queueForKeys, getKey(), this.hash, newNext);
|
|
@@ -2008,8 +2004,8 @@ class MapMakerInternalMap<
|
|
return this;
|
|
}
|
|
|
|
- @SuppressWarnings("unchecked")
|
|
@Override
|
|
+ @SuppressWarnings("unchecked")
|
|
public StrongKeyStrongValueEntry<K, V> castForTesting(InternalEntry<K, V, ?> entry) {
|
|
return (StrongKeyStrongValueEntry<K, V>) entry;
|
|
}
|
|
@@ -2038,8 +2034,8 @@ class MapMakerInternalMap<
|
|
return queueForValues;
|
|
}
|
|
|
|
- @SuppressWarnings("unchecked")
|
|
@Override
|
|
+ @SuppressWarnings("unchecked")
|
|
public StrongKeyWeakValueEntry<K, V> castForTesting(InternalEntry<K, V, ?> entry) {
|
|
return (StrongKeyWeakValueEntry<K, V>) entry;
|
|
}
|
|
@@ -2096,8 +2092,8 @@ class MapMakerInternalMap<
|
|
return this;
|
|
}
|
|
|
|
- @SuppressWarnings("unchecked")
|
|
@Override
|
|
+ @SuppressWarnings("unchecked")
|
|
public StrongKeyDummyValueEntry<K> castForTesting(InternalEntry<K, Dummy, ?> entry) {
|
|
return (StrongKeyDummyValueEntry<K>) entry;
|
|
}
|
|
@@ -2126,8 +2122,8 @@ class MapMakerInternalMap<
|
|
return queueForKeys;
|
|
}
|
|
|
|
- @SuppressWarnings("unchecked")
|
|
@Override
|
|
+ @SuppressWarnings("unchecked")
|
|
public WeakKeyStrongValueEntry<K, V> castForTesting(InternalEntry<K, V, ?> entry) {
|
|
return (WeakKeyStrongValueEntry<K, V>) entry;
|
|
}
|
|
@@ -2171,8 +2167,8 @@ class MapMakerInternalMap<
|
|
return queueForValues;
|
|
}
|
|
|
|
- @SuppressWarnings("unchecked")
|
|
@Override
|
|
+ @SuppressWarnings("unchecked")
|
|
public WeakKeyWeakValueEntry<K, V> castForTesting(InternalEntry<K, V, ?> entry) {
|
|
return (WeakKeyWeakValueEntry<K, V>) entry;
|
|
}
|
|
@@ -2236,8 +2232,8 @@ class MapMakerInternalMap<
|
|
return queueForKeys;
|
|
}
|
|
|
|
- @SuppressWarnings("unchecked")
|
|
@Override
|
|
+ @SuppressWarnings("unchecked")
|
|
public WeakKeyDummyValueEntry<K> castForTesting(InternalEntry<K, Dummy, ?> entry) {
|
|
return (WeakKeyDummyValueEntry<K>) entry;
|
|
}
|
|
diff --git a/guava/src/com/google/common/collect/Maps.java b/guava/src/com/google/common/collect/Maps.java
|
|
index 64ea2892df..819fa6d216 100644
|
|
--- a/guava/src/com/google/common/collect/Maps.java
|
|
+++ b/guava/src/com/google/common/collect/Maps.java
|
|
@@ -22,6 +22,8 @@ import static com.google.common.base.Predicates.compose;
|
|
import static com.google.common.collect.CollectPreconditions.checkEntryNotNull;
|
|
import static com.google.common.collect.CollectPreconditions.checkNonnegative;
|
|
import static com.google.common.collect.NullnessCasts.uncheckedCastNullableTToT;
|
|
+import static java.util.Collections.unmodifiableSet;
|
|
+import static java.util.Collections.unmodifiableSortedMap;
|
|
import static java.util.Objects.requireNonNull;
|
|
|
|
import com.google.common.annotations.Beta;
|
|
@@ -31,7 +33,6 @@ import com.google.common.base.Converter;
|
|
import com.google.common.base.Equivalence;
|
|
import com.google.common.base.Function;
|
|
import com.google.common.base.Objects;
|
|
-import com.google.common.base.Preconditions;
|
|
import com.google.common.base.Predicate;
|
|
import com.google.common.base.Predicates;
|
|
import com.google.common.collect.MapDifference.ValueDifference;
|
|
@@ -94,15 +95,15 @@ public final class Maps {
|
|
|
|
private enum EntryFunction implements Function<Entry<?, ?>, @Nullable Object> {
|
|
KEY {
|
|
- @Override
|
|
@CheckForNull
|
|
+ @Override
|
|
public Object apply(Entry<?, ?> entry) {
|
|
return entry.getKey();
|
|
}
|
|
},
|
|
VALUE {
|
|
- @Override
|
|
@CheckForNull
|
|
+ @Override
|
|
public Object apply(Entry<?, ?> entry) {
|
|
return entry.getValue();
|
|
}
|
|
@@ -537,7 +538,7 @@ public final class Maps {
|
|
Map<? extends K, ? extends V> left,
|
|
Map<? extends K, ? extends V> right,
|
|
Equivalence<? super V> valueEquivalence) {
|
|
- Preconditions.checkNotNull(valueEquivalence);
|
|
+ checkNotNull(valueEquivalence);
|
|
|
|
Map<K, V> onlyOnLeft = newLinkedHashMap();
|
|
Map<K, V> onlyOnRight = new LinkedHashMap<>(right); // will whittle it down
|
|
@@ -629,7 +630,7 @@ public final class Maps {
|
|
private static <K extends @Nullable Object, V extends @Nullable Object> Map<K, V> unmodifiableMap(
|
|
Map<K, ? extends V> map) {
|
|
if (map instanceof SortedMap) {
|
|
- return Collections.unmodifiableSortedMap((SortedMap<K, ? extends V>) map);
|
|
+ return unmodifiableSortedMap((SortedMap<K, ? extends V>) map);
|
|
} else {
|
|
return Collections.unmodifiableMap(map);
|
|
}
|
|
@@ -933,14 +934,14 @@ public final class Maps {
|
|
return backingSet().contains(key);
|
|
}
|
|
|
|
- @Override
|
|
@CheckForNull
|
|
+ @Override
|
|
public V get(@CheckForNull Object key) {
|
|
return getOrDefault(key, null);
|
|
}
|
|
|
|
- @Override
|
|
@CheckForNull
|
|
+ @Override
|
|
public V getOrDefault(@CheckForNull Object key, @CheckForNull V defaultValue) {
|
|
if (Collections2.safeContains(backingSet(), key)) {
|
|
@SuppressWarnings("unchecked") // unsafe, but Javadoc warns about it
|
|
@@ -951,8 +952,8 @@ public final class Maps {
|
|
}
|
|
}
|
|
|
|
- @Override
|
|
@CheckForNull
|
|
+ @Override
|
|
public V remove(@CheckForNull Object key) {
|
|
if (backingSet().remove(key)) {
|
|
@SuppressWarnings("unchecked") // unsafe, but Javadoc warns about it
|
|
@@ -1015,8 +1016,8 @@ public final class Maps {
|
|
return (SortedSet<K>) super.backingSet();
|
|
}
|
|
|
|
- @Override
|
|
@CheckForNull
|
|
+ @Override
|
|
public Comparator<? super K> comparator() {
|
|
return backingSet().comparator();
|
|
}
|
|
@@ -1090,20 +1091,20 @@ public final class Maps {
|
|
return asMap(set.tailSet(fromKey, inclusive), function);
|
|
}
|
|
|
|
- @Override
|
|
@CheckForNull
|
|
+ @Override
|
|
public Comparator<? super K> comparator() {
|
|
return set.comparator();
|
|
}
|
|
|
|
- @Override
|
|
@CheckForNull
|
|
+ @Override
|
|
public V get(@CheckForNull Object key) {
|
|
return getOrDefault(key, null);
|
|
}
|
|
|
|
- @Override
|
|
@CheckForNull
|
|
+ @Override
|
|
public V getOrDefault(@CheckForNull Object key, @CheckForNull V defaultValue) {
|
|
if (Collections2.safeContains(set, key)) {
|
|
@SuppressWarnings("unchecked") // unsafe, but Javadoc warns about it
|
|
@@ -1476,7 +1477,7 @@ public final class Maps {
|
|
*/
|
|
static <K extends @Nullable Object, V extends @Nullable Object>
|
|
Set<Entry<K, V>> unmodifiableEntrySet(Set<Entry<K, V>> entrySet) {
|
|
- return new UnmodifiableEntrySet<>(Collections.unmodifiableSet(entrySet));
|
|
+ return new UnmodifiableEntrySet<>(unmodifiableSet(entrySet));
|
|
}
|
|
|
|
/**
|
|
@@ -1717,8 +1718,8 @@ public final class Maps {
|
|
return unmodifiableMap;
|
|
}
|
|
|
|
- @Override
|
|
@CheckForNull
|
|
+ @Override
|
|
public V forcePut(@ParametricNullness K key, @ParametricNullness V value) {
|
|
throw new UnsupportedOperationException();
|
|
}
|
|
@@ -1728,8 +1729,8 @@ public final class Maps {
|
|
throw new UnsupportedOperationException();
|
|
}
|
|
|
|
- @Override
|
|
@CheckForNull
|
|
+ @Override
|
|
public V putIfAbsent(K key, V value) {
|
|
throw new UnsupportedOperationException();
|
|
}
|
|
@@ -1744,8 +1745,8 @@ public final class Maps {
|
|
throw new UnsupportedOperationException();
|
|
}
|
|
|
|
- @Override
|
|
@CheckForNull
|
|
+ @Override
|
|
public V replace(K key, V value) {
|
|
throw new UnsupportedOperationException();
|
|
}
|
|
@@ -1785,7 +1786,7 @@ public final class Maps {
|
|
@Override
|
|
public Set<V> values() {
|
|
Set<V> result = values;
|
|
- return (result == null) ? values = Collections.unmodifiableSet(delegate.values()) : result;
|
|
+ return (result == null) ? values = unmodifiableSet(delegate.values()) : result;
|
|
}
|
|
|
|
private static final long serialVersionUID = 0;
|
|
@@ -2208,16 +2209,16 @@ public final class Maps {
|
|
return fromMap.containsKey(key);
|
|
}
|
|
|
|
- @Override
|
|
@CheckForNull
|
|
+ @Override
|
|
public V2 get(@CheckForNull Object key) {
|
|
return getOrDefault(key, null);
|
|
}
|
|
|
|
// safe as long as the user followed the <b>Warning</b> in the javadoc
|
|
- @SuppressWarnings("unchecked")
|
|
- @Override
|
|
@CheckForNull
|
|
+ @Override
|
|
+ @SuppressWarnings("unchecked")
|
|
public V2 getOrDefault(@CheckForNull Object key, @CheckForNull V2 defaultValue) {
|
|
V1 value = fromMap.get(key);
|
|
if (value != null || fromMap.containsKey(key)) {
|
|
@@ -2228,9 +2229,9 @@ public final class Maps {
|
|
}
|
|
|
|
// safe as long as the user followed the <b>Warning</b> in the javadoc
|
|
- @SuppressWarnings("unchecked")
|
|
- @Override
|
|
@CheckForNull
|
|
+ @Override
|
|
+ @SuppressWarnings("unchecked")
|
|
public V2 remove(@CheckForNull Object key) {
|
|
return fromMap.containsKey(key)
|
|
// The cast is safe because of the containsKey check.
|
|
@@ -2286,8 +2287,8 @@ public final class Maps {
|
|
super(fromMap, transformer);
|
|
}
|
|
|
|
- @Override
|
|
@CheckForNull
|
|
+ @Override
|
|
public Comparator<? super K> comparator() {
|
|
return fromMap().comparator();
|
|
}
|
|
@@ -2330,14 +2331,14 @@ public final class Maps {
|
|
super(fromMap, transformer);
|
|
}
|
|
|
|
- @Override
|
|
@CheckForNull
|
|
+ @Override
|
|
public Entry<K, V2> ceilingEntry(@ParametricNullness K key) {
|
|
return transformEntry(fromMap().ceilingEntry(key));
|
|
}
|
|
|
|
- @Override
|
|
@CheckForNull
|
|
+ @Override
|
|
public K ceilingKey(@ParametricNullness K key) {
|
|
return fromMap().ceilingKey(key);
|
|
}
|
|
@@ -2352,20 +2353,20 @@ public final class Maps {
|
|
return transformEntries(fromMap().descendingMap(), transformer);
|
|
}
|
|
|
|
- @Override
|
|
@CheckForNull
|
|
+ @Override
|
|
public Entry<K, V2> firstEntry() {
|
|
return transformEntry(fromMap().firstEntry());
|
|
}
|
|
|
|
- @Override
|
|
@CheckForNull
|
|
+ @Override
|
|
public Entry<K, V2> floorEntry(@ParametricNullness K key) {
|
|
return transformEntry(fromMap().floorEntry(key));
|
|
}
|
|
|
|
- @Override
|
|
@CheckForNull
|
|
+ @Override
|
|
public K floorKey(@ParametricNullness K key) {
|
|
return fromMap().floorKey(key);
|
|
}
|
|
@@ -2380,32 +2381,32 @@ public final class Maps {
|
|
return transformEntries(fromMap().headMap(toKey, inclusive), transformer);
|
|
}
|
|
|
|
- @Override
|
|
@CheckForNull
|
|
+ @Override
|
|
public Entry<K, V2> higherEntry(@ParametricNullness K key) {
|
|
return transformEntry(fromMap().higherEntry(key));
|
|
}
|
|
|
|
- @Override
|
|
@CheckForNull
|
|
+ @Override
|
|
public K higherKey(@ParametricNullness K key) {
|
|
return fromMap().higherKey(key);
|
|
}
|
|
|
|
- @Override
|
|
@CheckForNull
|
|
+ @Override
|
|
public Entry<K, V2> lastEntry() {
|
|
return transformEntry(fromMap().lastEntry());
|
|
}
|
|
|
|
- @Override
|
|
@CheckForNull
|
|
+ @Override
|
|
public Entry<K, V2> lowerEntry(@ParametricNullness K key) {
|
|
return transformEntry(fromMap().lowerEntry(key));
|
|
}
|
|
|
|
- @Override
|
|
@CheckForNull
|
|
+ @Override
|
|
public K lowerKey(@ParametricNullness K key) {
|
|
return fromMap().lowerKey(key);
|
|
}
|
|
@@ -2415,14 +2416,14 @@ public final class Maps {
|
|
return fromMap().navigableKeySet();
|
|
}
|
|
|
|
- @Override
|
|
@CheckForNull
|
|
+ @Override
|
|
public Entry<K, V2> pollFirstEntry() {
|
|
return transformEntry(fromMap().pollFirstEntry());
|
|
}
|
|
|
|
- @Override
|
|
@CheckForNull
|
|
+ @Override
|
|
public Entry<K, V2> pollLastEntry() {
|
|
return transformEntry(fromMap().pollLastEntry());
|
|
}
|
|
@@ -2926,13 +2927,13 @@ public final class Maps {
|
|
boolean apply(@CheckForNull Object key, @ParametricNullness V value) {
|
|
// This method is called only when the key is in the map (or about to be added to the map),
|
|
// implying that key is a K.
|
|
- @SuppressWarnings({"unchecked", "nullness"})
|
|
+ @SuppressWarnings({"nullness", "unchecked"})
|
|
K k = (K) key;
|
|
return predicate.apply(Maps.immutableEntry(k, value));
|
|
}
|
|
|
|
- @Override
|
|
@CheckForNull
|
|
+ @Override
|
|
public V put(@ParametricNullness K key, @ParametricNullness V value) {
|
|
checkArgument(apply(key, value));
|
|
return unfiltered.put(key, value);
|
|
@@ -2951,8 +2952,8 @@ public final class Maps {
|
|
return unfiltered.containsKey(key) && apply(key, unfiltered.get(key));
|
|
}
|
|
|
|
- @Override
|
|
@CheckForNull
|
|
+ @Override
|
|
public V get(@CheckForNull Object key) {
|
|
V value = unfiltered.get(key);
|
|
return ((value != null) && apply(key, value)) ? value : null;
|
|
@@ -2963,8 +2964,8 @@ public final class Maps {
|
|
return entrySet().isEmpty();
|
|
}
|
|
|
|
- @Override
|
|
@CheckForNull
|
|
+ @Override
|
|
public V remove(@CheckForNull Object key) {
|
|
return containsKey(key) ? unfiltered.remove(key) : null;
|
|
}
|
|
@@ -3218,8 +3219,8 @@ public final class Maps {
|
|
|
|
@WeakOuter
|
|
class SortedKeySet extends KeySet implements SortedSet<K> {
|
|
- @Override
|
|
@CheckForNull
|
|
+ @Override
|
|
public Comparator<? super K> comparator() {
|
|
return sortedMap().comparator();
|
|
}
|
|
@@ -3253,8 +3254,8 @@ public final class Maps {
|
|
}
|
|
}
|
|
|
|
- @Override
|
|
@CheckForNull
|
|
+ @Override
|
|
public Comparator<? super K> comparator() {
|
|
return sortedMap().comparator();
|
|
}
|
|
@@ -3318,8 +3319,8 @@ public final class Maps {
|
|
this.filteredDelegate = new FilteredEntryMap<>(unfiltered, entryPredicate);
|
|
}
|
|
|
|
- @Override
|
|
@CheckForNull
|
|
+ @Override
|
|
public Comparator<? super K> comparator() {
|
|
return unfiltered.comparator();
|
|
}
|
|
@@ -3364,8 +3365,8 @@ public final class Maps {
|
|
return !Iterables.any(unfiltered.entrySet(), entryPredicate);
|
|
}
|
|
|
|
- @Override
|
|
@CheckForNull
|
|
+ @Override
|
|
public V get(@CheckForNull Object key) {
|
|
return filteredDelegate.get(key);
|
|
}
|
|
@@ -3375,14 +3376,14 @@ public final class Maps {
|
|
return filteredDelegate.containsKey(key);
|
|
}
|
|
|
|
- @Override
|
|
@CheckForNull
|
|
+ @Override
|
|
public V put(@ParametricNullness K key, @ParametricNullness V value) {
|
|
return filteredDelegate.put(key, value);
|
|
}
|
|
|
|
- @Override
|
|
@CheckForNull
|
|
+ @Override
|
|
public V remove(@CheckForNull Object key) {
|
|
return filteredDelegate.remove(key);
|
|
}
|
|
@@ -3402,14 +3403,14 @@ public final class Maps {
|
|
return filteredDelegate.entrySet();
|
|
}
|
|
|
|
- @Override
|
|
@CheckForNull
|
|
+ @Override
|
|
public Entry<K, V> pollFirstEntry() {
|
|
return Iterables.removeFirstMatching(unfiltered.entrySet(), entryPredicate);
|
|
}
|
|
|
|
- @Override
|
|
@CheckForNull
|
|
+ @Override
|
|
public Entry<K, V> pollLastEntry() {
|
|
return Iterables.removeFirstMatching(unfiltered.descendingMap().entrySet(), entryPredicate);
|
|
}
|
|
@@ -3471,8 +3472,8 @@ public final class Maps {
|
|
return (BiMap<K, V>) unfiltered;
|
|
}
|
|
|
|
- @Override
|
|
@CheckForNull
|
|
+ @Override
|
|
public V forcePut(@ParametricNullness K key, @ParametricNullness V value) {
|
|
checkArgument(apply(key, value));
|
|
return unfiltered().forcePut(key, value);
|
|
@@ -3553,77 +3554,77 @@ public final class Maps {
|
|
|
|
@Override
|
|
protected SortedMap<K, V> delegate() {
|
|
- return Collections.unmodifiableSortedMap(delegate);
|
|
+ return unmodifiableSortedMap(delegate);
|
|
}
|
|
|
|
- @Override
|
|
@CheckForNull
|
|
+ @Override
|
|
public Entry<K, V> lowerEntry(@ParametricNullness K key) {
|
|
return unmodifiableOrNull(delegate.lowerEntry(key));
|
|
}
|
|
|
|
- @Override
|
|
@CheckForNull
|
|
+ @Override
|
|
public K lowerKey(@ParametricNullness K key) {
|
|
return delegate.lowerKey(key);
|
|
}
|
|
|
|
- @Override
|
|
@CheckForNull
|
|
+ @Override
|
|
public Entry<K, V> floorEntry(@ParametricNullness K key) {
|
|
return unmodifiableOrNull(delegate.floorEntry(key));
|
|
}
|
|
|
|
- @Override
|
|
@CheckForNull
|
|
+ @Override
|
|
public K floorKey(@ParametricNullness K key) {
|
|
return delegate.floorKey(key);
|
|
}
|
|
|
|
- @Override
|
|
@CheckForNull
|
|
+ @Override
|
|
public Entry<K, V> ceilingEntry(@ParametricNullness K key) {
|
|
return unmodifiableOrNull(delegate.ceilingEntry(key));
|
|
}
|
|
|
|
- @Override
|
|
@CheckForNull
|
|
+ @Override
|
|
public K ceilingKey(@ParametricNullness K key) {
|
|
return delegate.ceilingKey(key);
|
|
}
|
|
|
|
- @Override
|
|
@CheckForNull
|
|
+ @Override
|
|
public Entry<K, V> higherEntry(@ParametricNullness K key) {
|
|
return unmodifiableOrNull(delegate.higherEntry(key));
|
|
}
|
|
|
|
- @Override
|
|
@CheckForNull
|
|
+ @Override
|
|
public K higherKey(@ParametricNullness K key) {
|
|
return delegate.higherKey(key);
|
|
}
|
|
|
|
- @Override
|
|
@CheckForNull
|
|
+ @Override
|
|
public Entry<K, V> firstEntry() {
|
|
return unmodifiableOrNull(delegate.firstEntry());
|
|
}
|
|
|
|
- @Override
|
|
@CheckForNull
|
|
+ @Override
|
|
public Entry<K, V> lastEntry() {
|
|
return unmodifiableOrNull(delegate.lastEntry());
|
|
}
|
|
|
|
- @Override
|
|
@CheckForNull
|
|
+ @Override
|
|
public final Entry<K, V> pollFirstEntry() {
|
|
throw new UnsupportedOperationException();
|
|
}
|
|
|
|
- @Override
|
|
@CheckForNull
|
|
+ @Override
|
|
public final Entry<K, V> pollLastEntry() {
|
|
throw new UnsupportedOperationException();
|
|
}
|
|
@@ -3633,8 +3634,8 @@ public final class Maps {
|
|
throw new UnsupportedOperationException();
|
|
}
|
|
|
|
- @Override
|
|
@CheckForNull
|
|
+ @Override
|
|
public V putIfAbsent(K key, V value) {
|
|
throw new UnsupportedOperationException();
|
|
}
|
|
@@ -3649,8 +3650,8 @@ public final class Maps {
|
|
throw new UnsupportedOperationException();
|
|
}
|
|
|
|
- @Override
|
|
@CheckForNull
|
|
+ @Override
|
|
public V replace(K key, V value) {
|
|
throw new UnsupportedOperationException();
|
|
}
|
|
@@ -4088,8 +4089,8 @@ public final class Maps {
|
|
return (SortedMap<K, V>) super.map();
|
|
}
|
|
|
|
- @Override
|
|
@CheckForNull
|
|
+ @Override
|
|
public Comparator<? super K> comparator() {
|
|
return map().comparator();
|
|
}
|
|
@@ -4134,38 +4135,38 @@ public final class Maps {
|
|
return (NavigableMap<K, V>) map;
|
|
}
|
|
|
|
- @Override
|
|
@CheckForNull
|
|
+ @Override
|
|
public K lower(@ParametricNullness K e) {
|
|
return map().lowerKey(e);
|
|
}
|
|
|
|
- @Override
|
|
@CheckForNull
|
|
+ @Override
|
|
public K floor(@ParametricNullness K e) {
|
|
return map().floorKey(e);
|
|
}
|
|
|
|
- @Override
|
|
@CheckForNull
|
|
+ @Override
|
|
public K ceiling(@ParametricNullness K e) {
|
|
return map().ceilingKey(e);
|
|
}
|
|
|
|
- @Override
|
|
@CheckForNull
|
|
+ @Override
|
|
public K higher(@ParametricNullness K e) {
|
|
return map().higherKey(e);
|
|
}
|
|
|
|
- @Override
|
|
@CheckForNull
|
|
+ @Override
|
|
public K pollFirst() {
|
|
return keyOrNull(map().pollFirstEntry());
|
|
}
|
|
|
|
- @Override
|
|
@CheckForNull
|
|
+ @Override
|
|
public K pollLast() {
|
|
return keyOrNull(map().pollLastEntry());
|
|
}
|
|
@@ -4393,8 +4394,8 @@ public final class Maps {
|
|
|
|
@CheckForNull private transient Comparator<? super K> comparator;
|
|
|
|
- @SuppressWarnings("unchecked")
|
|
@Override
|
|
+ @SuppressWarnings("unchecked")
|
|
public Comparator<? super K> comparator() {
|
|
Comparator<? super K> result = comparator;
|
|
if (result == null) {
|
|
@@ -4424,74 +4425,74 @@ public final class Maps {
|
|
return forward().firstKey();
|
|
}
|
|
|
|
- @Override
|
|
@CheckForNull
|
|
+ @Override
|
|
public Entry<K, V> lowerEntry(@ParametricNullness K key) {
|
|
return forward().higherEntry(key);
|
|
}
|
|
|
|
- @Override
|
|
@CheckForNull
|
|
+ @Override
|
|
public K lowerKey(@ParametricNullness K key) {
|
|
return forward().higherKey(key);
|
|
}
|
|
|
|
- @Override
|
|
@CheckForNull
|
|
+ @Override
|
|
public Entry<K, V> floorEntry(@ParametricNullness K key) {
|
|
return forward().ceilingEntry(key);
|
|
}
|
|
|
|
- @Override
|
|
@CheckForNull
|
|
+ @Override
|
|
public K floorKey(@ParametricNullness K key) {
|
|
return forward().ceilingKey(key);
|
|
}
|
|
|
|
- @Override
|
|
@CheckForNull
|
|
+ @Override
|
|
public Entry<K, V> ceilingEntry(@ParametricNullness K key) {
|
|
return forward().floorEntry(key);
|
|
}
|
|
|
|
- @Override
|
|
@CheckForNull
|
|
+ @Override
|
|
public K ceilingKey(@ParametricNullness K key) {
|
|
return forward().floorKey(key);
|
|
}
|
|
|
|
- @Override
|
|
@CheckForNull
|
|
+ @Override
|
|
public Entry<K, V> higherEntry(@ParametricNullness K key) {
|
|
return forward().lowerEntry(key);
|
|
}
|
|
|
|
- @Override
|
|
@CheckForNull
|
|
+ @Override
|
|
public K higherKey(@ParametricNullness K key) {
|
|
return forward().lowerKey(key);
|
|
}
|
|
|
|
- @Override
|
|
@CheckForNull
|
|
+ @Override
|
|
public Entry<K, V> firstEntry() {
|
|
return forward().lastEntry();
|
|
}
|
|
|
|
- @Override
|
|
@CheckForNull
|
|
+ @Override
|
|
public Entry<K, V> lastEntry() {
|
|
return forward().firstEntry();
|
|
}
|
|
|
|
- @Override
|
|
@CheckForNull
|
|
+ @Override
|
|
public Entry<K, V> pollFirstEntry() {
|
|
return forward().pollLastEntry();
|
|
}
|
|
|
|
- @Override
|
|
@CheckForNull
|
|
+ @Override
|
|
public Entry<K, V> pollLastEntry() {
|
|
return forward().pollFirstEntry();
|
|
}
|
|
diff --git a/guava/src/com/google/common/collect/MinMaxPriorityQueue.java b/guava/src/com/google/common/collect/MinMaxPriorityQueue.java
|
|
index 181b3fbb50..4258f7d8d6 100644
|
|
--- a/guava/src/com/google/common/collect/MinMaxPriorityQueue.java
|
|
+++ b/guava/src/com/google/common/collect/MinMaxPriorityQueue.java
|
|
@@ -300,8 +300,8 @@ public final class MinMaxPriorityQueue<E> extends AbstractQueue<E> {
|
|
}
|
|
|
|
@CanIgnoreReturnValue
|
|
- @Override
|
|
@CheckForNull
|
|
+ @Override
|
|
public E poll() {
|
|
return isEmpty() ? null : removeAndGet(0);
|
|
}
|
|
@@ -315,8 +315,8 @@ public final class MinMaxPriorityQueue<E> extends AbstractQueue<E> {
|
|
return (E) requireNonNull(queue[index]);
|
|
}
|
|
|
|
- @Override
|
|
@CheckForNull
|
|
+ @Override
|
|
public E peek() {
|
|
return isEmpty() ? null : elementData(0);
|
|
}
|
|
@@ -409,9 +409,9 @@ public final class MinMaxPriorityQueue<E> extends AbstractQueue<E> {
|
|
* down to replace the element at {@code index}. This fact is used by iterator.remove so as to
|
|
* visit elements during a traversal once and only once.
|
|
*/
|
|
- @VisibleForTesting
|
|
@CanIgnoreReturnValue
|
|
@CheckForNull
|
|
+ @VisibleForTesting
|
|
MoveDesc<E> removeAt(int index) {
|
|
checkPositionIndex(index, size);
|
|
modCount++;
|
|
diff --git a/guava/src/com/google/common/collect/MultimapBuilder.java b/guava/src/com/google/common/collect/MultimapBuilder.java
|
|
index 3d6278aaec..6a6da896e4 100644
|
|
--- a/guava/src/com/google/common/collect/MultimapBuilder.java
|
|
+++ b/guava/src/com/google/common/collect/MultimapBuilder.java
|
|
@@ -172,8 +172,8 @@ public abstract class MultimapBuilder<K0 extends @Nullable Object, V0 extends @N
|
|
public static <K0 extends Enum<K0>> MultimapBuilderWithKeys<K0> enumKeys(Class<K0> keyClass) {
|
|
checkNotNull(keyClass);
|
|
return new MultimapBuilderWithKeys<K0>() {
|
|
- @SuppressWarnings("unchecked")
|
|
@Override
|
|
+ @SuppressWarnings("unchecked")
|
|
<K extends K0, V extends @Nullable Object> Map<K, Collection<V>> createMap() {
|
|
// K must actually be K0, since enums are effectively final
|
|
// (their subclasses are inaccessible)
|
|
@@ -395,7 +395,7 @@ public abstract class MultimapBuilder<K0 extends @Nullable Object, V0 extends @N
|
|
public <K extends K0, V extends V0> SetMultimap<K, V> build() {
|
|
// V must actually be V0, since enums are effectively final
|
|
// (their subclasses are inaccessible)
|
|
- @SuppressWarnings({"unchecked", "rawtypes"})
|
|
+ @SuppressWarnings({"rawtypes", "unchecked"})
|
|
Supplier<Set<V>> factory = (Supplier) new EnumSetSupplier<V0>(valueClass);
|
|
return Multimaps.newSetMultimap(MultimapBuilderWithKeys.this.<K, V>createMap(), factory);
|
|
}
|
|
diff --git a/guava/src/com/google/common/collect/Multimaps.java b/guava/src/com/google/common/collect/Multimaps.java
|
|
index 1c3f8cc4a6..18f2a65033 100644
|
|
--- a/guava/src/com/google/common/collect/Multimaps.java
|
|
+++ b/guava/src/com/google/common/collect/Multimaps.java
|
|
@@ -20,6 +20,11 @@ import static com.google.common.base.Preconditions.checkNotNull;
|
|
import static com.google.common.collect.CollectPreconditions.checkNonnegative;
|
|
import static com.google.common.collect.CollectPreconditions.checkRemove;
|
|
import static com.google.common.collect.NullnessCasts.uncheckedCastNullableTToT;
|
|
+import static java.util.Collections.unmodifiableCollection;
|
|
+import static java.util.Collections.unmodifiableList;
|
|
+import static java.util.Collections.unmodifiableMap;
|
|
+import static java.util.Collections.unmodifiableSet;
|
|
+import static java.util.Collections.unmodifiableSortedSet;
|
|
import static java.util.Objects.requireNonNull;
|
|
|
|
import com.google.common.annotations.Beta;
|
|
@@ -40,7 +45,6 @@ import java.io.ObjectOutputStream;
|
|
import java.io.Serializable;
|
|
import java.util.AbstractCollection;
|
|
import java.util.Collection;
|
|
-import java.util.Collections;
|
|
import java.util.Comparator;
|
|
import java.util.HashSet;
|
|
import java.util.Iterator;
|
|
@@ -242,13 +246,13 @@ public final class Multimaps {
|
|
if (collection instanceof NavigableSet) {
|
|
return Sets.unmodifiableNavigableSet((NavigableSet<E>) collection);
|
|
} else if (collection instanceof SortedSet) {
|
|
- return Collections.unmodifiableSortedSet((SortedSet<E>) collection);
|
|
+ return unmodifiableSortedSet((SortedSet<E>) collection);
|
|
} else if (collection instanceof Set) {
|
|
- return Collections.unmodifiableSet((Set<E>) collection);
|
|
+ return unmodifiableSet((Set<E>) collection);
|
|
} else if (collection instanceof List) {
|
|
- return Collections.unmodifiableList((List<E>) collection);
|
|
+ return unmodifiableList((List<E>) collection);
|
|
} else {
|
|
- return Collections.unmodifiableCollection(collection);
|
|
+ return unmodifiableCollection(collection);
|
|
}
|
|
}
|
|
|
|
@@ -441,9 +445,9 @@ public final class Multimaps {
|
|
if (collection instanceof NavigableSet) {
|
|
return Sets.unmodifiableNavigableSet((NavigableSet<E>) collection);
|
|
} else if (collection instanceof SortedSet) {
|
|
- return Collections.unmodifiableSortedSet((SortedSet<E>) collection);
|
|
+ return unmodifiableSortedSet((SortedSet<E>) collection);
|
|
} else {
|
|
- return Collections.unmodifiableSet((Set<E>) collection);
|
|
+ return unmodifiableSet((Set<E>) collection);
|
|
}
|
|
}
|
|
|
|
@@ -543,8 +547,8 @@ public final class Multimaps {
|
|
return factory.get();
|
|
}
|
|
|
|
- @Override
|
|
@CheckForNull
|
|
+ @Override
|
|
public Comparator<? super V> valueComparator() {
|
|
return valueComparator;
|
|
}
|
|
@@ -690,7 +694,7 @@ public final class Multimaps {
|
|
if (result == null) {
|
|
result =
|
|
map =
|
|
- Collections.unmodifiableMap(
|
|
+ unmodifiableMap(
|
|
Maps.transformValues(
|
|
delegate.asMap(),
|
|
new Function<Collection<V>, Collection<V>>() {
|
|
@@ -735,7 +739,7 @@ public final class Multimaps {
|
|
public Set<K> keySet() {
|
|
Set<K> result = keySet;
|
|
if (result == null) {
|
|
- keySet = result = Collections.unmodifiableSet(delegate.keySet());
|
|
+ keySet = result = unmodifiableSet(delegate.keySet());
|
|
}
|
|
return result;
|
|
}
|
|
@@ -774,7 +778,7 @@ public final class Multimaps {
|
|
public Collection<V> values() {
|
|
Collection<V> result = values;
|
|
if (result == null) {
|
|
- values = result = Collections.unmodifiableCollection(delegate.values());
|
|
+ values = result = unmodifiableCollection(delegate.values());
|
|
}
|
|
return result;
|
|
}
|
|
@@ -796,7 +800,7 @@ public final class Multimaps {
|
|
|
|
@Override
|
|
public List<V> get(@ParametricNullness K key) {
|
|
- return Collections.unmodifiableList(delegate().get(key));
|
|
+ return unmodifiableList(delegate().get(key));
|
|
}
|
|
|
|
@Override
|
|
@@ -830,7 +834,7 @@ public final class Multimaps {
|
|
* Note that this doesn't return a SortedSet when delegate is a
|
|
* SortedSetMultiset, unlike (SortedSet<V>) super.get().
|
|
*/
|
|
- return Collections.unmodifiableSet(delegate().get(key));
|
|
+ return unmodifiableSet(delegate().get(key));
|
|
}
|
|
|
|
@Override
|
|
@@ -865,7 +869,7 @@ public final class Multimaps {
|
|
|
|
@Override
|
|
public SortedSet<V> get(@ParametricNullness K key) {
|
|
- return Collections.unmodifiableSortedSet(delegate().get(key));
|
|
+ return unmodifiableSortedSet(delegate().get(key));
|
|
}
|
|
|
|
@Override
|
|
@@ -878,8 +882,8 @@ public final class Multimaps {
|
|
throw new UnsupportedOperationException();
|
|
}
|
|
|
|
- @Override
|
|
@CheckForNull
|
|
+ @Override
|
|
public Comparator<? super V> valueComparator() {
|
|
return delegate().valueComparator();
|
|
}
|
|
@@ -1023,13 +1027,13 @@ public final class Multimaps {
|
|
private static <V extends @Nullable Object> Collection<V> unmodifiableValueCollection(
|
|
Collection<V> collection) {
|
|
if (collection instanceof SortedSet) {
|
|
- return Collections.unmodifiableSortedSet((SortedSet<V>) collection);
|
|
+ return unmodifiableSortedSet((SortedSet<V>) collection);
|
|
} else if (collection instanceof Set) {
|
|
- return Collections.unmodifiableSet((Set<V>) collection);
|
|
+ return unmodifiableSet((Set<V>) collection);
|
|
} else if (collection instanceof List) {
|
|
- return Collections.unmodifiableList((List<V>) collection);
|
|
+ return unmodifiableList((List<V>) collection);
|
|
}
|
|
- return Collections.unmodifiableCollection(collection);
|
|
+ return unmodifiableCollection(collection);
|
|
}
|
|
|
|
/**
|
|
@@ -1045,7 +1049,7 @@ public final class Multimaps {
|
|
if (entries instanceof Set) {
|
|
return Maps.unmodifiableEntrySet((Set<Entry<K, V>>) entries);
|
|
}
|
|
- return new Maps.UnmodifiableEntries<>(Collections.unmodifiableCollection(entries));
|
|
+ return new Maps.UnmodifiableEntries<>(unmodifiableCollection(entries));
|
|
}
|
|
|
|
/**
|
|
@@ -1581,14 +1585,14 @@ public final class Multimaps {
|
|
throw new UnsupportedOperationException();
|
|
}
|
|
|
|
- @SuppressWarnings("unchecked")
|
|
@Override
|
|
+ @SuppressWarnings("unchecked")
|
|
public boolean remove(@CheckForNull Object key, @CheckForNull Object value) {
|
|
return get((K) key).remove(value);
|
|
}
|
|
|
|
- @SuppressWarnings("unchecked")
|
|
@Override
|
|
+ @SuppressWarnings("unchecked")
|
|
public Collection<V2> removeAll(@CheckForNull Object key) {
|
|
return transform((K) key, fromMultimap.removeAll(key));
|
|
}
|
|
@@ -1629,8 +1633,8 @@ public final class Multimaps {
|
|
return transform(key, fromMultimap.get(key));
|
|
}
|
|
|
|
- @SuppressWarnings("unchecked")
|
|
@Override
|
|
+ @SuppressWarnings("unchecked")
|
|
public List<V2> removeAll(@CheckForNull Object key) {
|
|
return transform((K) key, fromMultimap.removeAll(key));
|
|
}
|
|
@@ -1926,15 +1930,15 @@ public final class Multimaps {
|
|
}
|
|
}
|
|
|
|
- @SuppressWarnings("unchecked")
|
|
- @Override
|
|
@CheckForNull
|
|
+ @Override
|
|
+ @SuppressWarnings("unchecked")
|
|
public Collection<V> get(@CheckForNull Object key) {
|
|
return containsKey(key) ? multimap.get((K) key) : null;
|
|
}
|
|
|
|
- @Override
|
|
@CheckForNull
|
|
+ @Override
|
|
public Collection<V> remove(@CheckForNull Object key) {
|
|
return containsKey(key) ? multimap.removeAll(key) : null;
|
|
}
|
|
diff --git a/guava/src/com/google/common/collect/Multisets.java b/guava/src/com/google/common/collect/Multisets.java
|
|
index 71fe614347..6582569694 100644
|
|
--- a/guava/src/com/google/common/collect/Multisets.java
|
|
+++ b/guava/src/com/google/common/collect/Multisets.java
|
|
@@ -20,6 +20,7 @@ import static com.google.common.base.Preconditions.checkArgument;
|
|
import static com.google.common.base.Preconditions.checkNotNull;
|
|
import static com.google.common.collect.CollectPreconditions.checkNonnegative;
|
|
import static com.google.common.collect.CollectPreconditions.checkRemove;
|
|
+import static java.util.Collections.unmodifiableSet;
|
|
import static java.util.Objects.requireNonNull;
|
|
|
|
import com.google.common.annotations.Beta;
|
|
@@ -128,8 +129,8 @@ public final class Multisets {
|
|
this.delegate = delegate;
|
|
}
|
|
|
|
- @SuppressWarnings("unchecked")
|
|
@Override
|
|
+ @SuppressWarnings("unchecked")
|
|
protected Multiset<E> delegate() {
|
|
// This is safe because all non-covariant methods are overridden
|
|
return (Multiset<E>) delegate;
|
|
@@ -149,14 +150,14 @@ public final class Multisets {
|
|
|
|
@CheckForNull transient Set<Multiset.Entry<E>> entrySet;
|
|
|
|
- @SuppressWarnings("unchecked")
|
|
@Override
|
|
+ @SuppressWarnings("unchecked")
|
|
public Set<Multiset.Entry<E>> entrySet() {
|
|
Set<Multiset.Entry<E>> es = entrySet;
|
|
return (es == null)
|
|
// Safe because the returned set is made unmodifiable and Entry
|
|
// itself is readonly
|
|
- ? entrySet = (Set) Collections.unmodifiableSet(delegate.entrySet())
|
|
+ ? entrySet = (Set) unmodifiableSet(delegate.entrySet())
|
|
: es;
|
|
}
|
|
|
|
@@ -449,8 +450,8 @@ public final class Multisets {
|
|
final Iterator<? extends Entry<? extends E>> iterator2 = multiset2.entrySet().iterator();
|
|
// TODO(lowasser): consider making the entries live views
|
|
return new AbstractIterator<Entry<E>>() {
|
|
- @Override
|
|
@CheckForNull
|
|
+ @Override
|
|
protected Entry<E> computeNext() {
|
|
if (iterator1.hasNext()) {
|
|
Entry<? extends E> entry1 = iterator1.next();
|
|
@@ -511,8 +512,8 @@ public final class Multisets {
|
|
final Iterator<Entry<E>> iterator1 = multiset1.entrySet().iterator();
|
|
// TODO(lowasser): consider making the entries live views
|
|
return new AbstractIterator<Entry<E>>() {
|
|
- @Override
|
|
@CheckForNull
|
|
+ @Override
|
|
protected Entry<E> computeNext() {
|
|
while (iterator1.hasNext()) {
|
|
Entry<E> entry1 = iterator1.next();
|
|
@@ -584,8 +585,8 @@ public final class Multisets {
|
|
final Iterator<? extends Entry<? extends E>> iterator1 = multiset1.entrySet().iterator();
|
|
final Iterator<? extends Entry<? extends E>> iterator2 = multiset2.entrySet().iterator();
|
|
return new AbstractIterator<Entry<E>>() {
|
|
- @Override
|
|
@CheckForNull
|
|
+ @Override
|
|
protected Entry<E> computeNext() {
|
|
if (iterator1.hasNext()) {
|
|
Entry<? extends E> entry1 = iterator1.next();
|
|
@@ -642,8 +643,8 @@ public final class Multisets {
|
|
Iterator<E> elementIterator() {
|
|
final Iterator<Entry<E>> iterator1 = multiset1.entrySet().iterator();
|
|
return new AbstractIterator<E>() {
|
|
- @Override
|
|
@CheckForNull
|
|
+ @Override
|
|
protected E computeNext() {
|
|
while (iterator1.hasNext()) {
|
|
Entry<E> entry1 = iterator1.next();
|
|
@@ -661,8 +662,8 @@ public final class Multisets {
|
|
Iterator<Entry<E>> entryIterator() {
|
|
final Iterator<Entry<E>> iterator1 = multiset1.entrySet().iterator();
|
|
return new AbstractIterator<Entry<E>>() {
|
|
- @Override
|
|
@CheckForNull
|
|
+ @Override
|
|
protected Entry<E> computeNext() {
|
|
while (iterator1.hasNext()) {
|
|
Entry<E> entry1 = iterator1.next();
|
|
@@ -1045,8 +1046,8 @@ public final class Multisets {
|
|
}
|
|
|
|
// GWT compiler warning; see contains().
|
|
- @SuppressWarnings("cast")
|
|
@Override
|
|
+ @SuppressWarnings("cast")
|
|
public boolean remove(@CheckForNull Object object) {
|
|
if (object instanceof Multiset.Entry) {
|
|
Entry<?> entry = (Entry<?>) object;
|
|
@@ -1055,7 +1056,7 @@ public final class Multisets {
|
|
if (entryCount != 0) {
|
|
// Safe as long as we never add a new entry, which we won't.
|
|
// (Presumably it can still throw CCE/NPE but only if the underlying Multiset does.)
|
|
- @SuppressWarnings({"unchecked", "nullness"})
|
|
+ @SuppressWarnings({"nullness", "unchecked"})
|
|
Multiset<@Nullable Object> multiset = (Multiset<@Nullable Object>) multiset();
|
|
return multiset.setCount(element, entryCount, 0);
|
|
}
|
|
diff --git a/guava/src/com/google/common/collect/MutableClassToInstanceMap.java b/guava/src/com/google/common/collect/MutableClassToInstanceMap.java
|
|
index 83fbe94472..738e167551 100644
|
|
--- a/guava/src/com/google/common/collect/MutableClassToInstanceMap.java
|
|
+++ b/guava/src/com/google/common/collect/MutableClassToInstanceMap.java
|
|
@@ -144,9 +144,9 @@ public final class MutableClassToInstanceMap<B> extends ForwardingMap<Class<? ex
|
|
};
|
|
}
|
|
|
|
- @Override
|
|
@CanIgnoreReturnValue
|
|
@CheckForNull
|
|
+ @Override
|
|
public B put(Class<? extends B> key, B value) {
|
|
return super.put(key, cast(key, value));
|
|
}
|
|
@@ -161,14 +161,14 @@ public final class MutableClassToInstanceMap<B> extends ForwardingMap<Class<? ex
|
|
}
|
|
|
|
@CanIgnoreReturnValue
|
|
- @Override
|
|
@CheckForNull
|
|
+ @Override
|
|
public <T extends B> T putInstance(Class<T> type, T value) {
|
|
return cast(type, put(type, value));
|
|
}
|
|
|
|
- @Override
|
|
@CheckForNull
|
|
+ @Override
|
|
public <T extends B> T getInstance(Class<T> type) {
|
|
return cast(type, get(type));
|
|
}
|
|
diff --git a/guava/src/com/google/common/collect/NaturalOrdering.java b/guava/src/com/google/common/collect/NaturalOrdering.java
|
|
index 8cb8aef9a0..2789ab4567 100644
|
|
--- a/guava/src/com/google/common/collect/NaturalOrdering.java
|
|
+++ b/guava/src/com/google/common/collect/NaturalOrdering.java
|
|
@@ -25,7 +25,7 @@ import org.checkerframework.checker.nullness.qual.Nullable;
|
|
|
|
/** An ordering that uses the natural order of the values. */
|
|
@GwtCompatible(serializable = true)
|
|
-@SuppressWarnings({"unchecked", "rawtypes"}) // TODO(kevinb): the right way to explain this??
|
|
+@SuppressWarnings({"rawtypes", "unchecked"}) // TODO(kevinb): the right way to explain this??
|
|
@ElementTypesAreNonnullByDefault
|
|
final class NaturalOrdering extends Ordering<Comparable<?>> implements Serializable {
|
|
static final NaturalOrdering INSTANCE = new NaturalOrdering();
|
|
diff --git a/guava/src/com/google/common/collect/NullnessCasts.java b/guava/src/com/google/common/collect/NullnessCasts.java
|
|
index 4f894dbd31..a59d66c70c 100644
|
|
--- a/guava/src/com/google/common/collect/NullnessCasts.java
|
|
+++ b/guava/src/com/google/common/collect/NullnessCasts.java
|
|
@@ -57,9 +57,9 @@ final class NullnessCasts {
|
|
}
|
|
|
|
/** Returns {@code null} as any type, even one that does not include {@code null}. */
|
|
- @SuppressWarnings({"nullness", "TypeParameterUnusedInFormals", "ReturnMissingNullable"})
|
|
- // The warnings are legitimate. Each time we use this method, we document why.
|
|
@ParametricNullness
|
|
+ // The warnings are legitimate. Each time we use this method, we document why.
|
|
+ @SuppressWarnings({"nullness", "ReturnMissingNullable", "TypeParameterUnusedInFormals"})
|
|
static <T extends @Nullable Object> T unsafeNull() {
|
|
return null;
|
|
}
|
|
diff --git a/guava/src/com/google/common/collect/NullsFirstOrdering.java b/guava/src/com/google/common/collect/NullsFirstOrdering.java
|
|
index ce8be2fa3c..e6c69349ae 100644
|
|
--- a/guava/src/com/google/common/collect/NullsFirstOrdering.java
|
|
+++ b/guava/src/com/google/common/collect/NullsFirstOrdering.java
|
|
@@ -53,8 +53,8 @@ final class NullsFirstOrdering<T extends @Nullable Object> extends Ordering<@Nul
|
|
return ordering.reverse().nullsLast();
|
|
}
|
|
|
|
- @SuppressWarnings("unchecked") // still need the right way to explain this
|
|
- @Override
|
|
+ @Override // still need the right way to explain this
|
|
+ @SuppressWarnings("unchecked")
|
|
public <S extends T> Ordering<@Nullable S> nullsFirst() {
|
|
return (Ordering<@Nullable S>) this;
|
|
}
|
|
diff --git a/guava/src/com/google/common/collect/NullsLastOrdering.java b/guava/src/com/google/common/collect/NullsLastOrdering.java
|
|
index 6f8f74cdd6..6665d598d6 100644
|
|
--- a/guava/src/com/google/common/collect/NullsLastOrdering.java
|
|
+++ b/guava/src/com/google/common/collect/NullsLastOrdering.java
|
|
@@ -58,8 +58,8 @@ final class NullsLastOrdering<T extends @Nullable Object> extends Ordering<@Null
|
|
return ordering.<S>nullsFirst();
|
|
}
|
|
|
|
- @SuppressWarnings("unchecked") // still need the right way to explain this
|
|
- @Override
|
|
+ @Override // still need the right way to explain this
|
|
+ @SuppressWarnings("unchecked")
|
|
public <S extends T> Ordering<@Nullable S> nullsLast() {
|
|
return (Ordering<@Nullable S>) this;
|
|
}
|
|
diff --git a/guava/src/com/google/common/collect/Ordering.java b/guava/src/com/google/common/collect/Ordering.java
|
|
index 4f52e7b547..c8915b6bbb 100644
|
|
--- a/guava/src/com/google/common/collect/Ordering.java
|
|
+++ b/guava/src/com/google/common/collect/Ordering.java
|
|
@@ -18,6 +18,8 @@ package com.google.common.collect;
|
|
|
|
import static com.google.common.base.Preconditions.checkNotNull;
|
|
import static com.google.common.collect.CollectPreconditions.checkNonnegative;
|
|
+import static java.util.Collections.emptyList;
|
|
+import static java.util.Collections.unmodifiableList;
|
|
|
|
import com.google.common.annotations.GwtCompatible;
|
|
import com.google.common.annotations.VisibleForTesting;
|
|
@@ -191,8 +193,8 @@ public abstract class Ordering<T extends @Nullable Object> implements Comparator
|
|
*
|
|
* @deprecated no need to use this
|
|
*/
|
|
- @GwtCompatible(serializable = true)
|
|
@Deprecated
|
|
+ @GwtCompatible(serializable = true)
|
|
public static <T extends @Nullable Object> Ordering<T> from(Ordering<T> ordering) {
|
|
return checkNotNull(ordering);
|
|
}
|
|
@@ -746,7 +748,7 @@ public abstract class Ordering<T extends @Nullable Object> implements Comparator
|
|
if (array.length > k) {
|
|
array = Arrays.copyOf(array, k);
|
|
}
|
|
- return Collections.unmodifiableList(Arrays.asList(array));
|
|
+ return unmodifiableList(Arrays.asList(array));
|
|
}
|
|
}
|
|
return leastOf(iterable.iterator(), k);
|
|
@@ -773,7 +775,7 @@ public abstract class Ordering<T extends @Nullable Object> implements Comparator
|
|
checkNonnegative(k, "k");
|
|
|
|
if (k == 0 || !iterator.hasNext()) {
|
|
- return Collections.emptyList();
|
|
+ return emptyList();
|
|
} else if (k >= Integer.MAX_VALUE / 2) {
|
|
// k is really large; just do a straightforward sorted-copy-and-sublist
|
|
ArrayList<E> list = Lists.newArrayList(iterator);
|
|
@@ -782,7 +784,7 @@ public abstract class Ordering<T extends @Nullable Object> implements Comparator
|
|
list.subList(k, list.size()).clear();
|
|
}
|
|
list.trimToSize();
|
|
- return Collections.unmodifiableList(list);
|
|
+ return unmodifiableList(list);
|
|
} else {
|
|
TopKSelector<E> selector = TopKSelector.least(k, this);
|
|
selector.offerAll(iterator);
|
|
diff --git a/guava/src/com/google/common/collect/Queues.java b/guava/src/com/google/common/collect/Queues.java
|
|
index a140102fd6..7085a13a46 100644
|
|
--- a/guava/src/com/google/common/collect/Queues.java
|
|
+++ b/guava/src/com/google/common/collect/Queues.java
|
|
@@ -14,10 +14,11 @@
|
|
|
|
package com.google.common.collect;
|
|
|
|
+import static com.google.common.base.Preconditions.checkNotNull;
|
|
+
|
|
import com.google.common.annotations.Beta;
|
|
import com.google.common.annotations.GwtCompatible;
|
|
import com.google.common.annotations.GwtIncompatible;
|
|
-import com.google.common.base.Preconditions;
|
|
import com.google.errorprone.annotations.CanIgnoreReturnValue;
|
|
import java.util.ArrayDeque;
|
|
import java.util.Collection;
|
|
@@ -303,7 +304,7 @@ public final class Queues {
|
|
long timeout,
|
|
TimeUnit unit)
|
|
throws InterruptedException {
|
|
- Preconditions.checkNotNull(buffer);
|
|
+ checkNotNull(buffer);
|
|
/*
|
|
* This code performs one System.nanoTime() more than necessary, and in return, the time to
|
|
* execute Queue#drainTo is not added *on top* of waiting for the timeout (which could make
|
|
@@ -375,7 +376,7 @@ public final class Queues {
|
|
int numElements,
|
|
long timeout,
|
|
TimeUnit unit) {
|
|
- Preconditions.checkNotNull(buffer);
|
|
+ checkNotNull(buffer);
|
|
long deadline = System.nanoTime() + unit.toNanos(timeout);
|
|
int added = 0;
|
|
boolean interrupted = false;
|
|
diff --git a/guava/src/com/google/common/collect/RegularContiguousSet.java b/guava/src/com/google/common/collect/RegularContiguousSet.java
|
|
index 787606eb1f..eb73336368 100644
|
|
--- a/guava/src/com/google/common/collect/RegularContiguousSet.java
|
|
+++ b/guava/src/com/google/common/collect/RegularContiguousSet.java
|
|
@@ -83,8 +83,8 @@ final class RegularContiguousSet<C extends Comparable> extends ContiguousSet<C>
|
|
return new AbstractSequentialIterator<C>(first()) {
|
|
final C last = last();
|
|
|
|
- @Override
|
|
@CheckForNull
|
|
+ @Override
|
|
protected C computeNext(C previous) {
|
|
return equalsOrThrow(previous, last) ? null : domain.next(previous);
|
|
}
|
|
@@ -97,8 +97,8 @@ final class RegularContiguousSet<C extends Comparable> extends ContiguousSet<C>
|
|
return new AbstractSequentialIterator<C>(last()) {
|
|
final C first = first();
|
|
|
|
- @Override
|
|
@CheckForNull
|
|
+ @Override
|
|
protected C computeNext(C previous) {
|
|
return equalsOrThrow(previous, first) ? null : domain.previous(previous);
|
|
}
|
|
diff --git a/guava/src/com/google/common/collect/RegularImmutableAsList.java b/guava/src/com/google/common/collect/RegularImmutableAsList.java
|
|
index 0e3fe4ec8f..ab376bae7a 100644
|
|
--- a/guava/src/com/google/common/collect/RegularImmutableAsList.java
|
|
+++ b/guava/src/com/google/common/collect/RegularImmutableAsList.java
|
|
@@ -53,8 +53,8 @@ class RegularImmutableAsList<E> extends ImmutableAsList<E> {
|
|
return delegateList;
|
|
}
|
|
|
|
- @SuppressWarnings("unchecked") // safe covariant cast!
|
|
- @Override
|
|
+ @Override // safe covariant cast!
|
|
+ @SuppressWarnings("unchecked")
|
|
public UnmodifiableListIterator<E> listIterator(int index) {
|
|
return (UnmodifiableListIterator<E>) delegateList.listIterator(index);
|
|
}
|
|
@@ -71,8 +71,8 @@ class RegularImmutableAsList<E> extends ImmutableAsList<E> {
|
|
return delegateList.copyIntoArray(dst, offset);
|
|
}
|
|
|
|
- @Override
|
|
@CheckForNull
|
|
+ @Override
|
|
Object[] internalArray() {
|
|
return delegateList.internalArray();
|
|
}
|
|
diff --git a/guava/src/com/google/common/collect/RegularImmutableBiMap.java b/guava/src/com/google/common/collect/RegularImmutableBiMap.java
|
|
index b8bca95804..55256d309c 100644
|
|
--- a/guava/src/com/google/common/collect/RegularImmutableBiMap.java
|
|
+++ b/guava/src/com/google/common/collect/RegularImmutableBiMap.java
|
|
@@ -141,8 +141,8 @@ class RegularImmutableBiMap<K, V> extends ImmutableBiMap<K, V> {
|
|
}
|
|
}
|
|
|
|
- @Override
|
|
@CheckForNull
|
|
+ @Override
|
|
public V get(@CheckForNull Object key) {
|
|
return RegularImmutableMap.get(key, keyTable, mask);
|
|
}
|
|
@@ -216,8 +216,8 @@ class RegularImmutableBiMap<K, V> extends ImmutableBiMap<K, V> {
|
|
RegularImmutableBiMap.this.forEach((k, v) -> action.accept(v, k));
|
|
}
|
|
|
|
- @Override
|
|
@CheckForNull
|
|
+ @Override
|
|
public K get(@CheckForNull Object value) {
|
|
if (value == null || valueTable == null) {
|
|
return null;
|
|
diff --git a/guava/src/com/google/common/collect/RegularImmutableList.java b/guava/src/com/google/common/collect/RegularImmutableList.java
|
|
index 397147d70d..8c54eb983b 100644
|
|
--- a/guava/src/com/google/common/collect/RegularImmutableList.java
|
|
+++ b/guava/src/com/google/common/collect/RegularImmutableList.java
|
|
@@ -77,8 +77,8 @@ class RegularImmutableList<E> extends ImmutableList<E> {
|
|
return (E) array[index];
|
|
}
|
|
|
|
- @SuppressWarnings("unchecked")
|
|
@Override
|
|
+ @SuppressWarnings("unchecked")
|
|
public UnmodifiableListIterator<E> listIterator(int index) {
|
|
// for performance
|
|
// The fake cast to E is safe because the creation methods only allow E's
|
|
diff --git a/guava/src/com/google/common/collect/RegularImmutableMap.java b/guava/src/com/google/common/collect/RegularImmutableMap.java
|
|
index f0f2031b94..0297cefdc1 100644
|
|
--- a/guava/src/com/google/common/collect/RegularImmutableMap.java
|
|
+++ b/guava/src/com/google/common/collect/RegularImmutableMap.java
|
|
@@ -252,8 +252,8 @@ final class RegularImmutableMap<K, V> extends ImmutableMap<K, V> {
|
|
|
|
static class BucketOverflowException extends Exception {}
|
|
|
|
- @Override
|
|
@CheckForNull
|
|
+ @Override
|
|
public V get(@CheckForNull Object key) {
|
|
return get(key, table, mask);
|
|
}
|
|
diff --git a/guava/src/com/google/common/collect/RegularImmutableMultiset.java b/guava/src/com/google/common/collect/RegularImmutableMultiset.java
|
|
index 47dffa1772..da0f88e747 100644
|
|
--- a/guava/src/com/google/common/collect/RegularImmutableMultiset.java
|
|
+++ b/guava/src/com/google/common/collect/RegularImmutableMultiset.java
|
|
@@ -42,14 +42,14 @@ class RegularImmutableMultiset<E> extends ImmutableMultiset<E> {
|
|
|
|
static <E> ImmutableMultiset<E> create(Collection<? extends Entry<? extends E>> entries) {
|
|
int distinct = entries.size();
|
|
- @SuppressWarnings({"unchecked", "rawtypes"})
|
|
+ @SuppressWarnings({"rawtypes", "unchecked"})
|
|
ImmutableEntry<E>[] entryArray = new ImmutableEntry[distinct];
|
|
if (distinct == 0) {
|
|
return new RegularImmutableMultiset<>(entryArray, EMPTY_ARRAY, 0, 0, ImmutableSet.of());
|
|
}
|
|
int tableSize = Hashing.closedTableSize(distinct, MAX_LOAD_FACTOR);
|
|
int mask = tableSize - 1;
|
|
- @SuppressWarnings({"unchecked", "rawtypes"})
|
|
+ @SuppressWarnings({"rawtypes", "unchecked"})
|
|
@Nullable ImmutableEntry<E>[] hashTable = new @Nullable ImmutableEntry[tableSize];
|
|
|
|
int index = 0;
|
|
diff --git a/guava/src/com/google/common/collect/RegularImmutableSortedMultiset.java b/guava/src/com/google/common/collect/RegularImmutableSortedMultiset.java
|
|
index 4b7ba87427..2e29d395e8 100644
|
|
--- a/guava/src/com/google/common/collect/RegularImmutableSortedMultiset.java
|
|
+++ b/guava/src/com/google/common/collect/RegularImmutableSortedMultiset.java
|
|
@@ -76,14 +76,14 @@ final class RegularImmutableSortedMultiset<E> extends ImmutableSortedMultiset<E>
|
|
}
|
|
}
|
|
|
|
- @Override
|
|
@CheckForNull
|
|
+ @Override
|
|
public Entry<E> firstEntry() {
|
|
return isEmpty() ? null : getEntry(0);
|
|
}
|
|
|
|
- @Override
|
|
@CheckForNull
|
|
+ @Override
|
|
public Entry<E> lastEntry() {
|
|
return isEmpty() ? null : getEntry(length - 1);
|
|
}
|
|
diff --git a/guava/src/com/google/common/collect/RegularImmutableSortedSet.java b/guava/src/com/google/common/collect/RegularImmutableSortedSet.java
|
|
index fa17e67916..752b7c8ddd 100644
|
|
--- a/guava/src/com/google/common/collect/RegularImmutableSortedSet.java
|
|
+++ b/guava/src/com/google/common/collect/RegularImmutableSortedSet.java
|
|
@@ -17,6 +17,7 @@
|
|
package com.google.common.collect;
|
|
|
|
import static com.google.common.base.Preconditions.checkNotNull;
|
|
+import static java.util.Collections.binarySearch;
|
|
|
|
import com.google.common.annotations.GwtCompatible;
|
|
import com.google.common.annotations.GwtIncompatible;
|
|
@@ -39,7 +40,7 @@ import org.checkerframework.checker.nullness.qual.Nullable;
|
|
* @author Louis Wasserman
|
|
*/
|
|
@GwtCompatible(serializable = true, emulated = true)
|
|
-@SuppressWarnings({"serial", "rawtypes"})
|
|
+@SuppressWarnings({"rawtypes", "serial"})
|
|
@ElementTypesAreNonnullByDefault
|
|
final class RegularImmutableSortedSet<E> extends ImmutableSortedSet<E> {
|
|
static final RegularImmutableSortedSet<Comparable> NATURAL_EMPTY_SET =
|
|
@@ -52,8 +53,8 @@ final class RegularImmutableSortedSet<E> extends ImmutableSortedSet<E> {
|
|
this.elements = elements;
|
|
}
|
|
|
|
- @Override
|
|
@CheckForNull
|
|
+ @Override
|
|
Object[] internalArray() {
|
|
return elements.internalArray();
|
|
}
|
|
@@ -156,7 +157,7 @@ final class RegularImmutableSortedSet<E> extends ImmutableSortedSet<E> {
|
|
}
|
|
|
|
private int unsafeBinarySearch(Object key) throws ClassCastException {
|
|
- return Collections.binarySearch(elements, key, unsafeComparator());
|
|
+ return binarySearch(elements, key, unsafeComparator());
|
|
}
|
|
|
|
@Override
|
|
@@ -222,29 +223,29 @@ final class RegularImmutableSortedSet<E> extends ImmutableSortedSet<E> {
|
|
return elements.get(size() - 1);
|
|
}
|
|
|
|
- @Override
|
|
@CheckForNull
|
|
+ @Override
|
|
public E lower(E element) {
|
|
int index = headIndex(element, false) - 1;
|
|
return (index == -1) ? null : elements.get(index);
|
|
}
|
|
|
|
- @Override
|
|
@CheckForNull
|
|
+ @Override
|
|
public E floor(E element) {
|
|
int index = headIndex(element, true) - 1;
|
|
return (index == -1) ? null : elements.get(index);
|
|
}
|
|
|
|
- @Override
|
|
@CheckForNull
|
|
+ @Override
|
|
public E ceiling(E element) {
|
|
int index = tailIndex(element, true);
|
|
return (index == size()) ? null : elements.get(index);
|
|
}
|
|
|
|
- @Override
|
|
@CheckForNull
|
|
+ @Override
|
|
public E higher(E element) {
|
|
int index = tailIndex(element, false);
|
|
return (index == size()) ? null : elements.get(index);
|
|
@@ -256,7 +257,7 @@ final class RegularImmutableSortedSet<E> extends ImmutableSortedSet<E> {
|
|
}
|
|
|
|
int headIndex(E toElement, boolean inclusive) {
|
|
- int index = Collections.binarySearch(elements, checkNotNull(toElement), comparator());
|
|
+ int index = binarySearch(elements, checkNotNull(toElement), comparator());
|
|
if (index >= 0) {
|
|
return inclusive ? index + 1 : index;
|
|
} else {
|
|
@@ -276,7 +277,7 @@ final class RegularImmutableSortedSet<E> extends ImmutableSortedSet<E> {
|
|
}
|
|
|
|
int tailIndex(E fromElement, boolean inclusive) {
|
|
- int index = Collections.binarySearch(elements, checkNotNull(fromElement), comparator());
|
|
+ int index = binarySearch(elements, checkNotNull(fromElement), comparator());
|
|
if (index >= 0) {
|
|
return inclusive ? index : index + 1;
|
|
} else {
|
|
@@ -310,7 +311,7 @@ final class RegularImmutableSortedSet<E> extends ImmutableSortedSet<E> {
|
|
}
|
|
int position;
|
|
try {
|
|
- position = Collections.binarySearch(elements, target, unsafeComparator());
|
|
+ position = binarySearch(elements, target, unsafeComparator());
|
|
} catch (ClassCastException e) {
|
|
return -1;
|
|
}
|
|
diff --git a/guava/src/com/google/common/collect/ReverseNaturalOrdering.java b/guava/src/com/google/common/collect/ReverseNaturalOrdering.java
|
|
index f0c40cb612..66d5dc8c4f 100644
|
|
--- a/guava/src/com/google/common/collect/ReverseNaturalOrdering.java
|
|
+++ b/guava/src/com/google/common/collect/ReverseNaturalOrdering.java
|
|
@@ -24,7 +24,7 @@ import java.util.Iterator;
|
|
|
|
/** An ordering that uses the reverse of the natural order of the values. */
|
|
@GwtCompatible(serializable = true)
|
|
-@SuppressWarnings({"unchecked", "rawtypes"}) // TODO(kevinb): the right way to explain this??
|
|
+@SuppressWarnings({"rawtypes", "unchecked"}) // TODO(kevinb): the right way to explain this??
|
|
@ElementTypesAreNonnullByDefault
|
|
final class ReverseNaturalOrdering extends Ordering<Comparable<?>> implements Serializable {
|
|
static final ReverseNaturalOrdering INSTANCE = new ReverseNaturalOrdering();
|
|
diff --git a/guava/src/com/google/common/collect/ReverseOrdering.java b/guava/src/com/google/common/collect/ReverseOrdering.java
|
|
index 6c1e74dd73..07505bbd9e 100644
|
|
--- a/guava/src/com/google/common/collect/ReverseOrdering.java
|
|
+++ b/guava/src/com/google/common/collect/ReverseOrdering.java
|
|
@@ -40,8 +40,8 @@ final class ReverseOrdering<T extends @Nullable Object> extends Ordering<T>
|
|
return forwardOrder.compare(b, a);
|
|
}
|
|
|
|
- @SuppressWarnings("unchecked") // how to explain?
|
|
- @Override
|
|
+ @Override // how to explain?
|
|
+ @SuppressWarnings("unchecked")
|
|
public <S extends T> Ordering<S> reverse() {
|
|
return (Ordering<S>) forwardOrder;
|
|
}
|
|
diff --git a/guava/src/com/google/common/collect/Sets.java b/guava/src/com/google/common/collect/Sets.java
|
|
index abb6558910..1d600e684a 100644
|
|
--- a/guava/src/com/google/common/collect/Sets.java
|
|
+++ b/guava/src/com/google/common/collect/Sets.java
|
|
@@ -19,6 +19,8 @@ package com.google.common.collect;
|
|
import static com.google.common.base.Preconditions.checkArgument;
|
|
import static com.google.common.base.Preconditions.checkNotNull;
|
|
import static com.google.common.collect.CollectPreconditions.checkNonnegative;
|
|
+import static java.util.Collections.disjoint;
|
|
+import static java.util.Collections.unmodifiableSortedSet;
|
|
|
|
import com.google.common.annotations.Beta;
|
|
import com.google.common.annotations.GwtCompatible;
|
|
@@ -593,8 +595,8 @@ public final class Sets {
|
|
*/
|
|
@CanIgnoreReturnValue
|
|
@Deprecated
|
|
- @Override
|
|
@DoNotCall("Always throws UnsupportedOperationException")
|
|
+ @Override
|
|
public final boolean add(@ParametricNullness E e) {
|
|
throw new UnsupportedOperationException();
|
|
}
|
|
@@ -607,8 +609,8 @@ public final class Sets {
|
|
*/
|
|
@CanIgnoreReturnValue
|
|
@Deprecated
|
|
- @Override
|
|
@DoNotCall("Always throws UnsupportedOperationException")
|
|
+ @Override
|
|
public final boolean remove(@CheckForNull Object object) {
|
|
throw new UnsupportedOperationException();
|
|
}
|
|
@@ -621,8 +623,8 @@ public final class Sets {
|
|
*/
|
|
@CanIgnoreReturnValue
|
|
@Deprecated
|
|
- @Override
|
|
@DoNotCall("Always throws UnsupportedOperationException")
|
|
+ @Override
|
|
public final boolean addAll(Collection<? extends E> newElements) {
|
|
throw new UnsupportedOperationException();
|
|
}
|
|
@@ -635,8 +637,8 @@ public final class Sets {
|
|
*/
|
|
@CanIgnoreReturnValue
|
|
@Deprecated
|
|
- @Override
|
|
@DoNotCall("Always throws UnsupportedOperationException")
|
|
+ @Override
|
|
public final boolean removeAll(Collection<?> oldElements) {
|
|
throw new UnsupportedOperationException();
|
|
}
|
|
@@ -649,8 +651,8 @@ public final class Sets {
|
|
*/
|
|
@CanIgnoreReturnValue
|
|
@Deprecated
|
|
- @Override
|
|
@DoNotCall("Always throws UnsupportedOperationException")
|
|
+ @Override
|
|
public final boolean removeIf(java.util.function.Predicate<? super E> filter) {
|
|
throw new UnsupportedOperationException();
|
|
}
|
|
@@ -663,8 +665,8 @@ public final class Sets {
|
|
*/
|
|
@CanIgnoreReturnValue
|
|
@Deprecated
|
|
- @Override
|
|
@DoNotCall("Always throws UnsupportedOperationException")
|
|
+ @Override
|
|
public final boolean retainAll(Collection<?> elementsToKeep) {
|
|
throw new UnsupportedOperationException();
|
|
}
|
|
@@ -676,8 +678,8 @@ public final class Sets {
|
|
* @deprecated Unsupported operation.
|
|
*/
|
|
@Deprecated
|
|
- @Override
|
|
@DoNotCall("Always throws UnsupportedOperationException")
|
|
+ @Override
|
|
public final void clear() {
|
|
throw new UnsupportedOperationException();
|
|
}
|
|
@@ -729,8 +731,8 @@ public final class Sets {
|
|
final Iterator<? extends E> itr1 = set1.iterator();
|
|
final Iterator<? extends E> itr2 = set2.iterator();
|
|
|
|
- @Override
|
|
@CheckForNull
|
|
+ @Override
|
|
protected E computeNext() {
|
|
if (itr1.hasNext()) {
|
|
return itr1.next();
|
|
@@ -814,8 +816,8 @@ public final class Sets {
|
|
return new AbstractIterator<E>() {
|
|
final Iterator<E> itr = set1.iterator();
|
|
|
|
- @Override
|
|
@CheckForNull
|
|
+ @Override
|
|
protected E computeNext() {
|
|
while (itr.hasNext()) {
|
|
E e = itr.next();
|
|
@@ -851,7 +853,7 @@ public final class Sets {
|
|
|
|
@Override
|
|
public boolean isEmpty() {
|
|
- return Collections.disjoint(set2, set1);
|
|
+ return disjoint(set2, set1);
|
|
}
|
|
|
|
@Override
|
|
@@ -887,8 +889,8 @@ public final class Sets {
|
|
return new AbstractIterator<E>() {
|
|
final Iterator<E> itr = set1.iterator();
|
|
|
|
- @Override
|
|
@CheckForNull
|
|
+ @Override
|
|
protected E computeNext() {
|
|
while (itr.hasNext()) {
|
|
E e = itr.next();
|
|
@@ -956,8 +958,8 @@ public final class Sets {
|
|
final Iterator<? extends E> itr1 = set1.iterator();
|
|
final Iterator<? extends E> itr2 = set2.iterator();
|
|
return new AbstractIterator<E>() {
|
|
- @Override
|
|
@CheckForNull
|
|
+ @Override
|
|
public E computeNext() {
|
|
while (itr1.hasNext()) {
|
|
E elem1 = itr1.next();
|
|
@@ -1147,8 +1149,8 @@ public final class Sets {
|
|
super(unfiltered, predicate);
|
|
}
|
|
|
|
- @Override
|
|
@CheckForNull
|
|
+ @Override
|
|
public Comparator<? super E> comparator() {
|
|
return ((SortedSet<E>) unfiltered).comparator();
|
|
}
|
|
@@ -1200,38 +1202,38 @@ public final class Sets {
|
|
return (NavigableSet<E>) unfiltered;
|
|
}
|
|
|
|
- @Override
|
|
@CheckForNull
|
|
+ @Override
|
|
public E lower(@ParametricNullness E e) {
|
|
return Iterators.find(unfiltered().headSet(e, false).descendingIterator(), predicate, null);
|
|
}
|
|
|
|
- @Override
|
|
@CheckForNull
|
|
+ @Override
|
|
public E floor(@ParametricNullness E e) {
|
|
return Iterators.find(unfiltered().headSet(e, true).descendingIterator(), predicate, null);
|
|
}
|
|
|
|
- @Override
|
|
@CheckForNull
|
|
+ @Override
|
|
public E ceiling(@ParametricNullness E e) {
|
|
return Iterables.find(unfiltered().tailSet(e, true), predicate, null);
|
|
}
|
|
|
|
- @Override
|
|
@CheckForNull
|
|
+ @Override
|
|
public E higher(@ParametricNullness E e) {
|
|
return Iterables.find(unfiltered().tailSet(e, false), predicate, null);
|
|
}
|
|
|
|
- @Override
|
|
@CheckForNull
|
|
+ @Override
|
|
public E pollFirst() {
|
|
return Iterables.removeFirstMatching(unfiltered(), predicate);
|
|
}
|
|
|
|
- @Override
|
|
@CheckForNull
|
|
+ @Override
|
|
public E pollLast() {
|
|
return Iterables.removeFirstMatching(unfiltered().descendingSet(), predicate);
|
|
}
|
|
@@ -1671,8 +1673,8 @@ public final class Sets {
|
|
return new AbstractIterator<Set<E>>() {
|
|
final BitSet bits = new BitSet(index.size());
|
|
|
|
- @Override
|
|
@CheckForNull
|
|
+ @Override
|
|
protected Set<E> computeNext() {
|
|
if (bits.isEmpty()) {
|
|
bits.set(0, size);
|
|
@@ -1714,8 +1716,8 @@ public final class Sets {
|
|
return new AbstractIterator<E>() {
|
|
int i = -1;
|
|
|
|
- @Override
|
|
@CheckForNull
|
|
+ @Override
|
|
protected E computeNext() {
|
|
i = copy.nextSetBit(i + 1);
|
|
if (i == -1) {
|
|
@@ -1804,7 +1806,7 @@ public final class Sets {
|
|
|
|
UnmodifiableNavigableSet(NavigableSet<E> delegate) {
|
|
this.delegate = checkNotNull(delegate);
|
|
- this.unmodifiableDelegate = Collections.unmodifiableSortedSet(delegate);
|
|
+ this.unmodifiableDelegate = unmodifiableSortedSet(delegate);
|
|
}
|
|
|
|
@Override
|
|
@@ -1834,38 +1836,38 @@ public final class Sets {
|
|
delegate.forEach(action);
|
|
}
|
|
|
|
- @Override
|
|
@CheckForNull
|
|
+ @Override
|
|
public E lower(@ParametricNullness E e) {
|
|
return delegate.lower(e);
|
|
}
|
|
|
|
- @Override
|
|
@CheckForNull
|
|
+ @Override
|
|
public E floor(@ParametricNullness E e) {
|
|
return delegate.floor(e);
|
|
}
|
|
|
|
- @Override
|
|
@CheckForNull
|
|
+ @Override
|
|
public E ceiling(@ParametricNullness E e) {
|
|
return delegate.ceiling(e);
|
|
}
|
|
|
|
- @Override
|
|
@CheckForNull
|
|
+ @Override
|
|
public E higher(@ParametricNullness E e) {
|
|
return delegate.higher(e);
|
|
}
|
|
|
|
- @Override
|
|
@CheckForNull
|
|
+ @Override
|
|
public E pollFirst() {
|
|
throw new UnsupportedOperationException();
|
|
}
|
|
|
|
- @Override
|
|
@CheckForNull
|
|
+ @Override
|
|
public E pollLast() {
|
|
throw new UnsupportedOperationException();
|
|
}
|
|
@@ -2002,38 +2004,38 @@ public final class Sets {
|
|
return forward;
|
|
}
|
|
|
|
- @Override
|
|
@CheckForNull
|
|
+ @Override
|
|
public E lower(@ParametricNullness E e) {
|
|
return forward.higher(e);
|
|
}
|
|
|
|
- @Override
|
|
@CheckForNull
|
|
+ @Override
|
|
public E floor(@ParametricNullness E e) {
|
|
return forward.ceiling(e);
|
|
}
|
|
|
|
- @Override
|
|
@CheckForNull
|
|
+ @Override
|
|
public E ceiling(@ParametricNullness E e) {
|
|
return forward.floor(e);
|
|
}
|
|
|
|
- @Override
|
|
@CheckForNull
|
|
+ @Override
|
|
public E higher(@ParametricNullness E e) {
|
|
return forward.lower(e);
|
|
}
|
|
|
|
- @Override
|
|
@CheckForNull
|
|
+ @Override
|
|
public E pollFirst() {
|
|
return forward.pollLast();
|
|
}
|
|
|
|
- @Override
|
|
@CheckForNull
|
|
+ @Override
|
|
public E pollLast() {
|
|
return forward.pollFirst();
|
|
}
|
|
@@ -2082,8 +2084,8 @@ public final class Sets {
|
|
return standardTailSet(fromElement);
|
|
}
|
|
|
|
- @SuppressWarnings("unchecked")
|
|
@Override
|
|
+ @SuppressWarnings("unchecked")
|
|
public Comparator<? super E> comparator() {
|
|
Comparator<? super E> forwardComparator = forward.comparator();
|
|
if (forwardComparator == null) {
|
|
diff --git a/guava/src/com/google/common/collect/SingletonImmutableBiMap.java b/guava/src/com/google/common/collect/SingletonImmutableBiMap.java
|
|
index c5fb2b2989..b3f9af784c 100644
|
|
--- a/guava/src/com/google/common/collect/SingletonImmutableBiMap.java
|
|
+++ b/guava/src/com/google/common/collect/SingletonImmutableBiMap.java
|
|
@@ -52,8 +52,8 @@ final class SingletonImmutableBiMap<K, V> extends ImmutableBiMap<K, V> {
|
|
this.inverse = inverse;
|
|
}
|
|
|
|
- @Override
|
|
@CheckForNull
|
|
+ @Override
|
|
public V get(@CheckForNull Object key) {
|
|
return singleKey.equals(key) ? singleValue : null;
|
|
}
|
|
diff --git a/guava/src/com/google/common/collect/SingletonImmutableList.java b/guava/src/com/google/common/collect/SingletonImmutableList.java
|
|
index a7ac8b30e2..29f6da2c46 100644
|
|
--- a/guava/src/com/google/common/collect/SingletonImmutableList.java
|
|
+++ b/guava/src/com/google/common/collect/SingletonImmutableList.java
|
|
@@ -16,11 +16,12 @@
|
|
|
|
package com.google.common.collect;
|
|
|
|
+import static com.google.common.base.Preconditions.checkElementIndex;
|
|
import static com.google.common.base.Preconditions.checkNotNull;
|
|
+import static com.google.common.base.Preconditions.checkPositionIndexes;
|
|
+import static java.util.Collections.singleton;
|
|
|
|
import com.google.common.annotations.GwtCompatible;
|
|
-import com.google.common.base.Preconditions;
|
|
-import java.util.Collections;
|
|
import java.util.Spliterator;
|
|
|
|
/**
|
|
@@ -41,7 +42,7 @@ final class SingletonImmutableList<E> extends ImmutableList<E> {
|
|
|
|
@Override
|
|
public E get(int index) {
|
|
- Preconditions.checkElementIndex(index, 1);
|
|
+ checkElementIndex(index, 1);
|
|
return element;
|
|
}
|
|
|
|
@@ -52,7 +53,7 @@ final class SingletonImmutableList<E> extends ImmutableList<E> {
|
|
|
|
@Override
|
|
public Spliterator<E> spliterator() {
|
|
- return Collections.singleton(element).spliterator();
|
|
+ return singleton(element).spliterator();
|
|
}
|
|
|
|
@Override
|
|
@@ -62,7 +63,7 @@ final class SingletonImmutableList<E> extends ImmutableList<E> {
|
|
|
|
@Override
|
|
public ImmutableList<E> subList(int fromIndex, int toIndex) {
|
|
- Preconditions.checkPositionIndexes(fromIndex, toIndex, 1);
|
|
+ checkPositionIndexes(fromIndex, toIndex, 1);
|
|
return (fromIndex == toIndex) ? ImmutableList.<E>of() : this;
|
|
}
|
|
|
|
diff --git a/guava/src/com/google/common/collect/SingletonImmutableSet.java b/guava/src/com/google/common/collect/SingletonImmutableSet.java
|
|
index 088cb802f2..c9b05a0430 100644
|
|
--- a/guava/src/com/google/common/collect/SingletonImmutableSet.java
|
|
+++ b/guava/src/com/google/common/collect/SingletonImmutableSet.java
|
|
@@ -16,8 +16,9 @@
|
|
|
|
package com.google.common.collect;
|
|
|
|
+import static com.google.common.base.Preconditions.checkNotNull;
|
|
+
|
|
import com.google.common.annotations.GwtCompatible;
|
|
-import com.google.common.base.Preconditions;
|
|
import javax.annotation.CheckForNull;
|
|
import org.checkerframework.checker.nullness.qual.Nullable;
|
|
|
|
@@ -37,7 +38,7 @@ final class SingletonImmutableSet<E> extends ImmutableSet<E> {
|
|
final transient E element;
|
|
|
|
SingletonImmutableSet(E element) {
|
|
- this.element = Preconditions.checkNotNull(element);
|
|
+ this.element = checkNotNull(element);
|
|
}
|
|
|
|
@Override
|
|
diff --git a/guava/src/com/google/common/collect/SortedMultisets.java b/guava/src/com/google/common/collect/SortedMultisets.java
|
|
index f602a42a11..20ea66a033 100644
|
|
--- a/guava/src/com/google/common/collect/SortedMultisets.java
|
|
+++ b/guava/src/com/google/common/collect/SortedMultisets.java
|
|
@@ -102,26 +102,26 @@ final class SortedMultisets {
|
|
super(multiset);
|
|
}
|
|
|
|
- @Override
|
|
@CheckForNull
|
|
+ @Override
|
|
public E lower(@ParametricNullness E e) {
|
|
return getElementOrNull(multiset().headMultiset(e, OPEN).lastEntry());
|
|
}
|
|
|
|
- @Override
|
|
@CheckForNull
|
|
+ @Override
|
|
public E floor(@ParametricNullness E e) {
|
|
return getElementOrNull(multiset().headMultiset(e, CLOSED).lastEntry());
|
|
}
|
|
|
|
- @Override
|
|
@CheckForNull
|
|
+ @Override
|
|
public E ceiling(@ParametricNullness E e) {
|
|
return getElementOrNull(multiset().tailMultiset(e, CLOSED).firstEntry());
|
|
}
|
|
|
|
- @Override
|
|
@CheckForNull
|
|
+ @Override
|
|
public E higher(@ParametricNullness E e) {
|
|
return getElementOrNull(multiset().tailMultiset(e, OPEN).firstEntry());
|
|
}
|
|
@@ -136,14 +136,14 @@ final class SortedMultisets {
|
|
return descendingSet().iterator();
|
|
}
|
|
|
|
- @Override
|
|
@CheckForNull
|
|
+ @Override
|
|
public E pollFirst() {
|
|
return getElementOrNull(multiset().pollFirstEntry());
|
|
}
|
|
|
|
- @Override
|
|
@CheckForNull
|
|
+ @Override
|
|
public E pollLast() {
|
|
return getElementOrNull(multiset().pollLastEntry());
|
|
}
|
|
diff --git a/guava/src/com/google/common/collect/SparseImmutableTable.java b/guava/src/com/google/common/collect/SparseImmutableTable.java
|
|
index 44881fde7f..2105b7965b 100644
|
|
--- a/guava/src/com/google/common/collect/SparseImmutableTable.java
|
|
+++ b/guava/src/com/google/common/collect/SparseImmutableTable.java
|
|
@@ -24,7 +24,7 @@ import java.util.Map.Entry;
|
|
|
|
/** A {@code RegularImmutableTable} optimized for sparse data. */
|
|
@GwtCompatible
|
|
-@Immutable(containerOf = {"R", "C", "V"})
|
|
+@Immutable(containerOf = {"C", "R", "V"})
|
|
@ElementTypesAreNonnullByDefault
|
|
final class SparseImmutableTable<R, C, V> extends RegularImmutableTable<R, C, V> {
|
|
static final ImmutableTable<Object, Object, Object> EMPTY =
|
|
diff --git a/guava/src/com/google/common/collect/StandardRowSortedTable.java b/guava/src/com/google/common/collect/StandardRowSortedTable.java
|
|
index bea5b7bb3a..6da2770de5 100644
|
|
--- a/guava/src/com/google/common/collect/StandardRowSortedTable.java
|
|
+++ b/guava/src/com/google/common/collect/StandardRowSortedTable.java
|
|
@@ -103,8 +103,8 @@ class StandardRowSortedTable<R, C, V> extends StandardTable<R, C, V>
|
|
return new Maps.SortedKeySet<>(this);
|
|
}
|
|
|
|
- @Override
|
|
@CheckForNull
|
|
+ @Override
|
|
public Comparator<? super R> comparator() {
|
|
return sortedBackingMap().comparator();
|
|
}
|
|
diff --git a/guava/src/com/google/common/collect/StandardTable.java b/guava/src/com/google/common/collect/StandardTable.java
|
|
index 06defb0eb8..a2ac961bcb 100644
|
|
--- a/guava/src/com/google/common/collect/StandardTable.java
|
|
+++ b/guava/src/com/google/common/collect/StandardTable.java
|
|
@@ -106,8 +106,8 @@ class StandardTable<R, C, V> extends AbstractTable<R, C, V> implements Serializa
|
|
return value != null && super.containsValue(value);
|
|
}
|
|
|
|
- @Override
|
|
@CheckForNull
|
|
+ @Override
|
|
public V get(@CheckForNull Object rowKey, @CheckForNull Object columnKey) {
|
|
return (rowKey == null || columnKey == null) ? null : super.get(rowKey, columnKey);
|
|
}
|
|
@@ -143,8 +143,8 @@ class StandardTable<R, C, V> extends AbstractTable<R, C, V> implements Serializa
|
|
}
|
|
|
|
@CanIgnoreReturnValue
|
|
- @Override
|
|
@CheckForNull
|
|
+ @Override
|
|
public V put(R rowKey, C columnKey, V value) {
|
|
checkNotNull(rowKey);
|
|
checkNotNull(columnKey);
|
|
@@ -153,8 +153,8 @@ class StandardTable<R, C, V> extends AbstractTable<R, C, V> implements Serializa
|
|
}
|
|
|
|
@CanIgnoreReturnValue
|
|
- @Override
|
|
@CheckForNull
|
|
+ @Override
|
|
public V remove(@CheckForNull Object rowKey, @CheckForNull Object columnKey) {
|
|
if ((rowKey == null) || (columnKey == null)) {
|
|
return null;
|
|
@@ -348,15 +348,15 @@ class StandardTable<R, C, V> extends AbstractTable<R, C, V> implements Serializa
|
|
return (key != null && backingRowMap != null) && Maps.safeContainsKey(backingRowMap, key);
|
|
}
|
|
|
|
- @Override
|
|
@CheckForNull
|
|
+ @Override
|
|
public V get(@CheckForNull Object key) {
|
|
updateBackingRowMapField();
|
|
return (key != null && backingRowMap != null) ? Maps.safeGet(backingRowMap, key) : null;
|
|
}
|
|
|
|
- @Override
|
|
@CheckForNull
|
|
+ @Override
|
|
public V put(C key, V value) {
|
|
checkNotNull(key);
|
|
checkNotNull(value);
|
|
@@ -366,8 +366,8 @@ class StandardTable<R, C, V> extends AbstractTable<R, C, V> implements Serializa
|
|
return StandardTable.this.put(rowKey, key, value);
|
|
}
|
|
|
|
- @Override
|
|
@CheckForNull
|
|
+ @Override
|
|
public V remove(@CheckForNull Object key) {
|
|
updateBackingRowMapField();
|
|
if (backingRowMap == null) {
|
|
@@ -466,14 +466,14 @@ class StandardTable<R, C, V> extends AbstractTable<R, C, V> implements Serializa
|
|
this.columnKey = checkNotNull(columnKey);
|
|
}
|
|
|
|
- @Override
|
|
@CheckForNull
|
|
+ @Override
|
|
public V put(R key, V value) {
|
|
return StandardTable.this.put(key, columnKey, value);
|
|
}
|
|
|
|
- @Override
|
|
@CheckForNull
|
|
+ @Override
|
|
public V get(@CheckForNull Object key) {
|
|
return StandardTable.this.get(key, columnKey);
|
|
}
|
|
@@ -483,8 +483,8 @@ class StandardTable<R, C, V> extends AbstractTable<R, C, V> implements Serializa
|
|
return StandardTable.this.contains(key, columnKey);
|
|
}
|
|
|
|
- @Override
|
|
@CheckForNull
|
|
+ @Override
|
|
public V remove(@CheckForNull Object key) {
|
|
return StandardTable.this.remove(key, columnKey);
|
|
}
|
|
@@ -569,8 +569,8 @@ class StandardTable<R, C, V> extends AbstractTable<R, C, V> implements Serializa
|
|
private class EntrySetIterator extends AbstractIterator<Entry<R, V>> {
|
|
final Iterator<Entry<R, Map<C, V>>> iterator = backingMap.entrySet().iterator();
|
|
|
|
- @Override
|
|
@CheckForNull
|
|
+ @Override
|
|
protected Entry<R, V> computeNext() {
|
|
while (iterator.hasNext()) {
|
|
final Entry<R, Map<C, V>> entry = iterator.next();
|
|
@@ -775,8 +775,8 @@ class StandardTable<R, C, V> extends AbstractTable<R, C, V> implements Serializa
|
|
final Iterator<Map<C, V>> mapIterator = backingMap.values().iterator();
|
|
Iterator<Entry<C, V>> entryIterator = Iterators.emptyIterator();
|
|
|
|
- @Override
|
|
@CheckForNull
|
|
+ @Override
|
|
protected C computeNext() {
|
|
while (true) {
|
|
if (entryIterator.hasNext()) {
|
|
@@ -825,16 +825,16 @@ class StandardTable<R, C, V> extends AbstractTable<R, C, V> implements Serializa
|
|
}
|
|
|
|
// performing cast only when key is in backing map and has the correct type
|
|
- @SuppressWarnings("unchecked")
|
|
- @Override
|
|
@CheckForNull
|
|
+ @Override
|
|
+ @SuppressWarnings("unchecked")
|
|
public Map<C, V> get(@CheckForNull Object key) {
|
|
// requireNonNull is safe because of the containsRow check.
|
|
return containsRow(key) ? row((R) requireNonNull(key)) : null;
|
|
}
|
|
|
|
- @Override
|
|
@CheckForNull
|
|
+ @Override
|
|
public Map<C, V> remove(@CheckForNull Object key) {
|
|
return (key == null) ? null : backingMap.remove(key);
|
|
}
|
|
@@ -899,9 +899,9 @@ class StandardTable<R, C, V> extends AbstractTable<R, C, V> implements Serializa
|
|
private class ColumnMap extends ViewCachingAbstractMap<C, Map<R, V>> {
|
|
// The cast to C occurs only when the key is in the map, implying that it
|
|
// has the correct type.
|
|
- @SuppressWarnings("unchecked")
|
|
- @Override
|
|
@CheckForNull
|
|
+ @Override
|
|
+ @SuppressWarnings("unchecked")
|
|
public Map<R, V> get(@CheckForNull Object key) {
|
|
// requireNonNull is safe because of the containsColumn check.
|
|
return containsColumn(key) ? column((C) requireNonNull(key)) : null;
|
|
@@ -912,8 +912,8 @@ class StandardTable<R, C, V> extends AbstractTable<R, C, V> implements Serializa
|
|
return containsColumn(key);
|
|
}
|
|
|
|
- @Override
|
|
@CheckForNull
|
|
+ @Override
|
|
public Map<R, V> remove(@CheckForNull Object key) {
|
|
return containsColumn(key) ? removeColumn(key) : null;
|
|
}
|
|
diff --git a/guava/src/com/google/common/collect/Streams.java b/guava/src/com/google/common/collect/Streams.java
|
|
index cd7a07c342..fcaf09d138 100644
|
|
--- a/guava/src/com/google/common/collect/Streams.java
|
|
+++ b/guava/src/com/google/common/collect/Streams.java
|
|
@@ -752,8 +752,8 @@ public final class Streams {
|
|
|
|
abstract S createSplit(F from, long i);
|
|
|
|
- @Override
|
|
@CheckForNull
|
|
+ @Override
|
|
public S trySplit() {
|
|
Spliterator<?> splitOrNull = fromSpliterator.trySplit();
|
|
if (splitOrNull == null) {
|
|
diff --git a/guava/src/com/google/common/collect/Synchronized.java b/guava/src/com/google/common/collect/Synchronized.java
|
|
index 29fe61a89b..5514a253fc 100644
|
|
--- a/guava/src/com/google/common/collect/Synchronized.java
|
|
+++ b/guava/src/com/google/common/collect/Synchronized.java
|
|
@@ -126,8 +126,8 @@ final class Synchronized {
|
|
super(delegate, mutex);
|
|
}
|
|
|
|
- @SuppressWarnings("unchecked")
|
|
@Override
|
|
+ @SuppressWarnings("unchecked")
|
|
Collection<E> delegate() {
|
|
return (Collection<E>) super.delegate();
|
|
}
|
|
@@ -313,8 +313,8 @@ final class Synchronized {
|
|
return (SortedSet<E>) super.delegate();
|
|
}
|
|
|
|
- @Override
|
|
@CheckForNull
|
|
+ @Override
|
|
public Comparator<? super E> comparator() {
|
|
synchronized (mutex) {
|
|
return delegate().comparator();
|
|
@@ -599,8 +599,8 @@ final class Synchronized {
|
|
@CheckForNull transient Map<K, Collection<V>> asMap;
|
|
@CheckForNull transient Multiset<K> keys;
|
|
|
|
- @SuppressWarnings("unchecked")
|
|
@Override
|
|
+ @SuppressWarnings("unchecked")
|
|
Multimap<K, V> delegate() {
|
|
return (Multimap<K, V>) super.delegate();
|
|
}
|
|
@@ -919,8 +919,8 @@ final class Synchronized {
|
|
}
|
|
}
|
|
|
|
- @Override
|
|
@CheckForNull
|
|
+ @Override
|
|
public Comparator<? super V> valueComparator() {
|
|
synchronized (mutex) {
|
|
return delegate().valueComparator();
|
|
@@ -1071,8 +1071,8 @@ final class Synchronized {
|
|
super(delegate, mutex);
|
|
}
|
|
|
|
- @SuppressWarnings("unchecked")
|
|
@Override
|
|
+ @SuppressWarnings("unchecked")
|
|
Map<K, V> delegate() {
|
|
return (Map<K, V>) super.delegate();
|
|
}
|
|
@@ -1115,16 +1115,16 @@ final class Synchronized {
|
|
}
|
|
}
|
|
|
|
- @Override
|
|
@CheckForNull
|
|
+ @Override
|
|
public V get(@CheckForNull Object key) {
|
|
synchronized (mutex) {
|
|
return delegate().get(key);
|
|
}
|
|
}
|
|
|
|
- @Override
|
|
@CheckForNull
|
|
+ @Override
|
|
public V getOrDefault(@CheckForNull Object key, @CheckForNull V defaultValue) {
|
|
synchronized (mutex) {
|
|
return delegate().getOrDefault(key, defaultValue);
|
|
@@ -1148,16 +1148,16 @@ final class Synchronized {
|
|
}
|
|
}
|
|
|
|
- @Override
|
|
@CheckForNull
|
|
+ @Override
|
|
public V put(K key, V value) {
|
|
synchronized (mutex) {
|
|
return delegate().put(key, value);
|
|
}
|
|
}
|
|
|
|
- @Override
|
|
@CheckForNull
|
|
+ @Override
|
|
public V putIfAbsent(K key, V value) {
|
|
synchronized (mutex) {
|
|
return delegate().putIfAbsent(key, value);
|
|
@@ -1171,8 +1171,8 @@ final class Synchronized {
|
|
}
|
|
}
|
|
|
|
- @Override
|
|
@CheckForNull
|
|
+ @Override
|
|
public V replace(K key, V value) {
|
|
synchronized (mutex) {
|
|
return delegate().replace(key, value);
|
|
@@ -1224,8 +1224,8 @@ final class Synchronized {
|
|
}
|
|
}
|
|
|
|
- @Override
|
|
@CheckForNull
|
|
+ @Override
|
|
public V remove(@CheckForNull Object key) {
|
|
synchronized (mutex) {
|
|
return delegate().remove(key);
|
|
@@ -1293,8 +1293,8 @@ final class Synchronized {
|
|
return (SortedMap<K, V>) super.delegate();
|
|
}
|
|
|
|
- @Override
|
|
@CheckForNull
|
|
+ @Override
|
|
public Comparator<? super K> comparator() {
|
|
synchronized (mutex) {
|
|
return delegate().comparator();
|
|
@@ -1374,8 +1374,8 @@ final class Synchronized {
|
|
}
|
|
}
|
|
|
|
- @Override
|
|
@CheckForNull
|
|
+ @Override
|
|
public V forcePut(K key, V value) {
|
|
synchronized (mutex) {
|
|
return delegate().forcePut(key, value);
|
|
@@ -1404,8 +1404,8 @@ final class Synchronized {
|
|
super(delegate, mutex);
|
|
}
|
|
|
|
- @Override
|
|
@CheckForNull
|
|
+ @Override
|
|
public Collection<V> get(@CheckForNull Object key) {
|
|
synchronized (mutex) {
|
|
Collection<V> collection = super.get(key);
|
|
@@ -1475,8 +1475,8 @@ final class Synchronized {
|
|
return (NavigableSet<E>) super.delegate();
|
|
}
|
|
|
|
- @Override
|
|
@CheckForNull
|
|
+ @Override
|
|
public E ceiling(E e) {
|
|
synchronized (mutex) {
|
|
return delegate().ceiling(e);
|
|
@@ -1502,8 +1502,8 @@ final class Synchronized {
|
|
}
|
|
}
|
|
|
|
- @Override
|
|
@CheckForNull
|
|
+ @Override
|
|
public E floor(E e) {
|
|
synchronized (mutex) {
|
|
return delegate().floor(e);
|
|
@@ -1522,32 +1522,32 @@ final class Synchronized {
|
|
return headSet(toElement, false);
|
|
}
|
|
|
|
- @Override
|
|
@CheckForNull
|
|
+ @Override
|
|
public E higher(E e) {
|
|
synchronized (mutex) {
|
|
return delegate().higher(e);
|
|
}
|
|
}
|
|
|
|
- @Override
|
|
@CheckForNull
|
|
+ @Override
|
|
public E lower(E e) {
|
|
synchronized (mutex) {
|
|
return delegate().lower(e);
|
|
}
|
|
}
|
|
|
|
- @Override
|
|
@CheckForNull
|
|
+ @Override
|
|
public E pollFirst() {
|
|
synchronized (mutex) {
|
|
return delegate().pollFirst();
|
|
}
|
|
}
|
|
|
|
- @Override
|
|
@CheckForNull
|
|
+ @Override
|
|
public E pollLast() {
|
|
synchronized (mutex) {
|
|
return delegate().pollLast();
|
|
@@ -1620,16 +1620,16 @@ final class Synchronized {
|
|
return (NavigableMap<K, V>) super.delegate();
|
|
}
|
|
|
|
- @Override
|
|
@CheckForNull
|
|
+ @Override
|
|
public Map.Entry<K, V> ceilingEntry(K key) {
|
|
synchronized (mutex) {
|
|
return nullableSynchronizedEntry(delegate().ceilingEntry(key), mutex);
|
|
}
|
|
}
|
|
|
|
- @Override
|
|
@CheckForNull
|
|
+ @Override
|
|
public K ceilingKey(K key) {
|
|
synchronized (mutex) {
|
|
return delegate().ceilingKey(key);
|
|
@@ -1660,24 +1660,24 @@ final class Synchronized {
|
|
}
|
|
}
|
|
|
|
- @Override
|
|
@CheckForNull
|
|
+ @Override
|
|
public Map.Entry<K, V> firstEntry() {
|
|
synchronized (mutex) {
|
|
return nullableSynchronizedEntry(delegate().firstEntry(), mutex);
|
|
}
|
|
}
|
|
|
|
- @Override
|
|
@CheckForNull
|
|
+ @Override
|
|
public Map.Entry<K, V> floorEntry(K key) {
|
|
synchronized (mutex) {
|
|
return nullableSynchronizedEntry(delegate().floorEntry(key), mutex);
|
|
}
|
|
}
|
|
|
|
- @Override
|
|
@CheckForNull
|
|
+ @Override
|
|
public K floorKey(K key) {
|
|
synchronized (mutex) {
|
|
return delegate().floorKey(key);
|
|
@@ -1696,40 +1696,40 @@ final class Synchronized {
|
|
return headMap(toKey, false);
|
|
}
|
|
|
|
- @Override
|
|
@CheckForNull
|
|
+ @Override
|
|
public Map.Entry<K, V> higherEntry(K key) {
|
|
synchronized (mutex) {
|
|
return nullableSynchronizedEntry(delegate().higherEntry(key), mutex);
|
|
}
|
|
}
|
|
|
|
- @Override
|
|
@CheckForNull
|
|
+ @Override
|
|
public K higherKey(K key) {
|
|
synchronized (mutex) {
|
|
return delegate().higherKey(key);
|
|
}
|
|
}
|
|
|
|
- @Override
|
|
@CheckForNull
|
|
+ @Override
|
|
public Map.Entry<K, V> lastEntry() {
|
|
synchronized (mutex) {
|
|
return nullableSynchronizedEntry(delegate().lastEntry(), mutex);
|
|
}
|
|
}
|
|
|
|
- @Override
|
|
@CheckForNull
|
|
+ @Override
|
|
public Map.Entry<K, V> lowerEntry(K key) {
|
|
synchronized (mutex) {
|
|
return nullableSynchronizedEntry(delegate().lowerEntry(key), mutex);
|
|
}
|
|
}
|
|
|
|
- @Override
|
|
@CheckForNull
|
|
+ @Override
|
|
public K lowerKey(K key) {
|
|
synchronized (mutex) {
|
|
return delegate().lowerKey(key);
|
|
@@ -1753,16 +1753,16 @@ final class Synchronized {
|
|
}
|
|
}
|
|
|
|
- @Override
|
|
@CheckForNull
|
|
+ @Override
|
|
public Map.Entry<K, V> pollFirstEntry() {
|
|
synchronized (mutex) {
|
|
return nullableSynchronizedEntry(delegate().pollFirstEntry(), mutex);
|
|
}
|
|
}
|
|
|
|
- @Override
|
|
@CheckForNull
|
|
+ @Override
|
|
public Map.Entry<K, V> pollLastEntry() {
|
|
synchronized (mutex) {
|
|
return nullableSynchronizedEntry(delegate().pollLastEntry(), mutex);
|
|
@@ -1797,8 +1797,8 @@ final class Synchronized {
|
|
private static final long serialVersionUID = 0;
|
|
}
|
|
|
|
- @GwtIncompatible // works but is needed only for NavigableMap
|
|
- @CheckForNull
|
|
+ @CheckForNull // works but is needed only for NavigableMap
|
|
+ @GwtIncompatible
|
|
private static <K extends @Nullable Object, V extends @Nullable Object>
|
|
Map.Entry<K, V> nullableSynchronizedEntry(
|
|
@CheckForNull Map.Entry<K, V> entry, @CheckForNull Object mutex) {
|
|
@@ -1816,8 +1816,8 @@ final class Synchronized {
|
|
super(delegate, mutex);
|
|
}
|
|
|
|
- @SuppressWarnings("unchecked") // guaranteed by the constructor
|
|
- @Override
|
|
+ @Override // guaranteed by the constructor
|
|
+ @SuppressWarnings("unchecked")
|
|
Map.Entry<K, V> delegate() {
|
|
return (Map.Entry<K, V>) super.delegate();
|
|
}
|
|
@@ -1890,16 +1890,16 @@ final class Synchronized {
|
|
}
|
|
}
|
|
|
|
- @Override
|
|
@CheckForNull
|
|
+ @Override
|
|
public E peek() {
|
|
synchronized (mutex) {
|
|
return delegate().peek();
|
|
}
|
|
}
|
|
|
|
- @Override
|
|
@CheckForNull
|
|
+ @Override
|
|
public E poll() {
|
|
synchronized (mutex) {
|
|
return delegate().poll();
|
|
@@ -1974,16 +1974,16 @@ final class Synchronized {
|
|
}
|
|
}
|
|
|
|
- @Override
|
|
@CheckForNull
|
|
+ @Override
|
|
public E pollFirst() {
|
|
synchronized (mutex) {
|
|
return delegate().pollFirst();
|
|
}
|
|
}
|
|
|
|
- @Override
|
|
@CheckForNull
|
|
+ @Override
|
|
public E pollLast() {
|
|
synchronized (mutex) {
|
|
return delegate().pollLast();
|
|
@@ -2004,16 +2004,16 @@ final class Synchronized {
|
|
}
|
|
}
|
|
|
|
- @Override
|
|
@CheckForNull
|
|
+ @Override
|
|
public E peekFirst() {
|
|
synchronized (mutex) {
|
|
return delegate().peekFirst();
|
|
}
|
|
}
|
|
|
|
- @Override
|
|
@CheckForNull
|
|
+ @Override
|
|
public E peekLast() {
|
|
synchronized (mutex) {
|
|
return delegate().peekLast();
|
|
@@ -2071,8 +2071,8 @@ final class Synchronized {
|
|
super(delegate, mutex);
|
|
}
|
|
|
|
- @SuppressWarnings("unchecked")
|
|
@Override
|
|
+ @SuppressWarnings("unchecked")
|
|
Table<R, C, V> delegate() {
|
|
return (Table<R, C, V>) super.delegate();
|
|
}
|
|
@@ -2105,8 +2105,8 @@ final class Synchronized {
|
|
}
|
|
}
|
|
|
|
- @Override
|
|
@CheckForNull
|
|
+ @Override
|
|
public V get(@CheckForNull Object rowKey, @CheckForNull Object columnKey) {
|
|
synchronized (mutex) {
|
|
return delegate().get(rowKey, columnKey);
|
|
@@ -2134,8 +2134,8 @@ final class Synchronized {
|
|
}
|
|
}
|
|
|
|
- @Override
|
|
@CheckForNull
|
|
+ @Override
|
|
public V put(R rowKey, C columnKey, V value) {
|
|
synchronized (mutex) {
|
|
return delegate().put(rowKey, columnKey, value);
|
|
@@ -2149,8 +2149,8 @@ final class Synchronized {
|
|
}
|
|
}
|
|
|
|
- @Override
|
|
@CheckForNull
|
|
+ @Override
|
|
public V remove(@CheckForNull Object rowKey, @CheckForNull Object columnKey) {
|
|
synchronized (mutex) {
|
|
return delegate().remove(rowKey, columnKey);
|
|
diff --git a/guava/src/com/google/common/collect/Tables.java b/guava/src/com/google/common/collect/Tables.java
|
|
index 9c58611d41..d5c32c08ff 100644
|
|
--- a/guava/src/com/google/common/collect/Tables.java
|
|
+++ b/guava/src/com/google/common/collect/Tables.java
|
|
@@ -19,6 +19,11 @@ package com.google.common.collect;
|
|
import static com.google.common.base.Preconditions.checkArgument;
|
|
import static com.google.common.base.Preconditions.checkNotNull;
|
|
import static com.google.common.collect.NullnessCasts.uncheckedCastNullableTToT;
|
|
+import static java.util.Collections.unmodifiableCollection;
|
|
+import static java.util.Collections.unmodifiableMap;
|
|
+import static java.util.Collections.unmodifiableSet;
|
|
+import static java.util.Collections.unmodifiableSortedMap;
|
|
+import static java.util.Collections.unmodifiableSortedSet;
|
|
|
|
import com.google.common.annotations.Beta;
|
|
import com.google.common.annotations.GwtCompatible;
|
|
@@ -28,7 +33,6 @@ import com.google.common.base.Supplier;
|
|
import com.google.common.collect.Table.Cell;
|
|
import java.io.Serializable;
|
|
import java.util.Collection;
|
|
-import java.util.Collections;
|
|
import java.util.Iterator;
|
|
import java.util.Map;
|
|
import java.util.Set;
|
|
@@ -265,14 +269,14 @@ public final class Tables {
|
|
return original.containsValue(value);
|
|
}
|
|
|
|
- @Override
|
|
@CheckForNull
|
|
+ @Override
|
|
public V get(@CheckForNull Object rowKey, @CheckForNull Object columnKey) {
|
|
return original.get(columnKey, rowKey);
|
|
}
|
|
|
|
- @Override
|
|
@CheckForNull
|
|
+ @Override
|
|
public V put(
|
|
@ParametricNullness C rowKey,
|
|
@ParametricNullness R columnKey,
|
|
@@ -285,8 +289,8 @@ public final class Tables {
|
|
original.putAll(transpose(table));
|
|
}
|
|
|
|
- @Override
|
|
@CheckForNull
|
|
+ @Override
|
|
public V remove(@CheckForNull Object rowKey, @CheckForNull Object columnKey) {
|
|
return original.remove(columnKey, rowKey);
|
|
}
|
|
@@ -325,14 +329,14 @@ public final class Tables {
|
|
}
|
|
};
|
|
|
|
- @SuppressWarnings("unchecked")
|
|
@Override
|
|
+ @SuppressWarnings("unchecked")
|
|
Iterator<Cell<C, R, V>> cellIterator() {
|
|
return Iterators.transform(original.cellSet().iterator(), (Function) TRANSPOSE_CELL);
|
|
}
|
|
|
|
- @SuppressWarnings("unchecked")
|
|
@Override
|
|
+ @SuppressWarnings("unchecked")
|
|
Spliterator<Cell<C, R, V>> cellSpliterator() {
|
|
return CollectSpliterators.map(original.cellSet().spliterator(), (Function) TRANSPOSE_CELL);
|
|
}
|
|
@@ -436,8 +440,8 @@ public final class Tables {
|
|
return fromTable.contains(rowKey, columnKey);
|
|
}
|
|
|
|
- @Override
|
|
@CheckForNull
|
|
+ @Override
|
|
public V2 get(@CheckForNull Object rowKey, @CheckForNull Object columnKey) {
|
|
// The function is passed a null input only when the table contains a null
|
|
// value.
|
|
@@ -457,8 +461,8 @@ public final class Tables {
|
|
fromTable.clear();
|
|
}
|
|
|
|
- @Override
|
|
@CheckForNull
|
|
+ @Override
|
|
public V2 put(
|
|
@ParametricNullness R rowKey,
|
|
@ParametricNullness C columnKey,
|
|
@@ -471,8 +475,8 @@ public final class Tables {
|
|
throw new UnsupportedOperationException();
|
|
}
|
|
|
|
- @Override
|
|
@CheckForNull
|
|
+ @Override
|
|
public V2 remove(@CheckForNull Object rowKey, @CheckForNull Object columnKey) {
|
|
return contains(rowKey, columnKey)
|
|
// The cast is safe because of the contains() check.
|
|
@@ -576,15 +580,15 @@ public final class Tables {
|
|
this.delegate = checkNotNull(delegate);
|
|
}
|
|
|
|
- @SuppressWarnings("unchecked") // safe, covariant cast
|
|
- @Override
|
|
+ @Override // safe, covariant cast
|
|
+ @SuppressWarnings("unchecked")
|
|
protected Table<R, C, V> delegate() {
|
|
return (Table<R, C, V>) delegate;
|
|
}
|
|
|
|
@Override
|
|
public Set<Cell<R, C, V>> cellSet() {
|
|
- return Collections.unmodifiableSet(super.cellSet());
|
|
+ return unmodifiableSet(super.cellSet());
|
|
}
|
|
|
|
@Override
|
|
@@ -594,22 +598,22 @@ public final class Tables {
|
|
|
|
@Override
|
|
public Map<R, V> column(@ParametricNullness C columnKey) {
|
|
- return Collections.unmodifiableMap(super.column(columnKey));
|
|
+ return unmodifiableMap(super.column(columnKey));
|
|
}
|
|
|
|
@Override
|
|
public Set<C> columnKeySet() {
|
|
- return Collections.unmodifiableSet(super.columnKeySet());
|
|
+ return unmodifiableSet(super.columnKeySet());
|
|
}
|
|
|
|
@Override
|
|
public Map<C, Map<R, V>> columnMap() {
|
|
Function<Map<R, V>, Map<R, V>> wrapper = unmodifiableWrapper();
|
|
- return Collections.unmodifiableMap(Maps.transformValues(super.columnMap(), wrapper));
|
|
+ return unmodifiableMap(Maps.transformValues(super.columnMap(), wrapper));
|
|
}
|
|
|
|
- @Override
|
|
@CheckForNull
|
|
+ @Override
|
|
public V put(
|
|
@ParametricNullness R rowKey,
|
|
@ParametricNullness C columnKey,
|
|
@@ -622,31 +626,31 @@ public final class Tables {
|
|
throw new UnsupportedOperationException();
|
|
}
|
|
|
|
- @Override
|
|
@CheckForNull
|
|
+ @Override
|
|
public V remove(@CheckForNull Object rowKey, @CheckForNull Object columnKey) {
|
|
throw new UnsupportedOperationException();
|
|
}
|
|
|
|
@Override
|
|
public Map<C, V> row(@ParametricNullness R rowKey) {
|
|
- return Collections.unmodifiableMap(super.row(rowKey));
|
|
+ return unmodifiableMap(super.row(rowKey));
|
|
}
|
|
|
|
@Override
|
|
public Set<R> rowKeySet() {
|
|
- return Collections.unmodifiableSet(super.rowKeySet());
|
|
+ return unmodifiableSet(super.rowKeySet());
|
|
}
|
|
|
|
@Override
|
|
public Map<R, Map<C, V>> rowMap() {
|
|
Function<Map<C, V>, Map<C, V>> wrapper = unmodifiableWrapper();
|
|
- return Collections.unmodifiableMap(Maps.transformValues(super.rowMap(), wrapper));
|
|
+ return unmodifiableMap(Maps.transformValues(super.rowMap(), wrapper));
|
|
}
|
|
|
|
@Override
|
|
public Collection<V> values() {
|
|
- return Collections.unmodifiableCollection(super.values());
|
|
+ return unmodifiableCollection(super.values());
|
|
}
|
|
|
|
private static final long serialVersionUID = 0;
|
|
@@ -692,12 +696,12 @@ public final class Tables {
|
|
@Override
|
|
public SortedMap<R, Map<C, V>> rowMap() {
|
|
Function<Map<C, V>, Map<C, V>> wrapper = unmodifiableWrapper();
|
|
- return Collections.unmodifiableSortedMap(Maps.transformValues(delegate().rowMap(), wrapper));
|
|
+ return unmodifiableSortedMap(Maps.transformValues(delegate().rowMap(), wrapper));
|
|
}
|
|
|
|
@Override
|
|
public SortedSet<R> rowKeySet() {
|
|
- return Collections.unmodifiableSortedSet(delegate().rowKeySet());
|
|
+ return unmodifiableSortedSet(delegate().rowKeySet());
|
|
}
|
|
|
|
private static final long serialVersionUID = 0;
|
|
@@ -713,7 +717,7 @@ public final class Tables {
|
|
new Function<Map<Object, Object>, Map<Object, Object>>() {
|
|
@Override
|
|
public Map<Object, Object> apply(Map<Object, Object> input) {
|
|
- return Collections.unmodifiableMap(input);
|
|
+ return unmodifiableMap(input);
|
|
}
|
|
};
|
|
|
|
diff --git a/guava/src/com/google/common/collect/TopKSelector.java b/guava/src/com/google/common/collect/TopKSelector.java
|
|
index 45f9ca58fb..c8e19a0884 100644
|
|
--- a/guava/src/com/google/common/collect/TopKSelector.java
|
|
+++ b/guava/src/com/google/common/collect/TopKSelector.java
|
|
@@ -19,12 +19,12 @@ package com.google.common.collect;
|
|
import static com.google.common.base.Preconditions.checkArgument;
|
|
import static com.google.common.base.Preconditions.checkNotNull;
|
|
import static com.google.common.collect.NullnessCasts.uncheckedCastNullableTToT;
|
|
+import static java.util.Collections.unmodifiableList;
|
|
|
|
import com.google.common.annotations.GwtCompatible;
|
|
import com.google.common.math.IntMath;
|
|
import java.math.RoundingMode;
|
|
import java.util.Arrays;
|
|
-import java.util.Collections;
|
|
import java.util.Comparator;
|
|
import java.util.Iterator;
|
|
import java.util.List;
|
|
@@ -281,6 +281,6 @@ final class TopKSelector<T extends @Nullable Object> {
|
|
threshold = buffer[k - 1];
|
|
}
|
|
// we have to support null elements, so no ImmutableList for us
|
|
- return Collections.unmodifiableList(Arrays.asList(Arrays.copyOf(buffer, bufferSize)));
|
|
+ return unmodifiableList(Arrays.asList(Arrays.copyOf(buffer, bufferSize)));
|
|
}
|
|
}
|
|
diff --git a/guava/src/com/google/common/collect/TreeBasedTable.java b/guava/src/com/google/common/collect/TreeBasedTable.java
|
|
index 9ef210a54a..68c651eba8 100644
|
|
--- a/guava/src/com/google/common/collect/TreeBasedTable.java
|
|
+++ b/guava/src/com/google/common/collect/TreeBasedTable.java
|
|
@@ -257,8 +257,8 @@ public class TreeBasedTable<R, C, V> extends StandardRowSortedTable<R, C, V> {
|
|
}
|
|
}
|
|
|
|
- @Override
|
|
@CheckForNull
|
|
+ @Override
|
|
SortedMap<C, V> computeBackingRowMap() {
|
|
updateWholeRowField();
|
|
SortedMap<C, V> map = wholeRow;
|
|
@@ -289,8 +289,8 @@ public class TreeBasedTable<R, C, V> extends StandardRowSortedTable<R, C, V> {
|
|
return rangeContains(key) && super.containsKey(key);
|
|
}
|
|
|
|
- @Override
|
|
@CheckForNull
|
|
+ @Override
|
|
public V put(C key, V value) {
|
|
checkArgument(rangeContains(checkNotNull(key)));
|
|
return super.put(key, value);
|
|
@@ -323,8 +323,8 @@ public class TreeBasedTable<R, C, V> extends StandardRowSortedTable<R, C, V> {
|
|
return new AbstractIterator<C>() {
|
|
@CheckForNull C lastValue;
|
|
|
|
- @Override
|
|
@CheckForNull
|
|
+ @Override
|
|
protected C computeNext() {
|
|
while (merged.hasNext()) {
|
|
C next = merged.next();
|
|
diff --git a/guava/src/com/google/common/collect/TreeMultimap.java b/guava/src/com/google/common/collect/TreeMultimap.java
|
|
index b6adb40e8f..956e37dbd5 100644
|
|
--- a/guava/src/com/google/common/collect/TreeMultimap.java
|
|
+++ b/guava/src/com/google/common/collect/TreeMultimap.java
|
|
@@ -164,8 +164,8 @@ public class TreeMultimap<K extends @Nullable Object, V extends @Nullable Object
|
|
/**
|
|
* @since 14.0 (present with return type {@code SortedSet} since 2.0)
|
|
*/
|
|
- @Override
|
|
- @GwtIncompatible // NavigableSet
|
|
+ @GwtIncompatible
|
|
+ @Override // NavigableSet
|
|
public NavigableSet<V> get(@ParametricNullness K key) {
|
|
return (NavigableSet<V>) super.get(key);
|
|
}
|
|
diff --git a/guava/src/com/google/common/collect/TreeRangeMap.java b/guava/src/com/google/common/collect/TreeRangeMap.java
|
|
index 60e7bf3df8..79385fa992 100644
|
|
--- a/guava/src/com/google/common/collect/TreeRangeMap.java
|
|
+++ b/guava/src/com/google/common/collect/TreeRangeMap.java
|
|
@@ -21,6 +21,7 @@ import static com.google.common.base.Preconditions.checkNotNull;
|
|
import static com.google.common.base.Predicates.compose;
|
|
import static com.google.common.base.Predicates.in;
|
|
import static com.google.common.base.Predicates.not;
|
|
+import static java.util.Collections.emptyMap;
|
|
import static java.util.Objects.requireNonNull;
|
|
|
|
import com.google.common.annotations.Beta;
|
|
@@ -30,7 +31,6 @@ import com.google.common.base.Predicate;
|
|
import com.google.common.collect.Maps.IteratorBasedAbstractMap;
|
|
import java.util.AbstractMap;
|
|
import java.util.Collection;
|
|
-import java.util.Collections;
|
|
import java.util.Iterator;
|
|
import java.util.List;
|
|
import java.util.Map;
|
|
@@ -103,15 +103,15 @@ public final class TreeRangeMap<K extends Comparable, V> implements RangeMap<K,
|
|
}
|
|
}
|
|
|
|
- @Override
|
|
@CheckForNull
|
|
+ @Override
|
|
public V get(K key) {
|
|
Entry<Range<K>, V> entry = getEntry(key);
|
|
return (entry == null) ? null : entry.getValue();
|
|
}
|
|
|
|
- @Override
|
|
@CheckForNull
|
|
+ @Override
|
|
public Entry<Range<K>, V> getEntry(K key) {
|
|
Entry<Cut<K>, RangeMapEntry<K, V>> mapEntry =
|
|
entriesByLowerBound.floorEntry(Cut.belowValue(key));
|
|
@@ -152,9 +152,7 @@ public final class TreeRangeMap<K extends Comparable, V> implements RangeMap<K,
|
|
|
|
Entry<Cut<K>, RangeMapEntry<K, V>> higherEntry =
|
|
entriesByLowerBound.floorEntry(range.upperBound);
|
|
- coalescedRange = coalesce(coalescedRange, value, higherEntry);
|
|
-
|
|
- return coalescedRange;
|
|
+ return coalesce(coalescedRange, value, higherEntry);
|
|
}
|
|
|
|
/** Returns the range that spans the given range and entry, if the entry can be coalesced. */
|
|
@@ -344,8 +342,8 @@ public final class TreeRangeMap<K extends Comparable, V> implements RangeMap<K,
|
|
return get(key) != null;
|
|
}
|
|
|
|
- @Override
|
|
@CheckForNull
|
|
+ @Override
|
|
public V get(@CheckForNull Object key) {
|
|
if (key instanceof Range) {
|
|
Range<?> range = (Range<?>) key;
|
|
@@ -385,14 +383,14 @@ public final class TreeRangeMap<K extends Comparable, V> implements RangeMap<K,
|
|
@SuppressWarnings("ConstantCaseForConstants") // This RangeMap is immutable.
|
|
private static final RangeMap<Comparable<?>, Object> EMPTY_SUB_RANGE_MAP =
|
|
new RangeMap<Comparable<?>, Object>() {
|
|
- @Override
|
|
@CheckForNull
|
|
+ @Override
|
|
public Object get(Comparable<?> key) {
|
|
return null;
|
|
}
|
|
|
|
- @Override
|
|
@CheckForNull
|
|
+ @Override
|
|
public Entry<Range<Comparable<?>>, Object> getEntry(Comparable<?> key) {
|
|
return null;
|
|
}
|
|
@@ -445,12 +443,12 @@ public final class TreeRangeMap<K extends Comparable, V> implements RangeMap<K,
|
|
|
|
@Override
|
|
public Map<Range<Comparable<?>>, Object> asMapOfRanges() {
|
|
- return Collections.emptyMap();
|
|
+ return emptyMap();
|
|
}
|
|
|
|
@Override
|
|
public Map<Range<Comparable<?>>, Object> asDescendingMapOfRanges() {
|
|
- return Collections.emptyMap();
|
|
+ return emptyMap();
|
|
}
|
|
|
|
@Override
|
|
@@ -468,14 +466,14 @@ public final class TreeRangeMap<K extends Comparable, V> implements RangeMap<K,
|
|
this.subRange = subRange;
|
|
}
|
|
|
|
- @Override
|
|
@CheckForNull
|
|
+ @Override
|
|
public V get(K key) {
|
|
return subRange.contains(key) ? TreeRangeMap.this.get(key) : null;
|
|
}
|
|
|
|
- @Override
|
|
@CheckForNull
|
|
+ @Override
|
|
public Entry<Range<K>, V> getEntry(K key) {
|
|
if (subRange.contains(key)) {
|
|
Entry<Range<K>, V> entry = TreeRangeMap.this.getEntry(key);
|
|
@@ -603,8 +601,8 @@ public final class TreeRangeMap<K extends Comparable, V> implements RangeMap<K,
|
|
.iterator();
|
|
return new AbstractIterator<Entry<Range<K>, V>>() {
|
|
|
|
- @Override
|
|
@CheckForNull
|
|
+ @Override
|
|
protected Entry<Range<K>, V> computeNext() {
|
|
if (backingItr.hasNext()) {
|
|
RangeMapEntry<K, V> entry = backingItr.next();
|
|
@@ -646,8 +644,8 @@ public final class TreeRangeMap<K extends Comparable, V> implements RangeMap<K,
|
|
return get(key) != null;
|
|
}
|
|
|
|
- @Override
|
|
@CheckForNull
|
|
+ @Override
|
|
public V get(@CheckForNull Object key) {
|
|
try {
|
|
if (key instanceof Range) {
|
|
@@ -680,8 +678,8 @@ public final class TreeRangeMap<K extends Comparable, V> implements RangeMap<K,
|
|
return null;
|
|
}
|
|
|
|
- @Override
|
|
@CheckForNull
|
|
+ @Override
|
|
public V remove(@CheckForNull Object key) {
|
|
V value = get(key);
|
|
if (value != null) {
|
|
@@ -768,8 +766,8 @@ public final class TreeRangeMap<K extends Comparable, V> implements RangeMap<K,
|
|
entriesByLowerBound.tailMap(cutToStart, true).values().iterator();
|
|
return new AbstractIterator<Entry<Range<K>, V>>() {
|
|
|
|
- @Override
|
|
@CheckForNull
|
|
+ @Override
|
|
protected Entry<Range<K>, V> computeNext() {
|
|
while (backingItr.hasNext()) {
|
|
RangeMapEntry<K, V> entry = backingItr.next();
|
|
diff --git a/guava/src/com/google/common/collect/TreeRangeSet.java b/guava/src/com/google/common/collect/TreeRangeSet.java
|
|
index 7ba71139eb..698029322a 100644
|
|
--- a/guava/src/com/google/common/collect/TreeRangeSet.java
|
|
+++ b/guava/src/com/google/common/collect/TreeRangeSet.java
|
|
@@ -118,8 +118,8 @@ public class TreeRangeSet<C extends Comparable<?>> extends AbstractRangeSet<C>
|
|
}
|
|
}
|
|
|
|
- @Override
|
|
@CheckForNull
|
|
+ @Override
|
|
public Range<C> rangeContaining(C value) {
|
|
checkNotNull(value);
|
|
Entry<Cut<C>, Range<C>> floorEntry = rangesByLowerBound.floorEntry(Cut.belowValue(value));
|
|
@@ -341,8 +341,8 @@ public class TreeRangeSet<C extends Comparable<?>> extends AbstractRangeSet<C>
|
|
return get(key) != null;
|
|
}
|
|
|
|
- @Override
|
|
@CheckForNull
|
|
+ @Override
|
|
public Range<C> get(@CheckForNull Object key) {
|
|
if (key instanceof Cut) {
|
|
try {
|
|
@@ -387,8 +387,8 @@ public class TreeRangeSet<C extends Comparable<?>> extends AbstractRangeSet<C>
|
|
}
|
|
}
|
|
return new AbstractIterator<Entry<Cut<C>, Range<C>>>() {
|
|
- @Override
|
|
@CheckForNull
|
|
+ @Override
|
|
protected Entry<Cut<C>, Range<C>> computeNext() {
|
|
if (!backingItr.hasNext()) {
|
|
return endOfData();
|
|
@@ -421,8 +421,8 @@ public class TreeRangeSet<C extends Comparable<?>> extends AbstractRangeSet<C>
|
|
backingItr.next();
|
|
}
|
|
return new AbstractIterator<Entry<Cut<C>, Range<C>>>() {
|
|
- @Override
|
|
@CheckForNull
|
|
+ @Override
|
|
protected Entry<Cut<C>, Range<C>> computeNext() {
|
|
if (!backingItr.hasNext()) {
|
|
return endOfData();
|
|
@@ -542,8 +542,8 @@ public class TreeRangeSet<C extends Comparable<?>> extends AbstractRangeSet<C>
|
|
return new AbstractIterator<Entry<Cut<C>, Range<C>>>() {
|
|
Cut<C> nextComplementRangeLowerBound = firstComplementRangeLowerBound;
|
|
|
|
- @Override
|
|
@CheckForNull
|
|
+ @Override
|
|
protected Entry<Cut<C>, Range<C>> computeNext() {
|
|
if (complementLowerBoundWindow.upperBound.isLessThan(nextComplementRangeLowerBound)
|
|
|| nextComplementRangeLowerBound == Cut.<C>aboveAll()) {
|
|
@@ -603,8 +603,8 @@ public class TreeRangeSet<C extends Comparable<?>> extends AbstractRangeSet<C>
|
|
return new AbstractIterator<Entry<Cut<C>, Range<C>>>() {
|
|
Cut<C> nextComplementRangeUpperBound = firstComplementRangeUpperBound;
|
|
|
|
- @Override
|
|
@CheckForNull
|
|
+ @Override
|
|
protected Entry<Cut<C>, Range<C>> computeNext() {
|
|
if (nextComplementRangeUpperBound == Cut.<C>belowAll()) {
|
|
return endOfData();
|
|
@@ -631,8 +631,8 @@ public class TreeRangeSet<C extends Comparable<?>> extends AbstractRangeSet<C>
|
|
return Iterators.size(entryIterator());
|
|
}
|
|
|
|
- @Override
|
|
@CheckForNull
|
|
+ @Override
|
|
public Range<C> get(@CheckForNull Object key) {
|
|
if (key instanceof Cut) {
|
|
try {
|
|
@@ -749,8 +749,8 @@ public class TreeRangeSet<C extends Comparable<?>> extends AbstractRangeSet<C>
|
|
return get(key) != null;
|
|
}
|
|
|
|
- @Override
|
|
@CheckForNull
|
|
+ @Override
|
|
public Range<C> get(@CheckForNull Object key) {
|
|
if (key instanceof Cut) {
|
|
try {
|
|
@@ -805,8 +805,8 @@ public class TreeRangeSet<C extends Comparable<?>> extends AbstractRangeSet<C>
|
|
Ordering.natural()
|
|
.min(lowerBoundWindow.upperBound, Cut.belowValue(restriction.upperBound));
|
|
return new AbstractIterator<Entry<Cut<C>, Range<C>>>() {
|
|
- @Override
|
|
@CheckForNull
|
|
+ @Override
|
|
protected Entry<Cut<C>, Range<C>> computeNext() {
|
|
if (!completeRangeItr.hasNext()) {
|
|
return endOfData();
|
|
@@ -839,8 +839,8 @@ public class TreeRangeSet<C extends Comparable<?>> extends AbstractRangeSet<C>
|
|
.values()
|
|
.iterator();
|
|
return new AbstractIterator<Entry<Cut<C>, Range<C>>>() {
|
|
- @Override
|
|
@CheckForNull
|
|
+ @Override
|
|
protected Entry<Cut<C>, Range<C>> computeNext() {
|
|
if (!completeRangeItr.hasNext()) {
|
|
return endOfData();
|
|
@@ -889,8 +889,8 @@ public class TreeRangeSet<C extends Comparable<?>> extends AbstractRangeSet<C>
|
|
return false;
|
|
}
|
|
|
|
- @Override
|
|
@CheckForNull
|
|
+ @Override
|
|
public Range<C> rangeContaining(C value) {
|
|
if (!restriction.contains(value)) {
|
|
return null;
|
|
diff --git a/guava/src/com/google/common/collect/TreeTraverser.java b/guava/src/com/google/common/collect/TreeTraverser.java
|
|
index b5d2a4293f..c7acb9a72f 100644
|
|
--- a/guava/src/com/google/common/collect/TreeTraverser.java
|
|
+++ b/guava/src/com/google/common/collect/TreeTraverser.java
|
|
@@ -223,8 +223,8 @@ public abstract class TreeTraverser<T> {
|
|
stack.addLast(expand(root));
|
|
}
|
|
|
|
- @Override
|
|
@CheckForNull
|
|
+ @Override
|
|
protected T computeNext() {
|
|
while (!stack.isEmpty()) {
|
|
PostOrderNode<T> top = stack.getLast();
|
|
diff --git a/guava/src/com/google/common/collect/UnmodifiableIterator.java b/guava/src/com/google/common/collect/UnmodifiableIterator.java
|
|
index 03e52aa203..eda2d8a082 100644
|
|
--- a/guava/src/com/google/common/collect/UnmodifiableIterator.java
|
|
+++ b/guava/src/com/google/common/collect/UnmodifiableIterator.java
|
|
@@ -44,8 +44,8 @@ public abstract class UnmodifiableIterator<E extends @Nullable Object> implement
|
|
* @deprecated Unsupported operation.
|
|
*/
|
|
@Deprecated
|
|
- @Override
|
|
@DoNotCall("Always throws UnsupportedOperationException")
|
|
+ @Override
|
|
public final void remove() {
|
|
throw new UnsupportedOperationException();
|
|
}
|
|
diff --git a/guava/src/com/google/common/collect/UnmodifiableListIterator.java b/guava/src/com/google/common/collect/UnmodifiableListIterator.java
|
|
index f3d3b921b7..a4e2a2b2fc 100644
|
|
--- a/guava/src/com/google/common/collect/UnmodifiableListIterator.java
|
|
+++ b/guava/src/com/google/common/collect/UnmodifiableListIterator.java
|
|
@@ -41,8 +41,8 @@ public abstract class UnmodifiableListIterator<E extends @Nullable Object>
|
|
* @deprecated Unsupported operation.
|
|
*/
|
|
@Deprecated
|
|
- @Override
|
|
@DoNotCall("Always throws UnsupportedOperationException")
|
|
+ @Override
|
|
public final void add(@ParametricNullness E e) {
|
|
throw new UnsupportedOperationException();
|
|
}
|
|
@@ -54,8 +54,8 @@ public abstract class UnmodifiableListIterator<E extends @Nullable Object>
|
|
* @deprecated Unsupported operation.
|
|
*/
|
|
@Deprecated
|
|
- @Override
|
|
@DoNotCall("Always throws UnsupportedOperationException")
|
|
+ @Override
|
|
public final void set(@ParametricNullness E e) {
|
|
throw new UnsupportedOperationException();
|
|
}
|
|
diff --git a/guava/src/com/google/common/collect/UnmodifiableSortedMultiset.java b/guava/src/com/google/common/collect/UnmodifiableSortedMultiset.java
|
|
index 31f3c71977..3553cd2f84 100644
|
|
--- a/guava/src/com/google/common/collect/UnmodifiableSortedMultiset.java
|
|
+++ b/guava/src/com/google/common/collect/UnmodifiableSortedMultiset.java
|
|
@@ -71,26 +71,26 @@ final class UnmodifiableSortedMultiset<E extends @Nullable Object> extends Unmod
|
|
return result;
|
|
}
|
|
|
|
- @Override
|
|
@CheckForNull
|
|
+ @Override
|
|
public Entry<E> firstEntry() {
|
|
return delegate().firstEntry();
|
|
}
|
|
|
|
- @Override
|
|
@CheckForNull
|
|
+ @Override
|
|
public Entry<E> lastEntry() {
|
|
return delegate().lastEntry();
|
|
}
|
|
|
|
- @Override
|
|
@CheckForNull
|
|
+ @Override
|
|
public Entry<E> pollFirstEntry() {
|
|
throw new UnsupportedOperationException();
|
|
}
|
|
|
|
- @Override
|
|
@CheckForNull
|
|
+ @Override
|
|
public Entry<E> pollLastEntry() {
|
|
throw new UnsupportedOperationException();
|
|
}
|
|
diff --git a/guava/src/com/google/common/escape/ArrayBasedCharEscaper.java b/guava/src/com/google/common/escape/ArrayBasedCharEscaper.java
|
|
index dbe6e35680..cd6c35a6fd 100644
|
|
--- a/guava/src/com/google/common/escape/ArrayBasedCharEscaper.java
|
|
+++ b/guava/src/com/google/common/escape/ArrayBasedCharEscaper.java
|
|
@@ -120,8 +120,8 @@ public abstract class ArrayBasedCharEscaper extends CharEscaper {
|
|
*
|
|
* @return the replacement characters, or {@code null} if no escaping was required
|
|
*/
|
|
- @Override
|
|
@CheckForNull
|
|
+ @Override
|
|
protected final char[] escape(char c) {
|
|
if (c < replacementsLength) {
|
|
char[] chars = replacements[c];
|
|
diff --git a/guava/src/com/google/common/escape/ArrayBasedUnicodeEscaper.java b/guava/src/com/google/common/escape/ArrayBasedUnicodeEscaper.java
|
|
index 355faaa10d..ec0e5f7f42 100644
|
|
--- a/guava/src/com/google/common/escape/ArrayBasedUnicodeEscaper.java
|
|
+++ b/guava/src/com/google/common/escape/ArrayBasedUnicodeEscaper.java
|
|
@@ -160,8 +160,8 @@ public abstract class ArrayBasedUnicodeEscaper extends UnicodeEscaper {
|
|
*
|
|
* @return the replacement characters, or {@code null} if no escaping was required
|
|
*/
|
|
- @Override
|
|
@CheckForNull
|
|
+ @Override
|
|
protected final char[] escape(int cp) {
|
|
if (cp < replacementsLength) {
|
|
char[] chars = replacements[cp];
|
|
diff --git a/guava/src/com/google/common/escape/CharEscaperBuilder.java b/guava/src/com/google/common/escape/CharEscaperBuilder.java
|
|
index 97528cb569..2bdb550521 100644
|
|
--- a/guava/src/com/google/common/escape/CharEscaperBuilder.java
|
|
+++ b/guava/src/com/google/common/escape/CharEscaperBuilder.java
|
|
@@ -65,8 +65,8 @@ public final class CharEscaperBuilder {
|
|
return s;
|
|
}
|
|
|
|
- @Override
|
|
@CheckForNull
|
|
+ @Override
|
|
protected char[] escape(char c) {
|
|
return c < replaceLength ? replacements[c] : null;
|
|
}
|
|
diff --git a/guava/src/com/google/common/escape/Escapers.java b/guava/src/com/google/common/escape/Escapers.java
|
|
index acfb82ce29..7b13e57bbe 100644
|
|
--- a/guava/src/com/google/common/escape/Escapers.java
|
|
+++ b/guava/src/com/google/common/escape/Escapers.java
|
|
@@ -51,8 +51,8 @@ public final class Escapers {
|
|
return checkNotNull(string);
|
|
}
|
|
|
|
- @Override
|
|
@CheckForNull
|
|
+ @Override
|
|
protected char[] escape(char c) {
|
|
// TODO: Fix tests not to call this directly and make it throw an error.
|
|
return null;
|
|
@@ -155,8 +155,8 @@ public final class Escapers {
|
|
private final char[] replacementChars =
|
|
unsafeReplacement != null ? unsafeReplacement.toCharArray() : null;
|
|
|
|
- @Override
|
|
@CheckForNull
|
|
+ @Override
|
|
protected char[] escapeUnsafe(char c) {
|
|
return replacementChars;
|
|
}
|
|
@@ -227,8 +227,8 @@ public final class Escapers {
|
|
/** Private helper to wrap a CharEscaper as a UnicodeEscaper. */
|
|
private static UnicodeEscaper wrap(CharEscaper escaper) {
|
|
return new UnicodeEscaper() {
|
|
- @Override
|
|
@CheckForNull
|
|
+ @Override
|
|
protected char[] escape(int cp) {
|
|
// If a code point maps to a single character, just escape that.
|
|
if (cp < Character.MIN_SUPPLEMENTARY_CODE_POINT) {
|
|
diff --git a/guava/src/com/google/common/eventbus/SubscriberRegistry.java b/guava/src/com/google/common/eventbus/SubscriberRegistry.java
|
|
index 46e982016c..70955c51fa 100644
|
|
--- a/guava/src/com/google/common/eventbus/SubscriberRegistry.java
|
|
+++ b/guava/src/com/google/common/eventbus/SubscriberRegistry.java
|
|
@@ -222,8 +222,8 @@ final class SubscriberRegistry {
|
|
.build(
|
|
new CacheLoader<Class<?>, ImmutableSet<Class<?>>>() {
|
|
// <Class<?>> is actually needed to compile
|
|
- @SuppressWarnings("RedundantTypeArguments")
|
|
@Override
|
|
+ @SuppressWarnings("RedundantTypeArguments")
|
|
public ImmutableSet<Class<?>> load(Class<?> concreteClass) {
|
|
return ImmutableSet.<Class<?>>copyOf(
|
|
TypeToken.of(concreteClass).getTypes().rawTypes());
|
|
diff --git a/guava/src/com/google/common/graph/AbstractBaseGraph.java b/guava/src/com/google/common/graph/AbstractBaseGraph.java
|
|
index 797468b7aa..dda70b8799 100644
|
|
--- a/guava/src/com/google/common/graph/AbstractBaseGraph.java
|
|
+++ b/guava/src/com/google/common/graph/AbstractBaseGraph.java
|
|
@@ -83,8 +83,8 @@ abstract class AbstractBaseGraph<N> implements BaseGraph<N> {
|
|
// Mostly safe: We check contains(u) before calling successors(u), so we perform unsafe
|
|
// operations only in weird cases like checking for an EndpointPair<ArrayList> in a
|
|
// Graph<LinkedList>.
|
|
- @SuppressWarnings("unchecked")
|
|
@Override
|
|
+ @SuppressWarnings("unchecked")
|
|
public boolean contains(@CheckForNull Object obj) {
|
|
if (!(obj instanceof EndpointPair)) {
|
|
return false;
|
|
diff --git a/guava/src/com/google/common/graph/AbstractDirectedNetworkConnections.java b/guava/src/com/google/common/graph/AbstractDirectedNetworkConnections.java
|
|
index ac452d4d61..668d066dce 100644
|
|
--- a/guava/src/com/google/common/graph/AbstractDirectedNetworkConnections.java
|
|
+++ b/guava/src/com/google/common/graph/AbstractDirectedNetworkConnections.java
|
|
@@ -20,6 +20,7 @@ import static com.google.common.base.Preconditions.checkNotNull;
|
|
import static com.google.common.base.Preconditions.checkState;
|
|
import static com.google.common.graph.Graphs.checkNonNegative;
|
|
import static com.google.common.graph.Graphs.checkPositive;
|
|
+import static java.util.Collections.unmodifiableSet;
|
|
import static java.util.Objects.requireNonNull;
|
|
|
|
import com.google.common.collect.Iterables;
|
|
@@ -28,7 +29,6 @@ import com.google.common.collect.Sets;
|
|
import com.google.common.collect.UnmodifiableIterator;
|
|
import com.google.common.math.IntMath;
|
|
import java.util.AbstractSet;
|
|
-import java.util.Collections;
|
|
import java.util.Map;
|
|
import java.util.Set;
|
|
import javax.annotation.CheckForNull;
|
|
@@ -88,12 +88,12 @@ abstract class AbstractDirectedNetworkConnections<N, E> implements NetworkConnec
|
|
|
|
@Override
|
|
public Set<E> inEdges() {
|
|
- return Collections.unmodifiableSet(inEdgeMap.keySet());
|
|
+ return unmodifiableSet(inEdgeMap.keySet());
|
|
}
|
|
|
|
@Override
|
|
public Set<E> outEdges() {
|
|
- return Collections.unmodifiableSet(outEdgeMap.keySet());
|
|
+ return unmodifiableSet(outEdgeMap.keySet());
|
|
}
|
|
|
|
@Override
|
|
diff --git a/guava/src/com/google/common/graph/AbstractNetwork.java b/guava/src/com/google/common/graph/AbstractNetwork.java
|
|
index d6bf4c36c6..cdfbaff40a 100644
|
|
--- a/guava/src/com/google/common/graph/AbstractNetwork.java
|
|
+++ b/guava/src/com/google/common/graph/AbstractNetwork.java
|
|
@@ -89,8 +89,8 @@ public abstract class AbstractNetwork<N, E> implements Network<N, E> {
|
|
// Mostly safe: We check contains(u) before calling successors(u), so we perform unsafe
|
|
// operations only in weird cases like checking for an EndpointPair<ArrayList> in a
|
|
// Network<LinkedList>.
|
|
- @SuppressWarnings("unchecked")
|
|
@Override
|
|
+ @SuppressWarnings("unchecked")
|
|
public boolean contains(@CheckForNull Object obj) {
|
|
if (!(obj instanceof EndpointPair)) {
|
|
return false;
|
|
@@ -206,8 +206,8 @@ public abstract class AbstractNetwork<N, E> implements Network<N, E> {
|
|
return edgeConnecting(endpoints.nodeU(), endpoints.nodeV());
|
|
}
|
|
|
|
- @Override
|
|
@CheckForNull
|
|
+ @Override
|
|
public E edgeConnectingOrNull(N nodeU, N nodeV) {
|
|
Set<E> edgesConnecting = edgesConnecting(nodeU, nodeV);
|
|
switch (edgesConnecting.size()) {
|
|
@@ -220,8 +220,8 @@ public abstract class AbstractNetwork<N, E> implements Network<N, E> {
|
|
}
|
|
}
|
|
|
|
- @Override
|
|
@CheckForNull
|
|
+ @Override
|
|
public E edgeConnectingOrNull(EndpointPair<N> endpoints) {
|
|
validateEndpoints(endpoints);
|
|
return edgeConnectingOrNull(endpoints.nodeU(), endpoints.nodeV());
|
|
diff --git a/guava/src/com/google/common/graph/AbstractUndirectedNetworkConnections.java b/guava/src/com/google/common/graph/AbstractUndirectedNetworkConnections.java
|
|
index 8f736d7baa..4506c1bcf2 100644
|
|
--- a/guava/src/com/google/common/graph/AbstractUndirectedNetworkConnections.java
|
|
+++ b/guava/src/com/google/common/graph/AbstractUndirectedNetworkConnections.java
|
|
@@ -18,9 +18,9 @@ package com.google.common.graph;
|
|
|
|
import static com.google.common.base.Preconditions.checkNotNull;
|
|
import static com.google.common.base.Preconditions.checkState;
|
|
+import static java.util.Collections.unmodifiableSet;
|
|
import static java.util.Objects.requireNonNull;
|
|
|
|
-import java.util.Collections;
|
|
import java.util.Map;
|
|
import java.util.Set;
|
|
import javax.annotation.CheckForNull;
|
|
@@ -53,7 +53,7 @@ abstract class AbstractUndirectedNetworkConnections<N, E> implements NetworkConn
|
|
|
|
@Override
|
|
public Set<E> incidentEdges() {
|
|
- return Collections.unmodifiableSet(incidentEdgeMap.keySet());
|
|
+ return unmodifiableSet(incidentEdgeMap.keySet());
|
|
}
|
|
|
|
@Override
|
|
@@ -72,8 +72,8 @@ abstract class AbstractUndirectedNetworkConnections<N, E> implements NetworkConn
|
|
return requireNonNull(incidentEdgeMap.get(edge));
|
|
}
|
|
|
|
- @Override
|
|
@CheckForNull
|
|
+ @Override
|
|
public N removeInEdge(E edge, boolean isSelfLoop) {
|
|
if (!isSelfLoop) {
|
|
return removeOutEdge(edge);
|
|
diff --git a/guava/src/com/google/common/graph/DirectedGraphConnections.java b/guava/src/com/google/common/graph/DirectedGraphConnections.java
|
|
index 0feb973f3f..d1ca66a52b 100644
|
|
--- a/guava/src/com/google/common/graph/DirectedGraphConnections.java
|
|
+++ b/guava/src/com/google/common/graph/DirectedGraphConnections.java
|
|
@@ -23,6 +23,7 @@ import static com.google.common.graph.GraphConstants.INNER_CAPACITY;
|
|
import static com.google.common.graph.GraphConstants.INNER_LOAD_FACTOR;
|
|
import static com.google.common.graph.Graphs.checkNonNegative;
|
|
import static com.google.common.graph.Graphs.checkPositive;
|
|
+import static java.util.Collections.unmodifiableSet;
|
|
|
|
import com.google.common.base.Function;
|
|
import com.google.common.collect.AbstractIterator;
|
|
@@ -31,7 +32,6 @@ import com.google.common.collect.Iterators;
|
|
import com.google.common.collect.UnmodifiableIterator;
|
|
import java.util.AbstractSet;
|
|
import java.util.ArrayList;
|
|
-import java.util.Collections;
|
|
import java.util.HashMap;
|
|
import java.util.HashSet;
|
|
import java.util.Iterator;
|
|
@@ -234,7 +234,7 @@ final class DirectedGraphConnections<N, V> implements GraphConnections<N, V> {
|
|
@Override
|
|
public Set<N> adjacentNodes() {
|
|
if (orderedNodeConnections == null) {
|
|
- return Collections.unmodifiableSet(adjacentNodeValues.keySet());
|
|
+ return unmodifiableSet(adjacentNodeValues.keySet());
|
|
} else {
|
|
return new AbstractSet<N>() {
|
|
@Override
|
|
@@ -242,8 +242,8 @@ final class DirectedGraphConnections<N, V> implements GraphConnections<N, V> {
|
|
Iterator<NodeConnection<N>> nodeConnections = orderedNodeConnections.iterator();
|
|
Set<N> seenNodes = new HashSet<>();
|
|
return new AbstractIterator<N>() {
|
|
- @Override
|
|
@CheckForNull
|
|
+ @Override
|
|
protected N computeNext() {
|
|
while (nodeConnections.hasNext()) {
|
|
NodeConnection<N> nodeConnection = nodeConnections.next();
|
|
@@ -278,8 +278,8 @@ final class DirectedGraphConnections<N, V> implements GraphConnections<N, V> {
|
|
if (orderedNodeConnections == null) {
|
|
Iterator<Entry<N, Object>> entries = adjacentNodeValues.entrySet().iterator();
|
|
return new AbstractIterator<N>() {
|
|
- @Override
|
|
@CheckForNull
|
|
+ @Override
|
|
protected N computeNext() {
|
|
while (entries.hasNext()) {
|
|
Entry<N, Object> entry = entries.next();
|
|
@@ -293,8 +293,8 @@ final class DirectedGraphConnections<N, V> implements GraphConnections<N, V> {
|
|
} else {
|
|
Iterator<NodeConnection<N>> nodeConnections = orderedNodeConnections.iterator();
|
|
return new AbstractIterator<N>() {
|
|
- @Override
|
|
@CheckForNull
|
|
+ @Override
|
|
protected N computeNext() {
|
|
while (nodeConnections.hasNext()) {
|
|
NodeConnection<N> nodeConnection = nodeConnections.next();
|
|
@@ -328,8 +328,8 @@ final class DirectedGraphConnections<N, V> implements GraphConnections<N, V> {
|
|
if (orderedNodeConnections == null) {
|
|
Iterator<Entry<N, Object>> entries = adjacentNodeValues.entrySet().iterator();
|
|
return new AbstractIterator<N>() {
|
|
- @Override
|
|
@CheckForNull
|
|
+ @Override
|
|
protected N computeNext() {
|
|
while (entries.hasNext()) {
|
|
Entry<N, Object> entry = entries.next();
|
|
@@ -343,8 +343,8 @@ final class DirectedGraphConnections<N, V> implements GraphConnections<N, V> {
|
|
} else {
|
|
Iterator<NodeConnection<N>> nodeConnections = orderedNodeConnections.iterator();
|
|
return new AbstractIterator<N>() {
|
|
- @Override
|
|
@CheckForNull
|
|
+ @Override
|
|
protected N computeNext() {
|
|
while (nodeConnections.hasNext()) {
|
|
NodeConnection<N> nodeConnection = nodeConnections.next();
|
|
@@ -399,8 +399,8 @@ final class DirectedGraphConnections<N, V> implements GraphConnections<N, V> {
|
|
|
|
AtomicBoolean alreadySeenSelfLoop = new AtomicBoolean(false);
|
|
return new AbstractIterator<EndpointPair<N>>() {
|
|
- @Override
|
|
@CheckForNull
|
|
+ @Override
|
|
protected EndpointPair<N> computeNext() {
|
|
while (resultWithDoubleSelfLoop.hasNext()) {
|
|
EndpointPair<N> edge = resultWithDoubleSelfLoop.next();
|
|
@@ -417,9 +417,9 @@ final class DirectedGraphConnections<N, V> implements GraphConnections<N, V> {
|
|
};
|
|
}
|
|
|
|
- @SuppressWarnings("unchecked")
|
|
- @Override
|
|
@CheckForNull
|
|
+ @Override
|
|
+ @SuppressWarnings("unchecked")
|
|
public V value(N node) {
|
|
checkNotNull(node);
|
|
Object value = adjacentNodeValues.get(node);
|
|
@@ -432,8 +432,8 @@ final class DirectedGraphConnections<N, V> implements GraphConnections<N, V> {
|
|
return (V) value;
|
|
}
|
|
|
|
- @SuppressWarnings("unchecked")
|
|
@Override
|
|
+ @SuppressWarnings("unchecked")
|
|
public void removePredecessor(N node) {
|
|
checkNotNull(node);
|
|
|
|
@@ -459,9 +459,9 @@ final class DirectedGraphConnections<N, V> implements GraphConnections<N, V> {
|
|
}
|
|
}
|
|
|
|
- @SuppressWarnings("unchecked")
|
|
- @Override
|
|
@CheckForNull
|
|
+ @Override
|
|
+ @SuppressWarnings("unchecked")
|
|
public V removeSuccessor(Object node) {
|
|
checkNotNull(node);
|
|
Object previousValue = adjacentNodeValues.get(node);
|
|
@@ -523,9 +523,9 @@ final class DirectedGraphConnections<N, V> implements GraphConnections<N, V> {
|
|
}
|
|
}
|
|
|
|
- @SuppressWarnings("unchecked")
|
|
- @Override
|
|
@CheckForNull
|
|
+ @Override
|
|
+ @SuppressWarnings("unchecked")
|
|
public V addSuccessor(N node, V value) {
|
|
Object previousValue = adjacentNodeValues.put(node, value);
|
|
Object previousSuccessor;
|
|
diff --git a/guava/src/com/google/common/graph/DirectedMultiNetworkConnections.java b/guava/src/com/google/common/graph/DirectedMultiNetworkConnections.java
|
|
index bd0e546f26..341c91248d 100644
|
|
--- a/guava/src/com/google/common/graph/DirectedMultiNetworkConnections.java
|
|
+++ b/guava/src/com/google/common/graph/DirectedMultiNetworkConnections.java
|
|
@@ -19,14 +19,13 @@ package com.google.common.graph;
|
|
import static com.google.common.base.Preconditions.checkState;
|
|
import static com.google.common.graph.GraphConstants.INNER_CAPACITY;
|
|
import static com.google.common.graph.GraphConstants.INNER_LOAD_FACTOR;
|
|
+import static java.util.Collections.unmodifiableSet;
|
|
|
|
import com.google.common.collect.HashMultiset;
|
|
-import com.google.common.collect.ImmutableMap;
|
|
import com.google.common.collect.Multiset;
|
|
import com.google.errorprone.annotations.concurrent.LazyInit;
|
|
import java.lang.ref.Reference;
|
|
import java.lang.ref.SoftReference;
|
|
-import java.util.Collections;
|
|
import java.util.HashMap;
|
|
import java.util.Map;
|
|
import java.util.Set;
|
|
@@ -56,15 +55,14 @@ final class DirectedMultiNetworkConnections<N, E> extends AbstractDirectedNetwor
|
|
|
|
static <N, E> DirectedMultiNetworkConnections<N, E> ofImmutable(
|
|
Map<E, N> inEdges, Map<E, N> outEdges, int selfLoopCount) {
|
|
- return new DirectedMultiNetworkConnections<>(
|
|
- ImmutableMap.copyOf(inEdges), ImmutableMap.copyOf(outEdges), selfLoopCount);
|
|
+ return new DirectedMultiNetworkConnections<>(inEdges, outEdges, selfLoopCount);
|
|
}
|
|
|
|
@CheckForNull @LazyInit private transient Reference<Multiset<N>> predecessorsReference;
|
|
|
|
@Override
|
|
public Set<N> predecessors() {
|
|
- return Collections.unmodifiableSet(predecessorsMultiset().elementSet());
|
|
+ return unmodifiableSet(predecessorsMultiset().elementSet());
|
|
}
|
|
|
|
private Multiset<N> predecessorsMultiset() {
|
|
@@ -80,7 +78,7 @@ final class DirectedMultiNetworkConnections<N, E> extends AbstractDirectedNetwor
|
|
|
|
@Override
|
|
public Set<N> successors() {
|
|
- return Collections.unmodifiableSet(successorsMultiset().elementSet());
|
|
+ return unmodifiableSet(successorsMultiset().elementSet());
|
|
}
|
|
|
|
private Multiset<N> successorsMultiset() {
|
|
diff --git a/guava/src/com/google/common/graph/DirectedNetworkConnections.java b/guava/src/com/google/common/graph/DirectedNetworkConnections.java
|
|
index 9d70c790ee..65f1a80e3b 100644
|
|
--- a/guava/src/com/google/common/graph/DirectedNetworkConnections.java
|
|
+++ b/guava/src/com/google/common/graph/DirectedNetworkConnections.java
|
|
@@ -17,11 +17,11 @@
|
|
package com.google.common.graph;
|
|
|
|
import static com.google.common.graph.GraphConstants.EXPECTED_DEGREE;
|
|
+import static java.util.Collections.unmodifiableSet;
|
|
|
|
import com.google.common.collect.BiMap;
|
|
import com.google.common.collect.HashBiMap;
|
|
import com.google.common.collect.ImmutableBiMap;
|
|
-import java.util.Collections;
|
|
import java.util.Map;
|
|
import java.util.Set;
|
|
|
|
@@ -53,12 +53,12 @@ final class DirectedNetworkConnections<N, E> extends AbstractDirectedNetworkConn
|
|
|
|
@Override
|
|
public Set<N> predecessors() {
|
|
- return Collections.unmodifiableSet(((BiMap<E, N>) inEdgeMap).values());
|
|
+ return unmodifiableSet(((BiMap<E, N>) inEdgeMap).values());
|
|
}
|
|
|
|
@Override
|
|
public Set<N> successors() {
|
|
- return Collections.unmodifiableSet(((BiMap<E, N>) outEdgeMap).values());
|
|
+ return unmodifiableSet(((BiMap<E, N>) outEdgeMap).values());
|
|
}
|
|
|
|
@Override
|
|
diff --git a/guava/src/com/google/common/graph/EndpointPair.java b/guava/src/com/google/common/graph/EndpointPair.java
|
|
index fe2397c6b9..bccfda16ea 100644
|
|
--- a/guava/src/com/google/common/graph/EndpointPair.java
|
|
+++ b/guava/src/com/google/common/graph/EndpointPair.java
|
|
@@ -38,7 +38,7 @@ import javax.annotation.CheckForNull;
|
|
* @since 20.0
|
|
*/
|
|
@Beta
|
|
-@Immutable(containerOf = {"N"})
|
|
+@Immutable(containerOf = "N")
|
|
@ElementTypesAreNonnullByDefault
|
|
public abstract class EndpointPair<N> implements Iterable<N> {
|
|
private final N nodeU;
|
|
diff --git a/guava/src/com/google/common/graph/EndpointPairIterator.java b/guava/src/com/google/common/graph/EndpointPairIterator.java
|
|
index 7096dbe3da..b501236378 100644
|
|
--- a/guava/src/com/google/common/graph/EndpointPairIterator.java
|
|
+++ b/guava/src/com/google/common/graph/EndpointPairIterator.java
|
|
@@ -74,8 +74,8 @@ abstract class EndpointPairIterator<N> extends AbstractIterator<EndpointPair<N>>
|
|
super(graph);
|
|
}
|
|
|
|
- @Override
|
|
@CheckForNull
|
|
+ @Override
|
|
protected EndpointPair<N> computeNext() {
|
|
while (true) {
|
|
if (successorIterator.hasNext()) {
|
|
@@ -124,8 +124,8 @@ abstract class EndpointPairIterator<N> extends AbstractIterator<EndpointPair<N>>
|
|
this.visitedNodes = Sets.newHashSetWithExpectedSize(graph.nodes().size() + 1);
|
|
}
|
|
|
|
- @Override
|
|
@CheckForNull
|
|
+ @Override
|
|
protected EndpointPair<N> computeNext() {
|
|
while (true) {
|
|
/*
|
|
diff --git a/guava/src/com/google/common/graph/ForwardingNetwork.java b/guava/src/com/google/common/graph/ForwardingNetwork.java
|
|
index 9f1c6e7702..dc0e010253 100644
|
|
--- a/guava/src/com/google/common/graph/ForwardingNetwork.java
|
|
+++ b/guava/src/com/google/common/graph/ForwardingNetwork.java
|
|
@@ -142,14 +142,14 @@ abstract class ForwardingNetwork<N, E> extends AbstractNetwork<N, E> {
|
|
return delegate().edgeConnecting(endpoints);
|
|
}
|
|
|
|
- @Override
|
|
@CheckForNull
|
|
+ @Override
|
|
public E edgeConnectingOrNull(N nodeU, N nodeV) {
|
|
return delegate().edgeConnectingOrNull(nodeU, nodeV);
|
|
}
|
|
|
|
- @Override
|
|
@CheckForNull
|
|
+ @Override
|
|
public E edgeConnectingOrNull(EndpointPair<N> endpoints) {
|
|
return delegate().edgeConnectingOrNull(endpoints);
|
|
}
|
|
diff --git a/guava/src/com/google/common/graph/ForwardingValueGraph.java b/guava/src/com/google/common/graph/ForwardingValueGraph.java
|
|
index fcd5d28bc3..871ecfb1b5 100644
|
|
--- a/guava/src/com/google/common/graph/ForwardingValueGraph.java
|
|
+++ b/guava/src/com/google/common/graph/ForwardingValueGraph.java
|
|
@@ -116,14 +116,14 @@ abstract class ForwardingValueGraph<N, V> extends AbstractValueGraph<N, V> {
|
|
return delegate().edgeValue(endpoints);
|
|
}
|
|
|
|
- @Override
|
|
@CheckForNull
|
|
+ @Override
|
|
public V edgeValueOrDefault(N nodeU, N nodeV, @CheckForNull V defaultValue) {
|
|
return delegate().edgeValueOrDefault(nodeU, nodeV, defaultValue);
|
|
}
|
|
|
|
- @Override
|
|
@CheckForNull
|
|
+ @Override
|
|
public V edgeValueOrDefault(EndpointPair<N> endpoints, @CheckForNull V defaultValue) {
|
|
return delegate().edgeValueOrDefault(endpoints, defaultValue);
|
|
}
|
|
diff --git a/guava/src/com/google/common/graph/Graphs.java b/guava/src/com/google/common/graph/Graphs.java
|
|
index 6ab9f56615..7576fe0374 100644
|
|
--- a/guava/src/com/google/common/graph/Graphs.java
|
|
+++ b/guava/src/com/google/common/graph/Graphs.java
|
|
@@ -374,14 +374,14 @@ public final class Graphs {
|
|
return delegate().edgeValue(transpose(endpoints));
|
|
}
|
|
|
|
- @Override
|
|
@CheckForNull
|
|
+ @Override
|
|
public V edgeValueOrDefault(N nodeU, N nodeV, @CheckForNull V defaultValue) {
|
|
return delegate().edgeValueOrDefault(nodeV, nodeU, defaultValue); // transpose
|
|
}
|
|
|
|
- @Override
|
|
@CheckForNull
|
|
+ @Override
|
|
public V edgeValueOrDefault(EndpointPair<N> endpoints, @CheckForNull V defaultValue) {
|
|
return delegate().edgeValueOrDefault(transpose(endpoints), defaultValue);
|
|
}
|
|
@@ -455,14 +455,14 @@ public final class Graphs {
|
|
return delegate().edgeConnecting(transpose(endpoints));
|
|
}
|
|
|
|
- @Override
|
|
@CheckForNull
|
|
+ @Override
|
|
public E edgeConnectingOrNull(N nodeU, N nodeV) {
|
|
return delegate().edgeConnectingOrNull(nodeV, nodeU); // transpose
|
|
}
|
|
|
|
- @Override
|
|
@CheckForNull
|
|
+ @Override
|
|
public E edgeConnectingOrNull(EndpointPair<N> endpoints) {
|
|
return delegate().edgeConnectingOrNull(transpose(endpoints));
|
|
}
|
|
diff --git a/guava/src/com/google/common/graph/ImmutableGraph.java b/guava/src/com/google/common/graph/ImmutableGraph.java
|
|
index f829e96999..0fc2536be9 100644
|
|
--- a/guava/src/com/google/common/graph/ImmutableGraph.java
|
|
+++ b/guava/src/com/google/common/graph/ImmutableGraph.java
|
|
@@ -44,7 +44,7 @@ import com.google.errorprone.annotations.Immutable;
|
|
* @since 20.0
|
|
*/
|
|
@Beta
|
|
-@Immutable(containerOf = {"N"})
|
|
+@Immutable(containerOf = "N")
|
|
@ElementTypesAreNonnullByDefault
|
|
public class ImmutableGraph<N> extends ForwardingGraph<N> {
|
|
@SuppressWarnings("Immutable") // The backing graph must be immutable.
|
|
diff --git a/guava/src/com/google/common/graph/ImmutableNetwork.java b/guava/src/com/google/common/graph/ImmutableNetwork.java
|
|
index c29f8a3928..9519593680 100644
|
|
--- a/guava/src/com/google/common/graph/ImmutableNetwork.java
|
|
+++ b/guava/src/com/google/common/graph/ImmutableNetwork.java
|
|
@@ -44,7 +44,7 @@ import java.util.Map;
|
|
* @since 20.0
|
|
*/
|
|
@Beta
|
|
-@Immutable(containerOf = {"N", "E"})
|
|
+@Immutable(containerOf = {"E", "N"})
|
|
@SuppressWarnings("Immutable") // Extends StandardNetwork but uses ImmutableMaps.
|
|
@ElementTypesAreNonnullByDefault
|
|
public final class ImmutableNetwork<N, E> extends StandardNetwork<N, E> {
|
|
diff --git a/guava/src/com/google/common/graph/MapRetrievalCache.java b/guava/src/com/google/common/graph/MapRetrievalCache.java
|
|
index ada78f2841..02c24e8d33 100644
|
|
--- a/guava/src/com/google/common/graph/MapRetrievalCache.java
|
|
+++ b/guava/src/com/google/common/graph/MapRetrievalCache.java
|
|
@@ -37,9 +37,9 @@ final class MapRetrievalCache<K, V> extends MapIteratorCache<K, V> {
|
|
super(backingMap);
|
|
}
|
|
|
|
- @SuppressWarnings("unchecked") // Safe because we only cast if key is found in map.
|
|
+ @CheckForNull // Safe because we only cast if key is found in map.
|
|
@Override
|
|
- @CheckForNull
|
|
+ @SuppressWarnings("unchecked")
|
|
V get(Object key) {
|
|
checkNotNull(key);
|
|
V value = getIfCached(key);
|
|
@@ -56,8 +56,8 @@ final class MapRetrievalCache<K, V> extends MapIteratorCache<K, V> {
|
|
|
|
// Internal methods (package-visible, but treat as only subclass-visible)
|
|
|
|
- @Override
|
|
@CheckForNull
|
|
+ @Override
|
|
V getIfCached(@CheckForNull Object key) {
|
|
V value = super.getIfCached(key);
|
|
if (value != null) {
|
|
diff --git a/guava/src/com/google/common/graph/MultiEdgesConnecting.java b/guava/src/com/google/common/graph/MultiEdgesConnecting.java
|
|
index 620f986a55..a0a3fcfca2 100644
|
|
--- a/guava/src/com/google/common/graph/MultiEdgesConnecting.java
|
|
+++ b/guava/src/com/google/common/graph/MultiEdgesConnecting.java
|
|
@@ -50,8 +50,8 @@ abstract class MultiEdgesConnecting<E> extends AbstractSet<E> {
|
|
public UnmodifiableIterator<E> iterator() {
|
|
Iterator<? extends Entry<E, ?>> entries = outEdgeToNode.entrySet().iterator();
|
|
return new AbstractIterator<E>() {
|
|
- @Override
|
|
@CheckForNull
|
|
+ @Override
|
|
protected E computeNext() {
|
|
while (entries.hasNext()) {
|
|
Entry<E, ?> entry = entries.next();
|
|
diff --git a/guava/src/com/google/common/graph/StandardMutableNetwork.java b/guava/src/com/google/common/graph/StandardMutableNetwork.java
|
|
index c58b6d3909..d8c464682f 100644
|
|
--- a/guava/src/com/google/common/graph/StandardMutableNetwork.java
|
|
+++ b/guava/src/com/google/common/graph/StandardMutableNetwork.java
|
|
@@ -49,8 +49,8 @@ final class StandardMutableNetwork<N, E> extends StandardNetwork<N, E>
|
|
super(builder);
|
|
}
|
|
|
|
- @Override
|
|
@CanIgnoreReturnValue
|
|
+ @Override
|
|
public boolean addNode(N node) {
|
|
checkNotNull(node, "node");
|
|
|
|
@@ -74,8 +74,8 @@ final class StandardMutableNetwork<N, E> extends StandardNetwork<N, E>
|
|
return connections;
|
|
}
|
|
|
|
- @Override
|
|
@CanIgnoreReturnValue
|
|
+ @Override
|
|
public boolean addEdge(N nodeU, N nodeV, E edge) {
|
|
checkNotNull(nodeU, "nodeU");
|
|
checkNotNull(nodeV, "nodeV");
|
|
@@ -118,15 +118,15 @@ final class StandardMutableNetwork<N, E> extends StandardNetwork<N, E>
|
|
return true;
|
|
}
|
|
|
|
- @Override
|
|
@CanIgnoreReturnValue
|
|
+ @Override
|
|
public boolean addEdge(EndpointPair<N> endpoints, E edge) {
|
|
validateEndpoints(endpoints);
|
|
return addEdge(endpoints.nodeU(), endpoints.nodeV(), edge);
|
|
}
|
|
|
|
- @Override
|
|
@CanIgnoreReturnValue
|
|
+ @Override
|
|
public boolean removeNode(N node) {
|
|
checkNotNull(node, "node");
|
|
|
|
@@ -144,8 +144,8 @@ final class StandardMutableNetwork<N, E> extends StandardNetwork<N, E>
|
|
return true;
|
|
}
|
|
|
|
- @Override
|
|
@CanIgnoreReturnValue
|
|
+ @Override
|
|
public boolean removeEdge(E edge) {
|
|
checkNotNull(edge, "edge");
|
|
|
|
diff --git a/guava/src/com/google/common/graph/StandardMutableValueGraph.java b/guava/src/com/google/common/graph/StandardMutableValueGraph.java
|
|
index 0ea641a5b1..bf00e2108a 100644
|
|
--- a/guava/src/com/google/common/graph/StandardMutableValueGraph.java
|
|
+++ b/guava/src/com/google/common/graph/StandardMutableValueGraph.java
|
|
@@ -57,8 +57,8 @@ final class StandardMutableValueGraph<N, V> extends StandardValueGraph<N, V>
|
|
return incidentEdgeOrder;
|
|
}
|
|
|
|
- @Override
|
|
@CanIgnoreReturnValue
|
|
+ @Override
|
|
public boolean addNode(N node) {
|
|
checkNotNull(node, "node");
|
|
|
|
@@ -82,9 +82,9 @@ final class StandardMutableValueGraph<N, V> extends StandardValueGraph<N, V>
|
|
return connections;
|
|
}
|
|
|
|
- @Override
|
|
@CanIgnoreReturnValue
|
|
@CheckForNull
|
|
+ @Override
|
|
public V putEdgeValue(N nodeU, N nodeV, V value) {
|
|
checkNotNull(nodeU, "nodeU");
|
|
checkNotNull(nodeV, "nodeV");
|
|
@@ -110,16 +110,16 @@ final class StandardMutableValueGraph<N, V> extends StandardValueGraph<N, V>
|
|
return previousValue;
|
|
}
|
|
|
|
- @Override
|
|
@CanIgnoreReturnValue
|
|
@CheckForNull
|
|
+ @Override
|
|
public V putEdgeValue(EndpointPair<N> endpoints, V value) {
|
|
validateEndpoints(endpoints);
|
|
return putEdgeValue(endpoints.nodeU(), endpoints.nodeV(), value);
|
|
}
|
|
|
|
- @Override
|
|
@CanIgnoreReturnValue
|
|
+ @Override
|
|
public boolean removeNode(N node) {
|
|
checkNotNull(node, "node");
|
|
|
|
@@ -155,9 +155,9 @@ final class StandardMutableValueGraph<N, V> extends StandardValueGraph<N, V>
|
|
return true;
|
|
}
|
|
|
|
- @Override
|
|
@CanIgnoreReturnValue
|
|
@CheckForNull
|
|
+ @Override
|
|
public V removeEdge(N nodeU, N nodeV) {
|
|
checkNotNull(nodeU, "nodeU");
|
|
checkNotNull(nodeV, "nodeV");
|
|
@@ -176,9 +176,9 @@ final class StandardMutableValueGraph<N, V> extends StandardValueGraph<N, V>
|
|
return previousValue;
|
|
}
|
|
|
|
- @Override
|
|
@CanIgnoreReturnValue
|
|
@CheckForNull
|
|
+ @Override
|
|
public V removeEdge(EndpointPair<N> endpoints) {
|
|
validateEndpoints(endpoints);
|
|
return removeEdge(endpoints.nodeU(), endpoints.nodeV());
|
|
diff --git a/guava/src/com/google/common/graph/StandardValueGraph.java b/guava/src/com/google/common/graph/StandardValueGraph.java
|
|
index ab3ae582b5..5e1f894060 100644
|
|
--- a/guava/src/com/google/common/graph/StandardValueGraph.java
|
|
+++ b/guava/src/com/google/common/graph/StandardValueGraph.java
|
|
@@ -140,14 +140,14 @@ class StandardValueGraph<N, V> extends AbstractValueGraph<N, V> {
|
|
&& hasEdgeConnectingInternal(endpoints.nodeU(), endpoints.nodeV());
|
|
}
|
|
|
|
- @Override
|
|
@CheckForNull
|
|
+ @Override
|
|
public V edgeValueOrDefault(N nodeU, N nodeV, @CheckForNull V defaultValue) {
|
|
return edgeValueOrDefaultInternal(checkNotNull(nodeU), checkNotNull(nodeV), defaultValue);
|
|
}
|
|
|
|
- @Override
|
|
@CheckForNull
|
|
+ @Override
|
|
public V edgeValueOrDefault(EndpointPair<N> endpoints, @CheckForNull V defaultValue) {
|
|
validateEndpoints(endpoints);
|
|
return edgeValueOrDefaultInternal(endpoints.nodeU(), endpoints.nodeV(), defaultValue);
|
|
diff --git a/guava/src/com/google/common/graph/Traverser.java b/guava/src/com/google/common/graph/Traverser.java
|
|
index fb594b4403..ce3037cbb8 100644
|
|
--- a/guava/src/com/google/common/graph/Traverser.java
|
|
+++ b/guava/src/com/google/common/graph/Traverser.java
|
|
@@ -384,8 +384,8 @@ public abstract class Traverser<N> {
|
|
static <N> Traversal<N> inGraph(SuccessorsFunction<N> graph) {
|
|
Set<N> visited = new HashSet<>();
|
|
return new Traversal<N>(graph) {
|
|
- @Override
|
|
@CheckForNull
|
|
+ @Override
|
|
N visitNext(Deque<Iterator<? extends N>> horizon) {
|
|
Iterator<? extends N> top = horizon.getFirst();
|
|
while (top.hasNext()) {
|
|
@@ -442,8 +442,8 @@ public abstract class Traverser<N> {
|
|
Deque<Iterator<? extends N>> horizon = new ArrayDeque<>();
|
|
horizon.add(startNodes);
|
|
return new AbstractIterator<N>() {
|
|
- @Override
|
|
@CheckForNull
|
|
+ @Override
|
|
protected N computeNext() {
|
|
do {
|
|
N next = visitNext(horizon);
|
|
@@ -467,8 +467,8 @@ public abstract class Traverser<N> {
|
|
Deque<Iterator<? extends N>> horizon = new ArrayDeque<>();
|
|
horizon.add(startNodes);
|
|
return new AbstractIterator<N>() {
|
|
- @Override
|
|
@CheckForNull
|
|
+ @Override
|
|
protected N computeNext() {
|
|
for (N next = visitNext(horizon); next != null; next = visitNext(horizon)) {
|
|
Iterator<? extends N> successors = successorFunction.successors(next).iterator();
|
|
diff --git a/guava/src/com/google/common/graph/UndirectedGraphConnections.java b/guava/src/com/google/common/graph/UndirectedGraphConnections.java
|
|
index 4eeb2328fe..7a07f72ed9 100644
|
|
--- a/guava/src/com/google/common/graph/UndirectedGraphConnections.java
|
|
+++ b/guava/src/com/google/common/graph/UndirectedGraphConnections.java
|
|
@@ -19,10 +19,9 @@ package com.google.common.graph;
|
|
import static com.google.common.base.Preconditions.checkNotNull;
|
|
import static com.google.common.graph.GraphConstants.INNER_CAPACITY;
|
|
import static com.google.common.graph.GraphConstants.INNER_LOAD_FACTOR;
|
|
+import static java.util.Collections.unmodifiableSet;
|
|
|
|
-import com.google.common.collect.ImmutableMap;
|
|
import com.google.common.collect.Iterators;
|
|
-import java.util.Collections;
|
|
import java.util.HashMap;
|
|
import java.util.Iterator;
|
|
import java.util.LinkedHashMap;
|
|
@@ -59,12 +58,12 @@ final class UndirectedGraphConnections<N, V> implements GraphConnections<N, V> {
|
|
}
|
|
|
|
static <N, V> UndirectedGraphConnections<N, V> ofImmutable(Map<N, V> adjacentNodeValues) {
|
|
- return new UndirectedGraphConnections<>(ImmutableMap.copyOf(adjacentNodeValues));
|
|
+ return new UndirectedGraphConnections<>(adjacentNodeValues);
|
|
}
|
|
|
|
@Override
|
|
public Set<N> adjacentNodes() {
|
|
- return Collections.unmodifiableSet(adjacentNodeValues.keySet());
|
|
+ return unmodifiableSet(adjacentNodeValues.keySet());
|
|
}
|
|
|
|
@Override
|
|
@@ -84,8 +83,8 @@ final class UndirectedGraphConnections<N, V> implements GraphConnections<N, V> {
|
|
(N incidentNode) -> EndpointPair.unordered(thisNode, incidentNode));
|
|
}
|
|
|
|
- @Override
|
|
@CheckForNull
|
|
+ @Override
|
|
public V value(N node) {
|
|
return adjacentNodeValues.get(node);
|
|
}
|
|
@@ -96,8 +95,8 @@ final class UndirectedGraphConnections<N, V> implements GraphConnections<N, V> {
|
|
V unused = removeSuccessor(node);
|
|
}
|
|
|
|
- @Override
|
|
@CheckForNull
|
|
+ @Override
|
|
public V removeSuccessor(N node) {
|
|
return adjacentNodeValues.remove(node);
|
|
}
|
|
@@ -108,8 +107,8 @@ final class UndirectedGraphConnections<N, V> implements GraphConnections<N, V> {
|
|
V unused = addSuccessor(node, value);
|
|
}
|
|
|
|
- @Override
|
|
@CheckForNull
|
|
+ @Override
|
|
public V addSuccessor(N node, V value) {
|
|
return adjacentNodeValues.put(node, value);
|
|
}
|
|
diff --git a/guava/src/com/google/common/graph/UndirectedMultiNetworkConnections.java b/guava/src/com/google/common/graph/UndirectedMultiNetworkConnections.java
|
|
index 6caac3b715..29e0d29544 100644
|
|
--- a/guava/src/com/google/common/graph/UndirectedMultiNetworkConnections.java
|
|
+++ b/guava/src/com/google/common/graph/UndirectedMultiNetworkConnections.java
|
|
@@ -19,14 +19,13 @@ package com.google.common.graph;
|
|
import static com.google.common.base.Preconditions.checkState;
|
|
import static com.google.common.graph.GraphConstants.INNER_CAPACITY;
|
|
import static com.google.common.graph.GraphConstants.INNER_LOAD_FACTOR;
|
|
+import static java.util.Collections.unmodifiableSet;
|
|
|
|
import com.google.common.collect.HashMultiset;
|
|
-import com.google.common.collect.ImmutableMap;
|
|
import com.google.common.collect.Multiset;
|
|
import com.google.errorprone.annotations.concurrent.LazyInit;
|
|
import java.lang.ref.Reference;
|
|
import java.lang.ref.SoftReference;
|
|
-import java.util.Collections;
|
|
import java.util.HashMap;
|
|
import java.util.Map;
|
|
import java.util.Set;
|
|
@@ -53,14 +52,14 @@ final class UndirectedMultiNetworkConnections<N, E>
|
|
}
|
|
|
|
static <N, E> UndirectedMultiNetworkConnections<N, E> ofImmutable(Map<E, N> incidentEdges) {
|
|
- return new UndirectedMultiNetworkConnections<>(ImmutableMap.copyOf(incidentEdges));
|
|
+ return new UndirectedMultiNetworkConnections<>(incidentEdges);
|
|
}
|
|
|
|
@CheckForNull @LazyInit private transient Reference<Multiset<N>> adjacentNodesReference;
|
|
|
|
@Override
|
|
public Set<N> adjacentNodes() {
|
|
- return Collections.unmodifiableSet(adjacentNodesMultiset().elementSet());
|
|
+ return unmodifiableSet(adjacentNodesMultiset().elementSet());
|
|
}
|
|
|
|
private Multiset<N> adjacentNodesMultiset() {
|
|
@@ -82,8 +81,8 @@ final class UndirectedMultiNetworkConnections<N, E>
|
|
};
|
|
}
|
|
|
|
- @Override
|
|
@CheckForNull
|
|
+ @Override
|
|
public N removeInEdge(E edge, boolean isSelfLoop) {
|
|
if (!isSelfLoop) {
|
|
return removeOutEdge(edge);
|
|
diff --git a/guava/src/com/google/common/graph/UndirectedNetworkConnections.java b/guava/src/com/google/common/graph/UndirectedNetworkConnections.java
|
|
index f11f98867c..f8aa0ec66c 100644
|
|
--- a/guava/src/com/google/common/graph/UndirectedNetworkConnections.java
|
|
+++ b/guava/src/com/google/common/graph/UndirectedNetworkConnections.java
|
|
@@ -17,11 +17,11 @@
|
|
package com.google.common.graph;
|
|
|
|
import static com.google.common.graph.GraphConstants.EXPECTED_DEGREE;
|
|
+import static java.util.Collections.unmodifiableSet;
|
|
|
|
import com.google.common.collect.BiMap;
|
|
import com.google.common.collect.HashBiMap;
|
|
import com.google.common.collect.ImmutableBiMap;
|
|
-import java.util.Collections;
|
|
import java.util.Map;
|
|
import java.util.Set;
|
|
|
|
@@ -50,7 +50,7 @@ final class UndirectedNetworkConnections<N, E> extends AbstractUndirectedNetwork
|
|
|
|
@Override
|
|
public Set<N> adjacentNodes() {
|
|
- return Collections.unmodifiableSet(((BiMap<E, N>) incidentEdgeMap).values());
|
|
+ return unmodifiableSet(((BiMap<E, N>) incidentEdgeMap).values());
|
|
}
|
|
|
|
@Override
|
|
diff --git a/guava/src/com/google/common/hash/AbstractHasher.java b/guava/src/com/google/common/hash/AbstractHasher.java
|
|
index c72e05be05..9afd67b475 100644
|
|
--- a/guava/src/com/google/common/hash/AbstractHasher.java
|
|
+++ b/guava/src/com/google/common/hash/AbstractHasher.java
|
|
@@ -14,7 +14,8 @@
|
|
|
|
package com.google.common.hash;
|
|
|
|
-import com.google.common.base.Preconditions;
|
|
+import static com.google.common.base.Preconditions.checkPositionIndexes;
|
|
+
|
|
import com.google.errorprone.annotations.CanIgnoreReturnValue;
|
|
import java.nio.ByteBuffer;
|
|
import java.nio.charset.Charset;
|
|
@@ -64,7 +65,7 @@ abstract class AbstractHasher implements Hasher {
|
|
|
|
@Override
|
|
public Hasher putBytes(byte[] bytes, int off, int len) {
|
|
- Preconditions.checkPositionIndexes(off, off + len, bytes.length);
|
|
+ checkPositionIndexes(off, off + len, bytes.length);
|
|
for (int i = 0; i < len; i++) {
|
|
putByte(bytes[off + i]);
|
|
}
|
|
diff --git a/guava/src/com/google/common/hash/AbstractNonStreamingHashFunction.java b/guava/src/com/google/common/hash/AbstractNonStreamingHashFunction.java
|
|
index 4969e35b22..8b579410df 100644
|
|
--- a/guava/src/com/google/common/hash/AbstractNonStreamingHashFunction.java
|
|
+++ b/guava/src/com/google/common/hash/AbstractNonStreamingHashFunction.java
|
|
@@ -14,7 +14,8 @@
|
|
|
|
package com.google.common.hash;
|
|
|
|
-import com.google.common.base.Preconditions;
|
|
+import static com.google.common.base.Preconditions.checkArgument;
|
|
+
|
|
import com.google.errorprone.annotations.Immutable;
|
|
import java.io.ByteArrayOutputStream;
|
|
import java.nio.ByteBuffer;
|
|
@@ -39,7 +40,7 @@ abstract class AbstractNonStreamingHashFunction extends AbstractHashFunction {
|
|
|
|
@Override
|
|
public Hasher newHasher(int expectedInputSize) {
|
|
- Preconditions.checkArgument(expectedInputSize >= 0);
|
|
+ checkArgument(expectedInputSize >= 0);
|
|
return new BufferingHasher(expectedInputSize);
|
|
}
|
|
|
|
diff --git a/guava/src/com/google/common/hash/Fingerprint2011.java b/guava/src/com/google/common/hash/Fingerprint2011.java
|
|
index 1b01e00924..ff5ee5088e 100644
|
|
--- a/guava/src/com/google/common/hash/Fingerprint2011.java
|
|
+++ b/guava/src/com/google/common/hash/Fingerprint2011.java
|
|
@@ -192,7 +192,6 @@ final class Fingerprint2011 extends AbstractNonStreamingHashFunction {
|
|
}
|
|
|
|
hash = shiftMix(hash) * mul;
|
|
- hash = shiftMix(hash);
|
|
- return hash;
|
|
+ return shiftMix(hash);
|
|
}
|
|
}
|
|
diff --git a/guava/src/com/google/common/hash/Funnels.java b/guava/src/com/google/common/hash/Funnels.java
|
|
index b8e63d504d..f6f2b34b6a 100644
|
|
--- a/guava/src/com/google/common/hash/Funnels.java
|
|
+++ b/guava/src/com/google/common/hash/Funnels.java
|
|
@@ -14,8 +14,9 @@
|
|
|
|
package com.google.common.hash;
|
|
|
|
+import static com.google.common.base.Preconditions.checkNotNull;
|
|
+
|
|
import com.google.common.annotations.Beta;
|
|
-import com.google.common.base.Preconditions;
|
|
import java.io.OutputStream;
|
|
import java.io.Serializable;
|
|
import java.nio.charset.Charset;
|
|
@@ -91,7 +92,7 @@ public final class Funnels {
|
|
private final Charset charset;
|
|
|
|
StringCharsetFunnel(Charset charset) {
|
|
- this.charset = Preconditions.checkNotNull(charset);
|
|
+ this.charset = checkNotNull(charset);
|
|
}
|
|
|
|
@Override
|
|
@@ -176,7 +177,7 @@ public final class Funnels {
|
|
private final Funnel<E> elementFunnel;
|
|
|
|
SequentialFunnel(Funnel<E> elementFunnel) {
|
|
- this.elementFunnel = Preconditions.checkNotNull(elementFunnel);
|
|
+ this.elementFunnel = checkNotNull(elementFunnel);
|
|
}
|
|
|
|
@Override
|
|
@@ -247,7 +248,7 @@ public final class Funnels {
|
|
final PrimitiveSink sink;
|
|
|
|
SinkAsStream(PrimitiveSink sink) {
|
|
- this.sink = Preconditions.checkNotNull(sink);
|
|
+ this.sink = checkNotNull(sink);
|
|
}
|
|
|
|
@Override
|
|
diff --git a/guava/src/com/google/common/hash/HashCode.java b/guava/src/com/google/common/hash/HashCode.java
|
|
index fde2a86d64..fc1e9ee0dd 100644
|
|
--- a/guava/src/com/google/common/hash/HashCode.java
|
|
+++ b/guava/src/com/google/common/hash/HashCode.java
|
|
@@ -16,9 +16,9 @@ package com.google.common.hash;
|
|
|
|
import static com.google.common.base.Preconditions.checkArgument;
|
|
import static com.google.common.base.Preconditions.checkNotNull;
|
|
+import static com.google.common.base.Preconditions.checkPositionIndexes;
|
|
import static com.google.common.base.Preconditions.checkState;
|
|
|
|
-import com.google.common.base.Preconditions;
|
|
import com.google.common.primitives.Ints;
|
|
import com.google.common.primitives.UnsignedInts;
|
|
import com.google.errorprone.annotations.CanIgnoreReturnValue;
|
|
@@ -84,7 +84,7 @@ public abstract class HashCode {
|
|
@CanIgnoreReturnValue
|
|
public int writeBytesTo(byte[] dest, int offset, int maxLength) {
|
|
maxLength = Ints.min(maxLength, bits() / 8);
|
|
- Preconditions.checkPositionIndexes(offset, offset + maxLength, dest.length);
|
|
+ checkPositionIndexes(offset, offset + maxLength, dest.length);
|
|
writeBytesToImpl(dest, offset, maxLength);
|
|
return maxLength;
|
|
}
|
|
diff --git a/guava/src/com/google/common/hash/Hasher.java b/guava/src/com/google/common/hash/Hasher.java
|
|
index b3f24fa282..1799298436 100644
|
|
--- a/guava/src/com/google/common/hash/Hasher.java
|
|
+++ b/guava/src/com/google/common/hash/Hasher.java
|
|
@@ -136,7 +136,7 @@ public interface Hasher extends PrimitiveSink {
|
|
* @deprecated This returns {@link Object#hashCode()}; you almost certainly mean to call {@code
|
|
* hash().asInt()}.
|
|
*/
|
|
- @Override
|
|
@Deprecated
|
|
+ @Override
|
|
int hashCode();
|
|
}
|
|
diff --git a/guava/src/com/google/common/hash/HashingInputStream.java b/guava/src/com/google/common/hash/HashingInputStream.java
|
|
index bf9464ce55..8db29550c6 100644
|
|
--- a/guava/src/com/google/common/hash/HashingInputStream.java
|
|
+++ b/guava/src/com/google/common/hash/HashingInputStream.java
|
|
@@ -48,8 +48,8 @@ public final class HashingInputStream extends FilterInputStream {
|
|
* Reads the next byte of data from the underlying input stream and updates the hasher with the
|
|
* byte read.
|
|
*/
|
|
- @Override
|
|
@CanIgnoreReturnValue
|
|
+ @Override
|
|
public int read() throws IOException {
|
|
int b = in.read();
|
|
if (b != -1) {
|
|
@@ -62,8 +62,8 @@ public final class HashingInputStream extends FilterInputStream {
|
|
* Reads the specified bytes of data from the underlying input stream and updates the hasher with
|
|
* the bytes read.
|
|
*/
|
|
- @Override
|
|
@CanIgnoreReturnValue
|
|
+ @Override
|
|
public int read(byte[] bytes, int off, int len) throws IOException {
|
|
int numOfBytesRead = in.read(bytes, off, len);
|
|
if (numOfBytesRead != -1) {
|
|
diff --git a/guava/src/com/google/common/hash/Murmur3_32HashFunction.java b/guava/src/com/google/common/hash/Murmur3_32HashFunction.java
|
|
index a47184be58..62ed61b1aa 100644
|
|
--- a/guava/src/com/google/common/hash/Murmur3_32HashFunction.java
|
|
+++ b/guava/src/com/google/common/hash/Murmur3_32HashFunction.java
|
|
@@ -148,8 +148,8 @@ final class Murmur3_32HashFunction extends AbstractHashFunction implements Seria
|
|
return fmix(h1, Chars.BYTES * input.length());
|
|
}
|
|
|
|
- @SuppressWarnings("deprecation") // need to use Charsets for Android tests to pass
|
|
- @Override
|
|
+ @Override // need to use Charsets for Android tests to pass
|
|
+ @SuppressWarnings("deprecation")
|
|
public HashCode hashString(CharSequence input, Charset charset) {
|
|
if (Charsets.UTF_8.equals(charset)) {
|
|
int utf16Length = input.length();
|
|
@@ -252,8 +252,7 @@ final class Murmur3_32HashFunction extends AbstractHashFunction implements Seria
|
|
private static int mixH1(int h1, int k1) {
|
|
h1 ^= k1;
|
|
h1 = Integer.rotateLeft(h1, 13);
|
|
- h1 = h1 * 5 + 0xe6546b64;
|
|
- return h1;
|
|
+ return h1 * 5 + 0xe6546b64;
|
|
}
|
|
|
|
// Finalization mix - force all bits of a hash block to avalanche
|
|
@@ -346,8 +345,8 @@ final class Murmur3_32HashFunction extends AbstractHashFunction implements Seria
|
|
return this;
|
|
}
|
|
|
|
- @SuppressWarnings("deprecation") // need to use Charsets for Android tests to pass
|
|
- @Override
|
|
+ @Override // need to use Charsets for Android tests to pass
|
|
+ @SuppressWarnings("deprecation")
|
|
public Hasher putString(CharSequence input, Charset charset) {
|
|
if (Charsets.UTF_8.equals(charset)) {
|
|
int utf16Length = input.length();
|
|
diff --git a/guava/src/com/google/common/io/BaseEncoding.java b/guava/src/com/google/common/io/BaseEncoding.java
|
|
index 9eb3a859d9..ac647b2724 100644
|
|
--- a/guava/src/com/google/common/io/BaseEncoding.java
|
|
+++ b/guava/src/com/google/common/io/BaseEncoding.java
|
|
@@ -725,8 +725,8 @@ public abstract class BaseEncoding {
|
|
return bytesWritten;
|
|
}
|
|
|
|
- @Override
|
|
- @GwtIncompatible // Reader,InputStream
|
|
+ @GwtIncompatible
|
|
+ @Override // Reader,InputStream
|
|
public InputStream decodingStream(Reader reader) {
|
|
checkNotNull(reader);
|
|
return new InputStream() {
|
|
@@ -859,7 +859,7 @@ public abstract class BaseEncoding {
|
|
@Override
|
|
public String toString() {
|
|
StringBuilder builder = new StringBuilder("BaseEncoding.");
|
|
- builder.append(alphabet.toString());
|
|
+ builder.append(alphabet);
|
|
if (8 % alphabet.bitsPerChar != 0) {
|
|
if (paddingChar == null) {
|
|
builder.append(".omitPadding()");
|
|
@@ -1138,8 +1138,8 @@ public abstract class BaseEncoding {
|
|
return delegate.decodeTo(target, stripped);
|
|
}
|
|
|
|
- @Override
|
|
- @GwtIncompatible // Reader,InputStream
|
|
+ @GwtIncompatible
|
|
+ @Override // Reader,InputStream
|
|
public InputStream decodingStream(Reader reader) {
|
|
return delegate.decodingStream(ignoringReader(reader, separator));
|
|
}
|
|
diff --git a/guava/src/com/google/common/io/ByteArrayDataInput.java b/guava/src/com/google/common/io/ByteArrayDataInput.java
|
|
index cf84fcc136..c96d2563f7 100644
|
|
--- a/guava/src/com/google/common/io/ByteArrayDataInput.java
|
|
+++ b/guava/src/com/google/common/io/ByteArrayDataInput.java
|
|
@@ -87,8 +87,8 @@ public interface ByteArrayDataInput extends DataInput {
|
|
double readDouble();
|
|
|
|
@CanIgnoreReturnValue // to skip a line
|
|
- @Override
|
|
@CheckForNull
|
|
+ @Override
|
|
String readLine();
|
|
|
|
@CanIgnoreReturnValue // to skip a field
|
|
diff --git a/guava/src/com/google/common/io/ByteSink.java b/guava/src/com/google/common/io/ByteSink.java
|
|
index 7a6af6fc58..5de083075e 100644
|
|
--- a/guava/src/com/google/common/io/ByteSink.java
|
|
+++ b/guava/src/com/google/common/io/ByteSink.java
|
|
@@ -152,7 +152,7 @@ public abstract class ByteSink {
|
|
|
|
@Override
|
|
public String toString() {
|
|
- return ByteSink.this.toString() + ".asCharSink(" + charset + ")";
|
|
+ return ByteSink.this + ".asCharSink(" + charset + ")";
|
|
}
|
|
}
|
|
}
|
|
diff --git a/guava/src/com/google/common/io/ByteSource.java b/guava/src/com/google/common/io/ByteSource.java
|
|
index c8da9678b8..afd9531bae 100644
|
|
--- a/guava/src/com/google/common/io/ByteSource.java
|
|
+++ b/guava/src/com/google/common/io/ByteSource.java
|
|
@@ -488,7 +488,7 @@ public abstract class ByteSource {
|
|
|
|
@Override
|
|
public String toString() {
|
|
- return ByteSource.this.toString() + ".asCharSource(" + charset + ")";
|
|
+ return ByteSource.this + ".asCharSource(" + charset + ")";
|
|
}
|
|
}
|
|
|
|
@@ -567,7 +567,7 @@ public abstract class ByteSource {
|
|
|
|
@Override
|
|
public String toString() {
|
|
- return ByteSource.this.toString() + ".slice(" + offset + ", " + length + ")";
|
|
+ return ByteSource.this + ".slice(" + offset + ", " + length + ")";
|
|
}
|
|
}
|
|
|
|
@@ -618,9 +618,9 @@ public abstract class ByteSource {
|
|
return Arrays.copyOfRange(bytes, offset, offset + length);
|
|
}
|
|
|
|
- @SuppressWarnings("CheckReturnValue") // it doesn't matter what processBytes returns here
|
|
- @Override
|
|
+ @Override // it doesn't matter what processBytes returns here
|
|
@ParametricNullness
|
|
+ @SuppressWarnings("CheckReturnValue")
|
|
public <T extends @Nullable Object> T read(ByteProcessor<T> processor) throws IOException {
|
|
processor.processBytes(bytes, offset, length);
|
|
return processor.getResult();
|
|
diff --git a/guava/src/com/google/common/io/ByteStreams.java b/guava/src/com/google/common/io/ByteStreams.java
|
|
index 99213bf16b..a35c255f68 100644
|
|
--- a/guava/src/com/google/common/io/ByteStreams.java
|
|
+++ b/guava/src/com/google/common/io/ByteStreams.java
|
|
@@ -282,8 +282,8 @@ public final class ByteStreams {
|
|
*
|
|
* @since 20.0
|
|
*/
|
|
- @CanIgnoreReturnValue
|
|
@Beta
|
|
+ @CanIgnoreReturnValue
|
|
public static long exhaust(InputStream in) throws IOException {
|
|
long total = 0;
|
|
long read;
|
|
@@ -454,8 +454,8 @@ public final class ByteStreams {
|
|
}
|
|
}
|
|
|
|
- @Override
|
|
@CheckForNull
|
|
+ @Override
|
|
public String readLine() {
|
|
try {
|
|
return input.readLine();
|
|
diff --git a/guava/src/com/google/common/io/CharSource.java b/guava/src/com/google/common/io/CharSource.java
|
|
index 24a67af5c6..d2a98af99d 100644
|
|
--- a/guava/src/com/google/common/io/CharSource.java
|
|
+++ b/guava/src/com/google/common/io/CharSource.java
|
|
@@ -531,7 +531,7 @@ public abstract class CharSource {
|
|
|
|
@Override
|
|
public String toString() {
|
|
- return CharSource.this.toString() + ".asByteSource(" + charset + ")";
|
|
+ return CharSource.this + ".asByteSource(" + charset + ")";
|
|
}
|
|
}
|
|
|
|
@@ -578,8 +578,8 @@ public abstract class CharSource {
|
|
return new AbstractIterator<String>() {
|
|
Iterator<String> lines = LINE_SPLITTER.split(seq).iterator();
|
|
|
|
- @Override
|
|
@CheckForNull
|
|
+ @Override
|
|
protected String computeNext() {
|
|
if (lines.hasNext()) {
|
|
String next = lines.next();
|
|
@@ -598,8 +598,8 @@ public abstract class CharSource {
|
|
return Streams.stream(linesIterator());
|
|
}
|
|
|
|
- @Override
|
|
@CheckForNull
|
|
+ @Override
|
|
public String readFirstLine() {
|
|
Iterator<String> lines = linesIterator();
|
|
return lines.hasNext() ? lines.next() : null;
|
|
diff --git a/guava/src/com/google/common/io/FileBackedOutputStream.java b/guava/src/com/google/common/io/FileBackedOutputStream.java
|
|
index 9912e2fcd1..4f3bcc65e0 100644
|
|
--- a/guava/src/com/google/common/io/FileBackedOutputStream.java
|
|
+++ b/guava/src/com/google/common/io/FileBackedOutputStream.java
|
|
@@ -82,8 +82,8 @@ public final class FileBackedOutputStream extends OutputStream {
|
|
}
|
|
|
|
/** Returns the file holding the data (possibly null). */
|
|
- @VisibleForTesting
|
|
@CheckForNull
|
|
+ @VisibleForTesting
|
|
synchronized File getFile() {
|
|
return file;
|
|
}
|
|
diff --git a/guava/src/com/google/common/io/Files.java b/guava/src/com/google/common/io/Files.java
|
|
index 4ecab28074..0f031fa60b 100644
|
|
--- a/guava/src/com/google/common/io/Files.java
|
|
+++ b/guava/src/com/google/common/io/Files.java
|
|
@@ -17,6 +17,7 @@ package com.google.common.io;
|
|
import static com.google.common.base.Preconditions.checkArgument;
|
|
import static com.google.common.base.Preconditions.checkNotNull;
|
|
import static com.google.common.io.FileWriteMode.APPEND;
|
|
+import static java.util.Collections.unmodifiableList;
|
|
|
|
import com.google.common.annotations.Beta;
|
|
import com.google.common.annotations.GwtIncompatible;
|
|
@@ -51,7 +52,6 @@ import java.nio.charset.Charset;
|
|
import java.nio.charset.StandardCharsets;
|
|
import java.util.ArrayList;
|
|
import java.util.Arrays;
|
|
-import java.util.Collections;
|
|
import java.util.List;
|
|
import javax.annotation.CheckForNull;
|
|
import org.checkerframework.checker.nullness.qual.Nullable;
|
|
@@ -358,7 +358,7 @@ public final class Files {
|
|
@Deprecated
|
|
@InlineMe(
|
|
replacement = "Files.asCharSink(to, charset, FileWriteMode.APPEND).write(from)",
|
|
- imports = {"com.google.common.io.FileWriteMode", "com.google.common.io.Files"})
|
|
+ imports = {"com.google.common.io.Files", "com.google.common.io.FileWriteMode"})
|
|
public static void append(CharSequence from, File to, Charset charset) throws IOException {
|
|
asCharSink(to, charset, FileWriteMode.APPEND).write(from);
|
|
}
|
|
@@ -523,11 +523,11 @@ public final class Files {
|
|
* @throws IOException if an I/O error occurs
|
|
* @deprecated Prefer {@code asCharSource(file, charset).readFirstLine()}.
|
|
*/
|
|
+ @CheckForNull
|
|
@Deprecated
|
|
@InlineMe(
|
|
replacement = "Files.asCharSource(file, charset).readFirstLine()",
|
|
imports = "com.google.common.io.Files")
|
|
- @CheckForNull
|
|
public static String readFirstLine(File file, Charset charset) throws IOException {
|
|
return asCharSource(file, charset).readFirstLine();
|
|
}
|
|
@@ -581,11 +581,11 @@ public final class Files {
|
|
* @throws IOException if an I/O error occurs
|
|
* @deprecated Prefer {@code asCharSource(file, charset).readLines(callback)}.
|
|
*/
|
|
+ @CanIgnoreReturnValue
|
|
@Deprecated
|
|
@InlineMe(
|
|
replacement = "Files.asCharSource(file, charset).readLines(callback)",
|
|
- imports = "com.google.common.io.Files")
|
|
- @CanIgnoreReturnValue // some processors won't return a useful result
|
|
+ imports = "com.google.common.io.Files") // some processors won't return a useful result
|
|
@ParametricNullness
|
|
public static <T extends @Nullable Object> T readLines(
|
|
File file, Charset charset, LineProcessor<T> callback) throws IOException {
|
|
@@ -603,11 +603,11 @@ public final class Files {
|
|
* @throws IOException if an I/O error occurs
|
|
* @deprecated Prefer {@code asByteSource(file).read(processor)}.
|
|
*/
|
|
+ @CanIgnoreReturnValue
|
|
@Deprecated
|
|
@InlineMe(
|
|
replacement = "Files.asByteSource(file).read(processor)",
|
|
- imports = "com.google.common.io.Files")
|
|
- @CanIgnoreReturnValue // some processors won't return a useful result
|
|
+ imports = "com.google.common.io.Files") // some processors won't return a useful result
|
|
@ParametricNullness
|
|
public static <T extends @Nullable Object> T readBytes(File file, ByteProcessor<T> processor)
|
|
throws IOException {
|
|
@@ -854,7 +854,7 @@ public final class Files {
|
|
if (file.isDirectory()) {
|
|
File[] files = file.listFiles();
|
|
if (files != null) {
|
|
- return Collections.unmodifiableList(Arrays.asList(files));
|
|
+ return unmodifiableList(Arrays.asList(files));
|
|
}
|
|
}
|
|
|
|
diff --git a/guava/src/com/google/common/io/LittleEndianDataInputStream.java b/guava/src/com/google/common/io/LittleEndianDataInputStream.java
|
|
index 88c8e27bc3..2293b084fd 100644
|
|
--- a/guava/src/com/google/common/io/LittleEndianDataInputStream.java
|
|
+++ b/guava/src/com/google/common/io/LittleEndianDataInputStream.java
|
|
@@ -14,9 +14,10 @@
|
|
|
|
package com.google.common.io;
|
|
|
|
+import static com.google.common.base.Preconditions.checkNotNull;
|
|
+
|
|
import com.google.common.annotations.Beta;
|
|
import com.google.common.annotations.GwtIncompatible;
|
|
-import com.google.common.base.Preconditions;
|
|
import com.google.common.primitives.Ints;
|
|
import com.google.common.primitives.Longs;
|
|
import com.google.errorprone.annotations.CanIgnoreReturnValue;
|
|
@@ -50,13 +51,13 @@ public final class LittleEndianDataInputStream extends FilterInputStream impleme
|
|
* @param in the stream to delegate to
|
|
*/
|
|
public LittleEndianDataInputStream(InputStream in) {
|
|
- super(Preconditions.checkNotNull(in));
|
|
+ super(checkNotNull(in));
|
|
}
|
|
|
|
/** This method will throw an {@link UnsupportedOperationException}. */
|
|
@CanIgnoreReturnValue // to skip a line
|
|
- @Override
|
|
@DoNotCall("Always throws UnsupportedOperationException")
|
|
+ @Override
|
|
public String readLine() {
|
|
throw new UnsupportedOperationException("readLine is not supported");
|
|
}
|
|
diff --git a/guava/src/com/google/common/io/LittleEndianDataOutputStream.java b/guava/src/com/google/common/io/LittleEndianDataOutputStream.java
|
|
index 6e51aff49d..3d079b7bc3 100644
|
|
--- a/guava/src/com/google/common/io/LittleEndianDataOutputStream.java
|
|
+++ b/guava/src/com/google/common/io/LittleEndianDataOutputStream.java
|
|
@@ -14,9 +14,10 @@
|
|
|
|
package com.google.common.io;
|
|
|
|
+import static com.google.common.base.Preconditions.checkNotNull;
|
|
+
|
|
import com.google.common.annotations.Beta;
|
|
import com.google.common.annotations.GwtIncompatible;
|
|
-import com.google.common.base.Preconditions;
|
|
import com.google.common.primitives.Longs;
|
|
import java.io.DataOutput;
|
|
import java.io.DataOutputStream;
|
|
@@ -46,7 +47,7 @@ public final class LittleEndianDataOutputStream extends FilterOutputStream imple
|
|
* @param out the stream to delegate to
|
|
*/
|
|
public LittleEndianDataOutputStream(OutputStream out) {
|
|
- super(new DataOutputStream(Preconditions.checkNotNull(out)));
|
|
+ super(new DataOutputStream(checkNotNull(out)));
|
|
}
|
|
|
|
@Override
|
|
diff --git a/guava/src/com/google/common/io/MoreFiles.java b/guava/src/com/google/common/io/MoreFiles.java
|
|
index ffe200d5e8..06fe965b75 100644
|
|
--- a/guava/src/com/google/common/io/MoreFiles.java
|
|
+++ b/guava/src/com/google/common/io/MoreFiles.java
|
|
@@ -172,8 +172,8 @@ public final class MoreFiles {
|
|
// overload taking OpenOptions, meaning we can't guarantee the same behavior w.r.t. things
|
|
// like following/not following symlinks.
|
|
return new AsCharSource(charset) {
|
|
- @SuppressWarnings("FilesLinesLeak") // the user needs to close it in this case
|
|
- @Override
|
|
+ @Override // the user needs to close it in this case
|
|
+ @SuppressWarnings("FilesLinesLeak")
|
|
public Stream<String> lines() throws IOException {
|
|
return Files.lines(path, charset);
|
|
}
|
|
diff --git a/guava/src/com/google/common/io/MultiReader.java b/guava/src/com/google/common/io/MultiReader.java
|
|
index cc36e527b6..59f906ca8a 100644
|
|
--- a/guava/src/com/google/common/io/MultiReader.java
|
|
+++ b/guava/src/com/google/common/io/MultiReader.java
|
|
@@ -14,10 +14,10 @@
|
|
|
|
package com.google.common.io;
|
|
|
|
+import static com.google.common.base.Preconditions.checkArgument;
|
|
import static com.google.common.base.Preconditions.checkNotNull;
|
|
|
|
import com.google.common.annotations.GwtIncompatible;
|
|
-import com.google.common.base.Preconditions;
|
|
import java.io.IOException;
|
|
import java.io.Reader;
|
|
import java.util.Iterator;
|
|
@@ -64,7 +64,7 @@ class MultiReader extends Reader {
|
|
|
|
@Override
|
|
public long skip(long n) throws IOException {
|
|
- Preconditions.checkArgument(n >= 0, "n is negative");
|
|
+ checkArgument(n >= 0, "n is negative");
|
|
if (n > 0) {
|
|
while (current != null) {
|
|
long result = current.skip(n);
|
|
diff --git a/guava/src/com/google/common/io/PatternFilenameFilter.java b/guava/src/com/google/common/io/PatternFilenameFilter.java
|
|
index 3cb2371e2f..6f50e174af 100644
|
|
--- a/guava/src/com/google/common/io/PatternFilenameFilter.java
|
|
+++ b/guava/src/com/google/common/io/PatternFilenameFilter.java
|
|
@@ -14,9 +14,10 @@
|
|
|
|
package com.google.common.io;
|
|
|
|
+import static com.google.common.base.Preconditions.checkNotNull;
|
|
+
|
|
import com.google.common.annotations.Beta;
|
|
import com.google.common.annotations.GwtIncompatible;
|
|
-import com.google.common.base.Preconditions;
|
|
import java.io.File;
|
|
import java.io.FilenameFilter;
|
|
import java.util.regex.Pattern;
|
|
@@ -52,7 +53,7 @@ public final class PatternFilenameFilter implements FilenameFilter {
|
|
* @param pattern the pattern on which to filter file names
|
|
*/
|
|
public PatternFilenameFilter(Pattern pattern) {
|
|
- this.pattern = Preconditions.checkNotNull(pattern);
|
|
+ this.pattern = checkNotNull(pattern);
|
|
}
|
|
|
|
/*
|
|
diff --git a/guava/src/com/google/common/math/DoubleMath.java b/guava/src/com/google/common/math/DoubleMath.java
|
|
index cdd0a4b39e..933247139a 100644
|
|
--- a/guava/src/com/google/common/math/DoubleMath.java
|
|
+++ b/guava/src/com/google/common/math/DoubleMath.java
|
|
@@ -518,8 +518,8 @@ public final class DoubleMath {
|
|
return mean;
|
|
}
|
|
|
|
- @GwtIncompatible // com.google.common.math.DoubleUtils
|
|
- @CanIgnoreReturnValue
|
|
+ @CanIgnoreReturnValue // com.google.common.math.DoubleUtils
|
|
+ @GwtIncompatible
|
|
private static double checkFinite(double argument) {
|
|
checkArgument(isFinite(argument));
|
|
return argument;
|
|
diff --git a/guava/src/com/google/common/math/IntMath.java b/guava/src/com/google/common/math/IntMath.java
|
|
index 17a18c6999..2f309ca39d 100644
|
|
--- a/guava/src/com/google/common/math/IntMath.java
|
|
+++ b/guava/src/com/google/common/math/IntMath.java
|
|
@@ -719,8 +719,8 @@ public final class IntMath {
|
|
* @throws IllegalArgumentException if {@code n} is negative
|
|
* @since 20.0
|
|
*/
|
|
- @GwtIncompatible // TODO
|
|
- @Beta
|
|
+ @Beta // TODO
|
|
+ @GwtIncompatible
|
|
public static boolean isPrime(int n) {
|
|
return LongMath.isPrime(n);
|
|
}
|
|
diff --git a/guava/src/com/google/common/math/LongMath.java b/guava/src/com/google/common/math/LongMath.java
|
|
index dd5ff06942..2ba232cd06 100644
|
|
--- a/guava/src/com/google/common/math/LongMath.java
|
|
+++ b/guava/src/com/google/common/math/LongMath.java
|
|
@@ -999,8 +999,8 @@ public final class LongMath {
|
|
* @throws IllegalArgumentException if {@code n} is negative
|
|
* @since 20.0
|
|
*/
|
|
- @GwtIncompatible // TODO
|
|
- @Beta
|
|
+ @Beta // TODO
|
|
+ @GwtIncompatible
|
|
public static boolean isPrime(long n) {
|
|
if (n < 2) {
|
|
checkNonNegative("n", n);
|
|
@@ -1242,8 +1242,8 @@ public final class LongMath {
|
|
* is not precisely representable as a {@code double}
|
|
* @since 30.0
|
|
*/
|
|
- @SuppressWarnings("deprecation")
|
|
@GwtIncompatible
|
|
+ @SuppressWarnings("deprecation")
|
|
public static double roundToDouble(long x, RoundingMode mode) {
|
|
// Logic adapted from ToDoubleRounder.
|
|
double roundArbitrarily = (double) x;
|
|
diff --git a/guava/src/com/google/common/net/HostSpecifier.java b/guava/src/com/google/common/net/HostSpecifier.java
|
|
index c57f3d9759..ae6d1ab67d 100644
|
|
--- a/guava/src/com/google/common/net/HostSpecifier.java
|
|
+++ b/guava/src/com/google/common/net/HostSpecifier.java
|
|
@@ -14,8 +14,9 @@
|
|
|
|
package com.google.common.net;
|
|
|
|
+import static com.google.common.base.Preconditions.checkArgument;
|
|
+
|
|
import com.google.common.annotations.GwtIncompatible;
|
|
-import com.google.common.base.Preconditions;
|
|
import com.google.errorprone.annotations.CanIgnoreReturnValue;
|
|
import java.net.InetAddress;
|
|
import java.text.ParseException;
|
|
@@ -71,7 +72,7 @@ public final class HostSpecifier {
|
|
// Verify that no port was specified, and strip optional brackets from
|
|
// IPv6 literals.
|
|
HostAndPort parsedHost = HostAndPort.fromString(specifier);
|
|
- Preconditions.checkArgument(!parsedHost.hasPort());
|
|
+ checkArgument(!parsedHost.hasPort());
|
|
String host = parsedHost.getHost();
|
|
|
|
// Try to interpret the specifier as an IP address. Note we build
|
|
diff --git a/guava/src/com/google/common/net/PercentEscaper.java b/guava/src/com/google/common/net/PercentEscaper.java
|
|
index 9290147312..f386d96bce 100644
|
|
--- a/guava/src/com/google/common/net/PercentEscaper.java
|
|
+++ b/guava/src/com/google/common/net/PercentEscaper.java
|
|
@@ -154,8 +154,8 @@ public final class PercentEscaper extends UnicodeEscaper {
|
|
}
|
|
|
|
/** Escapes the given Unicode code point in UTF-8. */
|
|
- @Override
|
|
@CheckForNull
|
|
+ @Override
|
|
protected char[] escape(int cp) {
|
|
// We should never get negative values here but if we do it will throw an
|
|
// IndexOutOfBoundsException, so at least it will get spotted.
|
|
diff --git a/guava/src/com/google/common/primitives/Booleans.java b/guava/src/com/google/common/primitives/Booleans.java
|
|
index 522049bfe3..a54c2186b9 100644
|
|
--- a/guava/src/com/google/common/primitives/Booleans.java
|
|
+++ b/guava/src/com/google/common/primitives/Booleans.java
|
|
@@ -18,6 +18,7 @@ import static com.google.common.base.Preconditions.checkArgument;
|
|
import static com.google.common.base.Preconditions.checkElementIndex;
|
|
import static com.google.common.base.Preconditions.checkNotNull;
|
|
import static com.google.common.base.Preconditions.checkPositionIndexes;
|
|
+import static java.util.Collections.emptyList;
|
|
|
|
import com.google.common.annotations.Beta;
|
|
import com.google.common.annotations.GwtCompatible;
|
|
@@ -25,7 +26,6 @@ import java.io.Serializable;
|
|
import java.util.AbstractList;
|
|
import java.util.Arrays;
|
|
import java.util.Collection;
|
|
-import java.util.Collections;
|
|
import java.util.Comparator;
|
|
import java.util.List;
|
|
import java.util.RandomAccess;
|
|
@@ -370,7 +370,7 @@ public final class Booleans {
|
|
*/
|
|
public static List<Boolean> asList(boolean... backingArray) {
|
|
if (backingArray.length == 0) {
|
|
- return Collections.emptyList();
|
|
+ return emptyList();
|
|
}
|
|
return new BooleanArrayAsList(backingArray);
|
|
}
|
|
@@ -453,7 +453,7 @@ public final class Booleans {
|
|
int size = size();
|
|
checkPositionIndexes(fromIndex, toIndex, size);
|
|
if (fromIndex == toIndex) {
|
|
- return Collections.emptyList();
|
|
+ return emptyList();
|
|
}
|
|
return new BooleanArrayAsList(array, start + fromIndex, start + toIndex);
|
|
}
|
|
diff --git a/guava/src/com/google/common/primitives/Bytes.java b/guava/src/com/google/common/primitives/Bytes.java
|
|
index 62997f34aa..b0e76f4f2e 100644
|
|
--- a/guava/src/com/google/common/primitives/Bytes.java
|
|
+++ b/guava/src/com/google/common/primitives/Bytes.java
|
|
@@ -18,13 +18,13 @@ import static com.google.common.base.Preconditions.checkArgument;
|
|
import static com.google.common.base.Preconditions.checkElementIndex;
|
|
import static com.google.common.base.Preconditions.checkNotNull;
|
|
import static com.google.common.base.Preconditions.checkPositionIndexes;
|
|
+import static java.util.Collections.emptyList;
|
|
|
|
import com.google.common.annotations.GwtCompatible;
|
|
import java.io.Serializable;
|
|
import java.util.AbstractList;
|
|
import java.util.Arrays;
|
|
import java.util.Collection;
|
|
-import java.util.Collections;
|
|
import java.util.List;
|
|
import java.util.RandomAccess;
|
|
import javax.annotation.CheckForNull;
|
|
@@ -232,7 +232,7 @@ public final class Bytes {
|
|
*/
|
|
public static List<Byte> asList(byte... backingArray) {
|
|
if (backingArray.length == 0) {
|
|
- return Collections.emptyList();
|
|
+ return emptyList();
|
|
}
|
|
return new ByteArrayAsList(backingArray);
|
|
}
|
|
@@ -314,7 +314,7 @@ public final class Bytes {
|
|
int size = size();
|
|
checkPositionIndexes(fromIndex, toIndex, size);
|
|
if (fromIndex == toIndex) {
|
|
- return Collections.emptyList();
|
|
+ return emptyList();
|
|
}
|
|
return new ByteArrayAsList(array, start + fromIndex, start + toIndex);
|
|
}
|
|
diff --git a/guava/src/com/google/common/primitives/Chars.java b/guava/src/com/google/common/primitives/Chars.java
|
|
index 4a2e3a3449..4490e95572 100644
|
|
--- a/guava/src/com/google/common/primitives/Chars.java
|
|
+++ b/guava/src/com/google/common/primitives/Chars.java
|
|
@@ -18,6 +18,7 @@ import static com.google.common.base.Preconditions.checkArgument;
|
|
import static com.google.common.base.Preconditions.checkElementIndex;
|
|
import static com.google.common.base.Preconditions.checkNotNull;
|
|
import static com.google.common.base.Preconditions.checkPositionIndexes;
|
|
+import static java.util.Collections.emptyList;
|
|
|
|
import com.google.common.annotations.Beta;
|
|
import com.google.common.annotations.GwtCompatible;
|
|
@@ -26,7 +27,6 @@ import java.io.Serializable;
|
|
import java.util.AbstractList;
|
|
import java.util.Arrays;
|
|
import java.util.Collection;
|
|
-import java.util.Collections;
|
|
import java.util.Comparator;
|
|
import java.util.List;
|
|
import java.util.RandomAccess;
|
|
@@ -502,7 +502,7 @@ public final class Chars {
|
|
*/
|
|
public static List<Character> asList(char... backingArray) {
|
|
if (backingArray.length == 0) {
|
|
- return Collections.emptyList();
|
|
+ return emptyList();
|
|
}
|
|
return new CharArrayAsList(backingArray);
|
|
}
|
|
@@ -585,7 +585,7 @@ public final class Chars {
|
|
int size = size();
|
|
checkPositionIndexes(fromIndex, toIndex, size);
|
|
if (fromIndex == toIndex) {
|
|
- return Collections.emptyList();
|
|
+ return emptyList();
|
|
}
|
|
return new CharArrayAsList(array, start + fromIndex, start + toIndex);
|
|
}
|
|
diff --git a/guava/src/com/google/common/primitives/Doubles.java b/guava/src/com/google/common/primitives/Doubles.java
|
|
index 6b621c5130..6060357f55 100644
|
|
--- a/guava/src/com/google/common/primitives/Doubles.java
|
|
+++ b/guava/src/com/google/common/primitives/Doubles.java
|
|
@@ -21,6 +21,7 @@ import static com.google.common.base.Preconditions.checkPositionIndexes;
|
|
import static com.google.common.base.Strings.lenientFormat;
|
|
import static java.lang.Double.NEGATIVE_INFINITY;
|
|
import static java.lang.Double.POSITIVE_INFINITY;
|
|
+import static java.util.Collections.emptyList;
|
|
|
|
import com.google.common.annotations.Beta;
|
|
import com.google.common.annotations.GwtCompatible;
|
|
@@ -30,7 +31,6 @@ import java.io.Serializable;
|
|
import java.util.AbstractList;
|
|
import java.util.Arrays;
|
|
import java.util.Collection;
|
|
-import java.util.Collections;
|
|
import java.util.Comparator;
|
|
import java.util.List;
|
|
import java.util.RandomAccess;
|
|
@@ -517,7 +517,7 @@ public final class Doubles extends DoublesMethodsForWeb {
|
|
*/
|
|
public static List<Double> asList(double... backingArray) {
|
|
if (backingArray.length == 0) {
|
|
- return Collections.emptyList();
|
|
+ return emptyList();
|
|
}
|
|
return new DoubleArrayAsList(backingArray);
|
|
}
|
|
@@ -605,7 +605,7 @@ public final class Doubles extends DoublesMethodsForWeb {
|
|
int size = size();
|
|
checkPositionIndexes(fromIndex, toIndex, size);
|
|
if (fromIndex == toIndex) {
|
|
- return Collections.emptyList();
|
|
+ return emptyList();
|
|
}
|
|
return new DoubleArrayAsList(array, start + fromIndex, start + toIndex);
|
|
}
|
|
@@ -699,8 +699,8 @@ public final class Doubles extends DoublesMethodsForWeb {
|
|
* @since 14.0
|
|
*/
|
|
@Beta
|
|
- @GwtIncompatible // regular expressions
|
|
- @CheckForNull
|
|
+ @CheckForNull // regular expressions
|
|
+ @GwtIncompatible
|
|
public static Double tryParse(String string) {
|
|
if (FLOATING_POINT_PATTERN.matcher(string).matches()) {
|
|
// TODO(lowasser): could be potentially optimized, but only with
|
|
diff --git a/guava/src/com/google/common/primitives/Floats.java b/guava/src/com/google/common/primitives/Floats.java
|
|
index b038cb2896..a6f3859e1d 100644
|
|
--- a/guava/src/com/google/common/primitives/Floats.java
|
|
+++ b/guava/src/com/google/common/primitives/Floats.java
|
|
@@ -21,6 +21,7 @@ import static com.google.common.base.Preconditions.checkPositionIndexes;
|
|
import static com.google.common.base.Strings.lenientFormat;
|
|
import static java.lang.Float.NEGATIVE_INFINITY;
|
|
import static java.lang.Float.POSITIVE_INFINITY;
|
|
+import static java.util.Collections.emptyList;
|
|
|
|
import com.google.common.annotations.Beta;
|
|
import com.google.common.annotations.GwtCompatible;
|
|
@@ -30,7 +31,6 @@ import java.io.Serializable;
|
|
import java.util.AbstractList;
|
|
import java.util.Arrays;
|
|
import java.util.Collection;
|
|
-import java.util.Collections;
|
|
import java.util.Comparator;
|
|
import java.util.List;
|
|
import java.util.RandomAccess;
|
|
@@ -509,7 +509,7 @@ public final class Floats extends FloatsMethodsForWeb {
|
|
*/
|
|
public static List<Float> asList(float... backingArray) {
|
|
if (backingArray.length == 0) {
|
|
- return Collections.emptyList();
|
|
+ return emptyList();
|
|
}
|
|
return new FloatArrayAsList(backingArray);
|
|
}
|
|
@@ -591,7 +591,7 @@ public final class Floats extends FloatsMethodsForWeb {
|
|
int size = size();
|
|
checkPositionIndexes(fromIndex, toIndex, size);
|
|
if (fromIndex == toIndex) {
|
|
- return Collections.emptyList();
|
|
+ return emptyList();
|
|
}
|
|
return new FloatArrayAsList(array, start + fromIndex, start + toIndex);
|
|
}
|
|
@@ -661,8 +661,8 @@ public final class Floats extends FloatsMethodsForWeb {
|
|
* @since 14.0
|
|
*/
|
|
@Beta
|
|
- @GwtIncompatible // regular expressions
|
|
- @CheckForNull
|
|
+ @CheckForNull // regular expressions
|
|
+ @GwtIncompatible
|
|
public static Float tryParse(String string) {
|
|
if (Doubles.FLOATING_POINT_PATTERN.matcher(string).matches()) {
|
|
// TODO(lowasser): could be potentially optimized, but only with
|
|
diff --git a/guava/src/com/google/common/primitives/ImmutableDoubleArray.java b/guava/src/com/google/common/primitives/ImmutableDoubleArray.java
|
|
index 9731c11315..3b02853f6c 100644
|
|
--- a/guava/src/com/google/common/primitives/ImmutableDoubleArray.java
|
|
+++ b/guava/src/com/google/common/primitives/ImmutableDoubleArray.java
|
|
@@ -15,11 +15,12 @@
|
|
package com.google.common.primitives;
|
|
|
|
import static com.google.common.base.Preconditions.checkArgument;
|
|
+import static com.google.common.base.Preconditions.checkElementIndex;
|
|
import static com.google.common.base.Preconditions.checkNotNull;
|
|
+import static com.google.common.base.Preconditions.checkPositionIndexes;
|
|
|
|
import com.google.common.annotations.Beta;
|
|
import com.google.common.annotations.GwtCompatible;
|
|
-import com.google.common.base.Preconditions;
|
|
import com.google.errorprone.annotations.CanIgnoreReturnValue;
|
|
import com.google.errorprone.annotations.CheckReturnValue;
|
|
import com.google.errorprone.annotations.Immutable;
|
|
@@ -372,7 +373,7 @@ public final class ImmutableDoubleArray implements Serializable {
|
|
* {@link #length}
|
|
*/
|
|
public double get(int index) {
|
|
- Preconditions.checkElementIndex(index, length());
|
|
+ checkElementIndex(index, length());
|
|
return array[start + index];
|
|
}
|
|
|
|
@@ -438,7 +439,7 @@ public final class ImmutableDoubleArray implements Serializable {
|
|
* end).trimmed()}.
|
|
*/
|
|
public ImmutableDoubleArray subArray(int startIndex, int endIndex) {
|
|
- Preconditions.checkPositionIndexes(startIndex, endIndex, length());
|
|
+ checkPositionIndexes(startIndex, endIndex, length());
|
|
return startIndex == endIndex
|
|
? EMPTY
|
|
: new ImmutableDoubleArray(array, start + startIndex, start + endIndex);
|
|
diff --git a/guava/src/com/google/common/primitives/ImmutableIntArray.java b/guava/src/com/google/common/primitives/ImmutableIntArray.java
|
|
index cc3c671442..d38fe89470 100644
|
|
--- a/guava/src/com/google/common/primitives/ImmutableIntArray.java
|
|
+++ b/guava/src/com/google/common/primitives/ImmutableIntArray.java
|
|
@@ -15,11 +15,12 @@
|
|
package com.google.common.primitives;
|
|
|
|
import static com.google.common.base.Preconditions.checkArgument;
|
|
+import static com.google.common.base.Preconditions.checkElementIndex;
|
|
import static com.google.common.base.Preconditions.checkNotNull;
|
|
+import static com.google.common.base.Preconditions.checkPositionIndexes;
|
|
|
|
import com.google.common.annotations.Beta;
|
|
import com.google.common.annotations.GwtCompatible;
|
|
-import com.google.common.base.Preconditions;
|
|
import com.google.errorprone.annotations.CanIgnoreReturnValue;
|
|
import com.google.errorprone.annotations.CheckReturnValue;
|
|
import com.google.errorprone.annotations.Immutable;
|
|
@@ -369,7 +370,7 @@ public final class ImmutableIntArray implements Serializable {
|
|
* {@link #length}
|
|
*/
|
|
public int get(int index) {
|
|
- Preconditions.checkElementIndex(index, length());
|
|
+ checkElementIndex(index, length());
|
|
return array[start + index];
|
|
}
|
|
|
|
@@ -433,7 +434,7 @@ public final class ImmutableIntArray implements Serializable {
|
|
* end).trimmed()}.
|
|
*/
|
|
public ImmutableIntArray subArray(int startIndex, int endIndex) {
|
|
- Preconditions.checkPositionIndexes(startIndex, endIndex, length());
|
|
+ checkPositionIndexes(startIndex, endIndex, length());
|
|
return startIndex == endIndex
|
|
? EMPTY
|
|
: new ImmutableIntArray(array, start + startIndex, start + endIndex);
|
|
diff --git a/guava/src/com/google/common/primitives/ImmutableLongArray.java b/guava/src/com/google/common/primitives/ImmutableLongArray.java
|
|
index c8f70375d2..c1d4d61129 100644
|
|
--- a/guava/src/com/google/common/primitives/ImmutableLongArray.java
|
|
+++ b/guava/src/com/google/common/primitives/ImmutableLongArray.java
|
|
@@ -15,11 +15,12 @@
|
|
package com.google.common.primitives;
|
|
|
|
import static com.google.common.base.Preconditions.checkArgument;
|
|
+import static com.google.common.base.Preconditions.checkElementIndex;
|
|
import static com.google.common.base.Preconditions.checkNotNull;
|
|
+import static com.google.common.base.Preconditions.checkPositionIndexes;
|
|
|
|
import com.google.common.annotations.Beta;
|
|
import com.google.common.annotations.GwtCompatible;
|
|
-import com.google.common.base.Preconditions;
|
|
import com.google.errorprone.annotations.CanIgnoreReturnValue;
|
|
import com.google.errorprone.annotations.CheckReturnValue;
|
|
import com.google.errorprone.annotations.Immutable;
|
|
@@ -371,7 +372,7 @@ public final class ImmutableLongArray implements Serializable {
|
|
* {@link #length}
|
|
*/
|
|
public long get(int index) {
|
|
- Preconditions.checkElementIndex(index, length());
|
|
+ checkElementIndex(index, length());
|
|
return array[start + index];
|
|
}
|
|
|
|
@@ -435,7 +436,7 @@ public final class ImmutableLongArray implements Serializable {
|
|
* end).trimmed()}.
|
|
*/
|
|
public ImmutableLongArray subArray(int startIndex, int endIndex) {
|
|
- Preconditions.checkPositionIndexes(startIndex, endIndex, length());
|
|
+ checkPositionIndexes(startIndex, endIndex, length());
|
|
return startIndex == endIndex
|
|
? EMPTY
|
|
: new ImmutableLongArray(array, start + startIndex, start + endIndex);
|
|
diff --git a/guava/src/com/google/common/primitives/Ints.java b/guava/src/com/google/common/primitives/Ints.java
|
|
index b63b0f946e..490f99ef37 100644
|
|
--- a/guava/src/com/google/common/primitives/Ints.java
|
|
+++ b/guava/src/com/google/common/primitives/Ints.java
|
|
@@ -18,6 +18,7 @@ import static com.google.common.base.Preconditions.checkArgument;
|
|
import static com.google.common.base.Preconditions.checkElementIndex;
|
|
import static com.google.common.base.Preconditions.checkNotNull;
|
|
import static com.google.common.base.Preconditions.checkPositionIndexes;
|
|
+import static java.util.Collections.emptyList;
|
|
|
|
import com.google.common.annotations.Beta;
|
|
import com.google.common.annotations.GwtCompatible;
|
|
@@ -27,7 +28,6 @@ import java.io.Serializable;
|
|
import java.util.AbstractList;
|
|
import java.util.Arrays;
|
|
import java.util.Collection;
|
|
-import java.util.Collections;
|
|
import java.util.Comparator;
|
|
import java.util.List;
|
|
import java.util.RandomAccess;
|
|
@@ -557,7 +557,7 @@ public final class Ints extends IntsMethodsForWeb {
|
|
*/
|
|
public static List<Integer> asList(int... backingArray) {
|
|
if (backingArray.length == 0) {
|
|
- return Collections.emptyList();
|
|
+ return emptyList();
|
|
}
|
|
return new IntArrayAsList(backingArray);
|
|
}
|
|
@@ -644,7 +644,7 @@ public final class Ints extends IntsMethodsForWeb {
|
|
int size = size();
|
|
checkPositionIndexes(fromIndex, toIndex, size);
|
|
if (fromIndex == toIndex) {
|
|
- return Collections.emptyList();
|
|
+ return emptyList();
|
|
}
|
|
return new IntArrayAsList(array, start + fromIndex, start + toIndex);
|
|
}
|
|
diff --git a/guava/src/com/google/common/primitives/Longs.java b/guava/src/com/google/common/primitives/Longs.java
|
|
index 98c055e27a..de21b161c4 100644
|
|
--- a/guava/src/com/google/common/primitives/Longs.java
|
|
+++ b/guava/src/com/google/common/primitives/Longs.java
|
|
@@ -18,6 +18,7 @@ import static com.google.common.base.Preconditions.checkArgument;
|
|
import static com.google.common.base.Preconditions.checkElementIndex;
|
|
import static com.google.common.base.Preconditions.checkNotNull;
|
|
import static com.google.common.base.Preconditions.checkPositionIndexes;
|
|
+import static java.util.Collections.emptyList;
|
|
|
|
import com.google.common.annotations.Beta;
|
|
import com.google.common.annotations.GwtCompatible;
|
|
@@ -26,7 +27,6 @@ import java.io.Serializable;
|
|
import java.util.AbstractList;
|
|
import java.util.Arrays;
|
|
import java.util.Collection;
|
|
-import java.util.Collections;
|
|
import java.util.Comparator;
|
|
import java.util.List;
|
|
import java.util.RandomAccess;
|
|
@@ -653,7 +653,7 @@ public final class Longs {
|
|
*/
|
|
public static List<Long> asList(long... backingArray) {
|
|
if (backingArray.length == 0) {
|
|
- return Collections.emptyList();
|
|
+ return emptyList();
|
|
}
|
|
return new LongArrayAsList(backingArray);
|
|
}
|
|
@@ -740,7 +740,7 @@ public final class Longs {
|
|
int size = size();
|
|
checkPositionIndexes(fromIndex, toIndex, size);
|
|
if (fromIndex == toIndex) {
|
|
- return Collections.emptyList();
|
|
+ return emptyList();
|
|
}
|
|
return new LongArrayAsList(array, start + fromIndex, start + toIndex);
|
|
}
|
|
diff --git a/guava/src/com/google/common/primitives/Primitives.java b/guava/src/com/google/common/primitives/Primitives.java
|
|
index 7ceed03655..9f875990ad 100644
|
|
--- a/guava/src/com/google/common/primitives/Primitives.java
|
|
+++ b/guava/src/com/google/common/primitives/Primitives.java
|
|
@@ -15,9 +15,9 @@
|
|
package com.google.common.primitives;
|
|
|
|
import static com.google.common.base.Preconditions.checkNotNull;
|
|
+import static java.util.Collections.unmodifiableMap;
|
|
|
|
import com.google.common.annotations.GwtIncompatible;
|
|
-import java.util.Collections;
|
|
import java.util.LinkedHashMap;
|
|
import java.util.Map;
|
|
import java.util.Set;
|
|
@@ -56,8 +56,8 @@ public final class Primitives {
|
|
add(primToWrap, wrapToPrim, short.class, Short.class);
|
|
add(primToWrap, wrapToPrim, void.class, Void.class);
|
|
|
|
- PRIMITIVE_TO_WRAPPER_TYPE = Collections.unmodifiableMap(primToWrap);
|
|
- WRAPPER_TO_PRIMITIVE_TYPE = Collections.unmodifiableMap(wrapToPrim);
|
|
+ PRIMITIVE_TO_WRAPPER_TYPE = unmodifiableMap(primToWrap);
|
|
+ WRAPPER_TO_PRIMITIVE_TYPE = unmodifiableMap(wrapToPrim);
|
|
}
|
|
|
|
private static void add(
|
|
diff --git a/guava/src/com/google/common/primitives/Shorts.java b/guava/src/com/google/common/primitives/Shorts.java
|
|
index 09e0f7cfc3..189acb5f5a 100644
|
|
--- a/guava/src/com/google/common/primitives/Shorts.java
|
|
+++ b/guava/src/com/google/common/primitives/Shorts.java
|
|
@@ -18,6 +18,7 @@ import static com.google.common.base.Preconditions.checkArgument;
|
|
import static com.google.common.base.Preconditions.checkElementIndex;
|
|
import static com.google.common.base.Preconditions.checkNotNull;
|
|
import static com.google.common.base.Preconditions.checkPositionIndexes;
|
|
+import static java.util.Collections.emptyList;
|
|
|
|
import com.google.common.annotations.Beta;
|
|
import com.google.common.annotations.GwtCompatible;
|
|
@@ -27,7 +28,6 @@ import java.io.Serializable;
|
|
import java.util.AbstractList;
|
|
import java.util.Arrays;
|
|
import java.util.Collection;
|
|
-import java.util.Collections;
|
|
import java.util.Comparator;
|
|
import java.util.List;
|
|
import java.util.RandomAccess;
|
|
@@ -554,7 +554,7 @@ public final class Shorts extends ShortsMethodsForWeb {
|
|
*/
|
|
public static List<Short> asList(short... backingArray) {
|
|
if (backingArray.length == 0) {
|
|
- return Collections.emptyList();
|
|
+ return emptyList();
|
|
}
|
|
return new ShortArrayAsList(backingArray);
|
|
}
|
|
@@ -636,7 +636,7 @@ public final class Shorts extends ShortsMethodsForWeb {
|
|
int size = size();
|
|
checkPositionIndexes(fromIndex, toIndex, size);
|
|
if (fromIndex == toIndex) {
|
|
- return Collections.emptyList();
|
|
+ return emptyList();
|
|
}
|
|
return new ShortArrayAsList(array, start + fromIndex, start + toIndex);
|
|
}
|
|
diff --git a/guava/src/com/google/common/reflect/AbstractInvocationHandler.java b/guava/src/com/google/common/reflect/AbstractInvocationHandler.java
|
|
index ff921959db..f8b97b7e37 100644
|
|
--- a/guava/src/com/google/common/reflect/AbstractInvocationHandler.java
|
|
+++ b/guava/src/com/google/common/reflect/AbstractInvocationHandler.java
|
|
@@ -58,8 +58,8 @@ public abstract class AbstractInvocationHandler implements InvocationHandler {
|
|
* <li>other method calls are dispatched to {@link #handleInvocation}.
|
|
* </ul>
|
|
*/
|
|
- @Override
|
|
@CheckForNull
|
|
+ @Override
|
|
public final Object invoke(Object proxy, Method method, @CheckForNull @Nullable Object[] args)
|
|
throws Throwable {
|
|
if (args == null) {
|
|
diff --git a/guava/src/com/google/common/reflect/ImmutableTypeToInstanceMap.java b/guava/src/com/google/common/reflect/ImmutableTypeToInstanceMap.java
|
|
index 6273704a10..16ba194811 100644
|
|
--- a/guava/src/com/google/common/reflect/ImmutableTypeToInstanceMap.java
|
|
+++ b/guava/src/com/google/common/reflect/ImmutableTypeToInstanceMap.java
|
|
@@ -100,14 +100,14 @@ public final class ImmutableTypeToInstanceMap<B> extends ForwardingMap<TypeToken
|
|
this.delegate = delegate;
|
|
}
|
|
|
|
- @Override
|
|
@CheckForNull
|
|
+ @Override
|
|
public <T extends B> T getInstance(TypeToken<T> type) {
|
|
return trustedGet(type.rejectTypeVariables());
|
|
}
|
|
|
|
- @Override
|
|
@CheckForNull
|
|
+ @Override
|
|
public <T extends B> T getInstance(Class<T> type) {
|
|
return trustedGet(TypeToken.of(type));
|
|
}
|
|
@@ -119,10 +119,10 @@ public final class ImmutableTypeToInstanceMap<B> extends ForwardingMap<TypeToken
|
|
* @throws UnsupportedOperationException always
|
|
*/
|
|
@CanIgnoreReturnValue
|
|
+ @CheckForNull
|
|
@Deprecated
|
|
- @Override
|
|
@DoNotCall("Always throws UnsupportedOperationException")
|
|
- @CheckForNull
|
|
+ @Override
|
|
public <T extends B> T putInstance(TypeToken<T> type, T value) {
|
|
throw new UnsupportedOperationException();
|
|
}
|
|
@@ -134,10 +134,10 @@ public final class ImmutableTypeToInstanceMap<B> extends ForwardingMap<TypeToken
|
|
* @throws UnsupportedOperationException always
|
|
*/
|
|
@CanIgnoreReturnValue
|
|
+ @CheckForNull
|
|
@Deprecated
|
|
- @Override
|
|
@DoNotCall("Always throws UnsupportedOperationException")
|
|
- @CheckForNull
|
|
+ @Override
|
|
public <T extends B> T putInstance(Class<T> type, T value) {
|
|
throw new UnsupportedOperationException();
|
|
}
|
|
@@ -149,10 +149,10 @@ public final class ImmutableTypeToInstanceMap<B> extends ForwardingMap<TypeToken
|
|
* @throws UnsupportedOperationException always
|
|
*/
|
|
@CanIgnoreReturnValue
|
|
+ @CheckForNull
|
|
@Deprecated
|
|
- @Override
|
|
@DoNotCall("Always throws UnsupportedOperationException")
|
|
- @CheckForNull
|
|
+ @Override
|
|
public B put(TypeToken<? extends B> key, B value) {
|
|
throw new UnsupportedOperationException();
|
|
}
|
|
@@ -164,8 +164,8 @@ public final class ImmutableTypeToInstanceMap<B> extends ForwardingMap<TypeToken
|
|
* @throws UnsupportedOperationException always
|
|
*/
|
|
@Deprecated
|
|
- @Override
|
|
@DoNotCall("Always throws UnsupportedOperationException")
|
|
+ @Override
|
|
public void putAll(Map<? extends TypeToken<? extends B>, ? extends B> map) {
|
|
throw new UnsupportedOperationException();
|
|
}
|
|
@@ -175,8 +175,8 @@ public final class ImmutableTypeToInstanceMap<B> extends ForwardingMap<TypeToken
|
|
return delegate;
|
|
}
|
|
|
|
- @SuppressWarnings("unchecked") // value could not get in if not a T
|
|
- @CheckForNull
|
|
+ @CheckForNull // value could not get in if not a T
|
|
+ @SuppressWarnings("unchecked")
|
|
private <T extends B> T trustedGet(TypeToken<T> type) {
|
|
return (T) delegate.get(type);
|
|
}
|
|
diff --git a/guava/src/com/google/common/reflect/Invokable.java b/guava/src/com/google/common/reflect/Invokable.java
|
|
index e6d3b6c53f..6b92499bd4 100644
|
|
--- a/guava/src/com/google/common/reflect/Invokable.java
|
|
+++ b/guava/src/com/google/common/reflect/Invokable.java
|
|
@@ -90,8 +90,8 @@ public abstract class Invokable<T, R> implements AnnotatedElement, Member {
|
|
return accessibleObject.isAnnotationPresent(annotationClass);
|
|
}
|
|
|
|
- @Override
|
|
@CheckForNull
|
|
+ @Override
|
|
public final <A extends Annotation> A getAnnotation(Class<A> annotationClass) {
|
|
return accessibleObject.getAnnotation(annotationClass);
|
|
}
|
|
@@ -253,9 +253,9 @@ public abstract class Invokable<T, R> implements AnnotatedElement, Member {
|
|
* @throws InvocationTargetException if the underlying method or constructor throws an exception.
|
|
*/
|
|
// All subclasses are owned by us and we'll make sure to get the R type right, including nullness.
|
|
- @SuppressWarnings({"unchecked", "nullness"})
|
|
@CanIgnoreReturnValue
|
|
@CheckForNull
|
|
+ @SuppressWarnings({"nullness", "unchecked"})
|
|
public final R invoke(@CheckForNull T receiver, @Nullable Object... args)
|
|
throws InvocationTargetException, IllegalAccessException {
|
|
return (R) invokeInternal(receiver, checkNotNull(args));
|
|
@@ -322,8 +322,8 @@ public abstract class Invokable<T, R> implements AnnotatedElement, Member {
|
|
return specialized;
|
|
}
|
|
|
|
- @SuppressWarnings("unchecked") // The declaring class is T's raw class, or one of its supertypes.
|
|
- @Override
|
|
+ @Override // The declaring class is T's raw class, or one of its supertypes.
|
|
+ @SuppressWarnings("unchecked")
|
|
public final Class<? super T> getDeclaringClass() {
|
|
return (Class<? super T>) member.getDeclaringClass();
|
|
}
|
|
@@ -361,8 +361,8 @@ public abstract class Invokable<T, R> implements AnnotatedElement, Member {
|
|
this.method = method;
|
|
}
|
|
|
|
- @Override
|
|
@CheckForNull
|
|
+ @Override
|
|
final Object invokeInternal(@CheckForNull Object receiver, @Nullable Object[] args)
|
|
throws InvocationTargetException, IllegalAccessException {
|
|
return method.invoke(receiver, args);
|
|
diff --git a/guava/src/com/google/common/reflect/MutableTypeToInstanceMap.java b/guava/src/com/google/common/reflect/MutableTypeToInstanceMap.java
|
|
index 9542e0a7ed..9b3bd5b30f 100644
|
|
--- a/guava/src/com/google/common/reflect/MutableTypeToInstanceMap.java
|
|
+++ b/guava/src/com/google/common/reflect/MutableTypeToInstanceMap.java
|
|
@@ -44,28 +44,28 @@ public final class MutableTypeToInstanceMap<B> extends ForwardingMap<TypeToken<?
|
|
|
|
private final Map<TypeToken<? extends B>, B> backingMap = Maps.newHashMap();
|
|
|
|
- @Override
|
|
@CheckForNull
|
|
+ @Override
|
|
public <T extends B> T getInstance(Class<T> type) {
|
|
return trustedGet(TypeToken.of(type));
|
|
}
|
|
|
|
- @Override
|
|
@CheckForNull
|
|
+ @Override
|
|
public <T extends B> T getInstance(TypeToken<T> type) {
|
|
return trustedGet(type.rejectTypeVariables());
|
|
}
|
|
|
|
- @Override
|
|
@CanIgnoreReturnValue
|
|
@CheckForNull
|
|
+ @Override
|
|
public <T extends B> T putInstance(Class<T> type, T value) {
|
|
return trustedPut(TypeToken.of(type), value);
|
|
}
|
|
|
|
- @Override
|
|
@CanIgnoreReturnValue
|
|
@CheckForNull
|
|
+ @Override
|
|
public <T extends B> T putInstance(TypeToken<T> type, T value) {
|
|
return trustedPut(type.rejectTypeVariables(), value);
|
|
}
|
|
@@ -77,10 +77,10 @@ public final class MutableTypeToInstanceMap<B> extends ForwardingMap<TypeToken<?
|
|
* @throws UnsupportedOperationException always
|
|
*/
|
|
@CanIgnoreReturnValue
|
|
+ @CheckForNull
|
|
@Deprecated
|
|
- @Override
|
|
@DoNotCall("Always throws UnsupportedOperationException")
|
|
- @CheckForNull
|
|
+ @Override
|
|
public B put(TypeToken<? extends B> key, B value) {
|
|
throw new UnsupportedOperationException("Please use putInstance() instead.");
|
|
}
|
|
@@ -92,8 +92,8 @@ public final class MutableTypeToInstanceMap<B> extends ForwardingMap<TypeToken<?
|
|
* @throws UnsupportedOperationException always
|
|
*/
|
|
@Deprecated
|
|
- @Override
|
|
@DoNotCall("Always throws UnsupportedOperationException")
|
|
+ @Override
|
|
public void putAll(Map<? extends TypeToken<? extends B>, ? extends B> map) {
|
|
throw new UnsupportedOperationException("Please use putInstance() instead.");
|
|
}
|
|
@@ -108,14 +108,14 @@ public final class MutableTypeToInstanceMap<B> extends ForwardingMap<TypeToken<?
|
|
return backingMap;
|
|
}
|
|
|
|
- @SuppressWarnings("unchecked") // value could not get in if not a T
|
|
- @CheckForNull
|
|
+ @CheckForNull // value could not get in if not a T
|
|
+ @SuppressWarnings("unchecked")
|
|
private <T extends B> T trustedPut(TypeToken<T> type, T value) {
|
|
return (T) backingMap.put(type, value);
|
|
}
|
|
|
|
- @SuppressWarnings("unchecked") // value could not get in if not a T
|
|
- @CheckForNull
|
|
+ @CheckForNull // value could not get in if not a T
|
|
+ @SuppressWarnings("unchecked")
|
|
private <T extends B> T trustedGet(TypeToken<T> type) {
|
|
return (T) backingMap.get(type);
|
|
}
|
|
diff --git a/guava/src/com/google/common/reflect/Parameter.java b/guava/src/com/google/common/reflect/Parameter.java
|
|
index 5ef6606ea2..c11798ff6b 100644
|
|
--- a/guava/src/com/google/common/reflect/Parameter.java
|
|
+++ b/guava/src/com/google/common/reflect/Parameter.java
|
|
@@ -73,8 +73,8 @@ public final class Parameter implements AnnotatedElement {
|
|
return getAnnotation(annotationType) != null;
|
|
}
|
|
|
|
- @Override
|
|
@CheckForNull
|
|
+ @Override
|
|
public <A extends Annotation> A getAnnotation(Class<A> annotationType) {
|
|
checkNotNull(annotationType);
|
|
for (Annotation annotation : annotations) {
|
|
@@ -112,8 +112,8 @@ public final class Parameter implements AnnotatedElement {
|
|
* @since 18.0
|
|
*/
|
|
// @Override on JDK8
|
|
- @Override
|
|
@CheckForNull
|
|
+ @Override
|
|
public <A extends Annotation> A getDeclaredAnnotation(Class<A> annotationType) {
|
|
checkNotNull(annotationType);
|
|
return FluentIterable.from(annotations).filter(annotationType).first().orNull();
|
|
diff --git a/guava/src/com/google/common/reflect/TypeToken.java b/guava/src/com/google/common/reflect/TypeToken.java
|
|
index fea1d53a2f..c50c0d8c71 100644
|
|
--- a/guava/src/com/google/common/reflect/TypeToken.java
|
|
+++ b/guava/src/com/google/common/reflect/TypeToken.java
|
|
@@ -692,7 +692,7 @@ public abstract class TypeToken<T> extends TypeCapture<T> implements Serializabl
|
|
ImmutableSet<TypeToken<? super T>> filteredTypes = types;
|
|
if (filteredTypes == null) {
|
|
// Java has no way to express ? super T when we parameterize TypeToken vs. Class.
|
|
- @SuppressWarnings({"unchecked", "rawtypes"})
|
|
+ @SuppressWarnings({"rawtypes", "unchecked"})
|
|
ImmutableList<TypeToken<? super T>> collectedTypes =
|
|
(ImmutableList) TypeCollector.FOR_GENERIC_TYPE.collectTypes(TypeToken.this);
|
|
return (types =
|
|
@@ -707,7 +707,7 @@ public abstract class TypeToken<T> extends TypeCapture<T> implements Serializabl
|
|
/** Returns the raw types of the types in this set, in the same order. */
|
|
public Set<Class<? super T>> rawTypes() {
|
|
// Java has no way to express ? super T when we parameterize TypeToken vs. Class.
|
|
- @SuppressWarnings({"unchecked", "rawtypes"})
|
|
+ @SuppressWarnings({"rawtypes", "unchecked"})
|
|
ImmutableList<Class<? super T>> collectedTypes =
|
|
(ImmutableList) TypeCollector.FOR_RAW_TYPE.collectTypes(getRawTypes());
|
|
return ImmutableSet.copyOf(collectedTypes);
|
|
@@ -744,7 +744,7 @@ public abstract class TypeToken<T> extends TypeCapture<T> implements Serializabl
|
|
@Override
|
|
public Set<Class<? super T>> rawTypes() {
|
|
// Java has no way to express ? super T when we parameterize TypeToken vs. Class.
|
|
- @SuppressWarnings({"unchecked", "rawtypes"})
|
|
+ @SuppressWarnings({"rawtypes", "unchecked"})
|
|
ImmutableList<Class<? super T>> collectedTypes =
|
|
(ImmutableList) TypeCollector.FOR_RAW_TYPE.collectTypes(getRawTypes());
|
|
return FluentIterable.from(collectedTypes).filter(Class::isInterface).toSet();
|
|
@@ -770,7 +770,7 @@ public abstract class TypeToken<T> extends TypeCapture<T> implements Serializabl
|
|
protected Set<TypeToken<? super T>> delegate() {
|
|
ImmutableSet<TypeToken<? super T>> result = classes;
|
|
if (result == null) {
|
|
- @SuppressWarnings({"unchecked", "rawtypes"})
|
|
+ @SuppressWarnings({"rawtypes", "unchecked"})
|
|
ImmutableList<TypeToken<? super T>> collectedTypes =
|
|
(ImmutableList)
|
|
TypeCollector.FOR_GENERIC_TYPE.classesOnly().collectTypes(TypeToken.this);
|
|
@@ -791,7 +791,7 @@ public abstract class TypeToken<T> extends TypeCapture<T> implements Serializabl
|
|
@Override
|
|
public Set<Class<? super T>> rawTypes() {
|
|
// Java has no way to express ? super T when we parameterize TypeToken vs. Class.
|
|
- @SuppressWarnings({"unchecked", "rawtypes"})
|
|
+ @SuppressWarnings({"rawtypes", "unchecked"})
|
|
ImmutableList<Class<? super T>> collectedTypes =
|
|
(ImmutableList) TypeCollector.FOR_RAW_TYPE.classesOnly().collectTypes(getRawTypes());
|
|
return ImmutableSet.copyOf(collectedTypes);
|
|
@@ -1124,7 +1124,7 @@ public abstract class TypeToken<T> extends TypeCapture<T> implements Serializabl
|
|
}
|
|
}.visit(runtimeType);
|
|
// Cast from ImmutableSet<Class<?>> to ImmutableSet<Class<? super T>>
|
|
- @SuppressWarnings({"unchecked", "rawtypes"})
|
|
+ @SuppressWarnings({"rawtypes", "unchecked"})
|
|
ImmutableSet<Class<? super T>> result = (ImmutableSet) builder.build();
|
|
return result;
|
|
}
|
|
@@ -1334,8 +1334,8 @@ public abstract class TypeToken<T> extends TypeCapture<T> implements Serializabl
|
|
return type.getGenericInterfaces();
|
|
}
|
|
|
|
- @Override
|
|
@CheckForNull
|
|
+ @Override
|
|
TypeToken<?> getSuperclass(TypeToken<?> type) {
|
|
return type.getGenericSuperclass();
|
|
}
|
|
@@ -1353,8 +1353,8 @@ public abstract class TypeToken<T> extends TypeCapture<T> implements Serializabl
|
|
return Arrays.asList(type.getInterfaces());
|
|
}
|
|
|
|
- @Override
|
|
@CheckForNull
|
|
+ @Override
|
|
Class<?> getSuperclass(Class<?> type) {
|
|
return type.getSuperclass();
|
|
}
|
|
@@ -1459,8 +1459,8 @@ public abstract class TypeToken<T> extends TypeCapture<T> implements Serializabl
|
|
return delegate.getInterfaces(type);
|
|
}
|
|
|
|
- @Override
|
|
@CheckForNull
|
|
+ @Override
|
|
K getSuperclass(K type) {
|
|
return delegate.getSuperclass(type);
|
|
}
|
|
diff --git a/guava/src/com/google/common/reflect/Types.java b/guava/src/com/google/common/reflect/Types.java
|
|
index e69b42a8e8..25a02d75b8 100644
|
|
--- a/guava/src/com/google/common/reflect/Types.java
|
|
+++ b/guava/src/com/google/common/reflect/Types.java
|
|
@@ -16,6 +16,7 @@ package com.google.common.reflect;
|
|
|
|
import static com.google.common.base.Preconditions.checkArgument;
|
|
import static com.google.common.base.Preconditions.checkNotNull;
|
|
+import static com.google.common.base.Predicates.not;
|
|
import static com.google.common.collect.Iterables.transform;
|
|
import static java.util.Objects.requireNonNull;
|
|
|
|
@@ -99,15 +100,15 @@ final class Types {
|
|
/** Decides what owner type to use for constructing {@link ParameterizedType} from a raw class. */
|
|
private enum ClassOwnership {
|
|
OWNED_BY_ENCLOSING_CLASS {
|
|
- @Override
|
|
@CheckForNull
|
|
+ @Override
|
|
Class<?> getOwnerType(Class<?> rawType) {
|
|
return rawType.getEnclosingClass();
|
|
}
|
|
},
|
|
LOCAL_CLASS_HAS_NO_OWNER {
|
|
- @Override
|
|
@CheckForNull
|
|
+ @Override
|
|
Class<?> getOwnerType(Class<?> rawType) {
|
|
if (rawType.isLocalClass()) {
|
|
return null;
|
|
@@ -279,8 +280,8 @@ final class Types {
|
|
return rawType;
|
|
}
|
|
|
|
- @Override
|
|
@CheckForNull
|
|
+ @Override
|
|
public Type getOwnerType() {
|
|
return ownerType;
|
|
}
|
|
@@ -381,8 +382,8 @@ final class Types {
|
|
this.typeVariableImpl = typeVariableImpl;
|
|
}
|
|
|
|
- @Override
|
|
@CheckForNull
|
|
+ @Override
|
|
public Object invoke(Object proxy, Method method, @CheckForNull @Nullable Object[] args)
|
|
throws Throwable {
|
|
String methodName = method.getName();
|
|
@@ -522,7 +523,7 @@ final class Types {
|
|
}
|
|
|
|
private static Iterable<Type> filterUpperBounds(Iterable<Type> bounds) {
|
|
- return Iterables.filter(bounds, Predicates.not(Predicates.<Type>equalTo(Object.class)));
|
|
+ return Iterables.filter(bounds, not(Predicates.<Type>equalTo(Object.class)));
|
|
}
|
|
|
|
private static void disallowPrimitiveType(Type[] types, String usedAs) {
|
|
diff --git a/guava/src/com/google/common/util/concurrent/AbstractCatchingFuture.java b/guava/src/com/google/common/util/concurrent/AbstractCatchingFuture.java
|
|
index 76eada2140..0a56befc1d 100644
|
|
--- a/guava/src/com/google/common/util/concurrent/AbstractCatchingFuture.java
|
|
+++ b/guava/src/com/google/common/util/concurrent/AbstractCatchingFuture.java
|
|
@@ -142,8 +142,8 @@ abstract class AbstractCatchingFuture<
|
|
setResult(fallbackResult);
|
|
}
|
|
|
|
- @Override
|
|
@CheckForNull
|
|
+ @Override
|
|
protected String pendingToString() {
|
|
ListenableFuture<? extends V> localInputFuture = inputFuture;
|
|
Class<X> localExceptionType = exceptionType;
|
|
diff --git a/guava/src/com/google/common/util/concurrent/AbstractFuture.java b/guava/src/com/google/common/util/concurrent/AbstractFuture.java
|
|
index fc408a92d2..71519daccb 100644
|
|
--- a/guava/src/com/google/common/util/concurrent/AbstractFuture.java
|
|
+++ b/guava/src/com/google/common/util/concurrent/AbstractFuture.java
|
|
@@ -67,12 +67,9 @@ import org.checkerframework.checker.nullness.qual.Nullable;
|
|
* @author Luke Sandberg
|
|
* @since 1.0
|
|
*/
|
|
-@SuppressWarnings({
|
|
- "ShortCircuitBoolean", // we use non-short circuiting comparisons intentionally
|
|
- "nullness", // TODO(b/147136275): Remove once our checker understands & and |.
|
|
-})
|
|
+@SuppressWarnings({"nullness", "ShortCircuitBoolean"})
|
|
@GwtCompatible(emulated = true)
|
|
-@ReflectionSupport(value = ReflectionSupport.Level.FULL)
|
|
+@ReflectionSupport(ReflectionSupport.Level.FULL)
|
|
@ElementTypesAreNonnullByDefault
|
|
public abstract class AbstractFuture<V extends @Nullable Object> extends InternalFutureFailureAccess
|
|
implements ListenableFuture<V> {
|
|
@@ -1078,13 +1075,13 @@ public abstract class AbstractFuture<V extends @Nullable Object> extends Interna
|
|
*
|
|
* @since 27.0
|
|
*/
|
|
- @Override
|
|
+ @CheckForNull
|
|
/*
|
|
* We should annotate the superclass, InternalFutureFailureAccess, to say that its copy of this
|
|
* method returns @Nullable, too. However, we're not sure if we want to make any changes to that
|
|
* class, since it's in a separate artifact that we planned to release only a single version of.
|
|
*/
|
|
- @CheckForNull
|
|
+ @Override
|
|
protected final Throwable tryInternalFastPathGetFailure() {
|
|
if (this instanceof Trusted) {
|
|
Object obj = value;
|
|
diff --git a/guava/src/com/google/common/util/concurrent/AbstractScheduledService.java b/guava/src/com/google/common/util/concurrent/AbstractScheduledService.java
|
|
index 65d29c38bc..c14b229e4f 100644
|
|
--- a/guava/src/com/google/common/util/concurrent/AbstractScheduledService.java
|
|
+++ b/guava/src/com/google/common/util/concurrent/AbstractScheduledService.java
|
|
@@ -596,8 +596,8 @@ public abstract class AbstractScheduledService implements Service {
|
|
this.service = service;
|
|
}
|
|
|
|
- @Override
|
|
@CheckForNull
|
|
+ @Override
|
|
public Void call() throws Exception {
|
|
wrappedRunnable.run();
|
|
reschedule();
|
|
diff --git a/guava/src/com/google/common/util/concurrent/AbstractTransformFuture.java b/guava/src/com/google/common/util/concurrent/AbstractTransformFuture.java
|
|
index 841c1acad0..79d04deced 100644
|
|
--- a/guava/src/com/google/common/util/concurrent/AbstractTransformFuture.java
|
|
+++ b/guava/src/com/google/common/util/concurrent/AbstractTransformFuture.java
|
|
@@ -184,8 +184,8 @@ abstract class AbstractTransformFuture<
|
|
this.function = null;
|
|
}
|
|
|
|
- @Override
|
|
@CheckForNull
|
|
+ @Override
|
|
protected String pendingToString() {
|
|
ListenableFuture<? extends I> localInputFuture = inputFuture;
|
|
F localFunction = function;
|
|
diff --git a/guava/src/com/google/common/util/concurrent/AggregateFuture.java b/guava/src/com/google/common/util/concurrent/AggregateFuture.java
|
|
index 6d2ed9c8e8..b7ec706b58 100644
|
|
--- a/guava/src/com/google/common/util/concurrent/AggregateFuture.java
|
|
+++ b/guava/src/com/google/common/util/concurrent/AggregateFuture.java
|
|
@@ -90,8 +90,8 @@ abstract class AggregateFuture<InputT extends @Nullable Object, OutputT extends
|
|
*/
|
|
}
|
|
|
|
- @Override
|
|
@CheckForNull
|
|
+ @Override
|
|
protected final String pendingToString() {
|
|
ImmutableCollection<? extends Future<?>> localFutures = futures;
|
|
if (localFutures != null) {
|
|
diff --git a/guava/src/com/google/common/util/concurrent/AggregateFutureState.java b/guava/src/com/google/common/util/concurrent/AggregateFutureState.java
|
|
index ee23ca021e..332fb45ea8 100644
|
|
--- a/guava/src/com/google/common/util/concurrent/AggregateFutureState.java
|
|
+++ b/guava/src/com/google/common/util/concurrent/AggregateFutureState.java
|
|
@@ -39,7 +39,7 @@ import org.checkerframework.checker.nullness.qual.Nullable;
|
|
* </ul>
|
|
*/
|
|
@GwtCompatible(emulated = true)
|
|
-@ReflectionSupport(value = ReflectionSupport.Level.FULL)
|
|
+@ReflectionSupport(ReflectionSupport.Level.FULL)
|
|
@ElementTypesAreNonnullByDefault
|
|
abstract class AggregateFutureState<OutputT extends @Nullable Object>
|
|
extends AbstractFuture.TrustedFuture<OutputT> {
|
|
diff --git a/guava/src/com/google/common/util/concurrent/AtomicDouble.java b/guava/src/com/google/common/util/concurrent/AtomicDouble.java
|
|
index 56360a8703..e843064afc 100644
|
|
--- a/guava/src/com/google/common/util/concurrent/AtomicDouble.java
|
|
+++ b/guava/src/com/google/common/util/concurrent/AtomicDouble.java
|
|
@@ -55,7 +55,7 @@ import java.util.function.DoubleUnaryOperator;
|
|
* @since 11.0
|
|
*/
|
|
@GwtIncompatible
|
|
-@ReflectionSupport(value = ReflectionSupport.Level.FULL)
|
|
+@ReflectionSupport(ReflectionSupport.Level.FULL)
|
|
@ElementTypesAreNonnullByDefault
|
|
public class AtomicDouble extends Number implements java.io.Serializable {
|
|
private static final long serialVersionUID = 0L;
|
|
diff --git a/guava/src/com/google/common/util/concurrent/AtomicLongMap.java b/guava/src/com/google/common/util/concurrent/AtomicLongMap.java
|
|
index 456b3aceb1..63bf500f68 100644
|
|
--- a/guava/src/com/google/common/util/concurrent/AtomicLongMap.java
|
|
+++ b/guava/src/com/google/common/util/concurrent/AtomicLongMap.java
|
|
@@ -17,12 +17,12 @@
|
|
package com.google.common.util.concurrent;
|
|
|
|
import static com.google.common.base.Preconditions.checkNotNull;
|
|
+import static java.util.Collections.unmodifiableMap;
|
|
|
|
import com.google.common.annotations.Beta;
|
|
import com.google.common.annotations.GwtCompatible;
|
|
import com.google.errorprone.annotations.CanIgnoreReturnValue;
|
|
import java.io.Serializable;
|
|
-import java.util.Collections;
|
|
import java.util.Map;
|
|
import java.util.concurrent.ConcurrentHashMap;
|
|
import java.util.concurrent.atomic.AtomicBoolean;
|
|
@@ -272,7 +272,7 @@ public final class AtomicLongMap<K> implements Serializable {
|
|
}
|
|
|
|
private Map<K, Long> createAsMap() {
|
|
- return Collections.unmodifiableMap(map);
|
|
+ return unmodifiableMap(map);
|
|
}
|
|
|
|
/** Returns true if this map contains a mapping for the specified key. */
|
|
diff --git a/guava/src/com/google/common/util/concurrent/CycleDetectingLockFactory.java b/guava/src/com/google/common/util/concurrent/CycleDetectingLockFactory.java
|
|
index 7989bf3a0a..54db8edc0b 100644
|
|
--- a/guava/src/com/google/common/util/concurrent/CycleDetectingLockFactory.java
|
|
+++ b/guava/src/com/google/common/util/concurrent/CycleDetectingLockFactory.java
|
|
@@ -15,13 +15,14 @@
|
|
package com.google.common.util.concurrent;
|
|
|
|
import static com.google.common.base.Preconditions.checkNotNull;
|
|
+import static com.google.common.base.Preconditions.checkState;
|
|
+import static java.util.Collections.unmodifiableMap;
|
|
import static java.util.Objects.requireNonNull;
|
|
|
|
import com.google.common.annotations.Beta;
|
|
import com.google.common.annotations.GwtIncompatible;
|
|
import com.google.common.annotations.VisibleForTesting;
|
|
import com.google.common.base.MoreObjects;
|
|
-import com.google.common.base.Preconditions;
|
|
import com.google.common.collect.ImmutableSet;
|
|
import com.google.common.collect.Lists;
|
|
import com.google.common.collect.MapMaker;
|
|
@@ -31,7 +32,6 @@ import com.google.errorprone.annotations.CanIgnoreReturnValue;
|
|
import com.google.j2objc.annotations.Weak;
|
|
import java.util.ArrayList;
|
|
import java.util.Arrays;
|
|
-import java.util.Collections;
|
|
import java.util.EnumMap;
|
|
import java.util.List;
|
|
import java.util.Map;
|
|
@@ -324,7 +324,7 @@ public class CycleDetectingLockFactory {
|
|
for (int i = 0; i < numKeys - 1; i++) {
|
|
nodes.get(i).checkAcquiredLocks(Policies.DISABLED, nodes.subList(i + 1, numKeys));
|
|
}
|
|
- return Collections.unmodifiableMap(map);
|
|
+ return unmodifiableMap(map);
|
|
}
|
|
|
|
/**
|
|
@@ -606,7 +606,7 @@ public class CycleDetectingLockFactory {
|
|
final String lockName;
|
|
|
|
LockGraphNode(String lockName) {
|
|
- this.lockName = Preconditions.checkNotNull(lockName);
|
|
+ this.lockName = checkNotNull(lockName);
|
|
}
|
|
|
|
String getLockName() {
|
|
@@ -635,7 +635,7 @@ public class CycleDetectingLockFactory {
|
|
// can happen because multiple locks may share the same LockGraphNode. In
|
|
// this situation, throw an IllegalStateException as defined by contract
|
|
// described in the documentation of WithExplicitOrdering.
|
|
- Preconditions.checkState(
|
|
+ checkState(
|
|
this != acquiredLock,
|
|
"Attempted to acquire multiple locks with the same rank %s",
|
|
acquiredLock.getLockName());
|
|
@@ -754,7 +754,7 @@ public class CycleDetectingLockFactory {
|
|
|
|
private CycleDetectingReentrantLock(LockGraphNode lockGraphNode, boolean fair) {
|
|
super(fair);
|
|
- this.lockGraphNode = Preconditions.checkNotNull(lockGraphNode);
|
|
+ this.lockGraphNode = checkNotNull(lockGraphNode);
|
|
}
|
|
|
|
///// CycleDetectingLock methods. /////
|
|
@@ -837,7 +837,7 @@ public class CycleDetectingLockFactory {
|
|
super(fair);
|
|
this.readLock = new CycleDetectingReentrantReadLock(this);
|
|
this.writeLock = new CycleDetectingReentrantWriteLock(this);
|
|
- this.lockGraphNode = Preconditions.checkNotNull(lockGraphNode);
|
|
+ this.lockGraphNode = checkNotNull(lockGraphNode);
|
|
}
|
|
|
|
///// Overridden ReentrantReadWriteLock methods. /////
|
|
diff --git a/guava/src/com/google/common/util/concurrent/ExecutionSequencer.java b/guava/src/com/google/common/util/concurrent/ExecutionSequencer.java
|
|
index 80c7779342..e471b7b202 100644
|
|
--- a/guava/src/com/google/common/util/concurrent/ExecutionSequencer.java
|
|
+++ b/guava/src/com/google/common/util/concurrent/ExecutionSequencer.java
|
|
@@ -369,8 +369,8 @@ public final class ExecutionSequencer {
|
|
}
|
|
}
|
|
|
|
- @SuppressWarnings("ShortCircuitBoolean")
|
|
@Override
|
|
+ @SuppressWarnings("ShortCircuitBoolean")
|
|
public void run() {
|
|
Thread currentThread = Thread.currentThread();
|
|
if (currentThread != submitting) {
|
|
diff --git a/guava/src/com/google/common/util/concurrent/FluentFuture.java b/guava/src/com/google/common/util/concurrent/FluentFuture.java
|
|
index b47e67927f..b194ed02d0 100644
|
|
--- a/guava/src/com/google/common/util/concurrent/FluentFuture.java
|
|
+++ b/guava/src/com/google/common/util/concurrent/FluentFuture.java
|
|
@@ -184,8 +184,8 @@ public abstract class FluentFuture<V extends @Nullable Object>
|
|
* {@code get()} throws a different kind of exception, that exception itself.
|
|
* @param executor the executor that runs {@code fallback} if the input fails
|
|
*/
|
|
- @Partially.GwtIncompatible("AVAILABLE but requires exceptionType to be Throwable.class")
|
|
@Beta
|
|
+ @Partially.GwtIncompatible("AVAILABLE but requires exceptionType to be Throwable.class")
|
|
public final <X extends Throwable> FluentFuture<V> catching(
|
|
Class<X> exceptionType, Function<? super X, ? extends V> fallback, Executor executor) {
|
|
return (FluentFuture<V>) Futures.catching(this, exceptionType, fallback, executor);
|
|
@@ -249,8 +249,8 @@ public abstract class FluentFuture<V extends @Nullable Object>
|
|
* {@code get()} throws a different kind of exception, that exception itself.
|
|
* @param executor the executor that runs {@code fallback} if the input fails
|
|
*/
|
|
- @Partially.GwtIncompatible("AVAILABLE but requires exceptionType to be Throwable.class")
|
|
@Beta
|
|
+ @Partially.GwtIncompatible("AVAILABLE but requires exceptionType to be Throwable.class")
|
|
public final <X extends Throwable> FluentFuture<V> catchingAsync(
|
|
Class<X> exceptionType, AsyncFunction<? super X, ? extends V> fallback, Executor executor) {
|
|
return (FluentFuture<V>) Futures.catchingAsync(this, exceptionType, fallback, executor);
|
|
@@ -266,8 +266,8 @@ public abstract class FluentFuture<V extends @Nullable Object>
|
|
* @param scheduledExecutor The executor service to enforce the timeout.
|
|
* @since 28.0
|
|
*/
|
|
- @GwtIncompatible // ScheduledExecutorService
|
|
- @Beta
|
|
+ @Beta // ScheduledExecutorService
|
|
+ @GwtIncompatible
|
|
public final FluentFuture<V> withTimeout(
|
|
Duration timeout, ScheduledExecutorService scheduledExecutor) {
|
|
return withTimeout(toNanosSaturated(timeout), TimeUnit.NANOSECONDS, scheduledExecutor);
|
|
@@ -283,9 +283,9 @@ public abstract class FluentFuture<V extends @Nullable Object>
|
|
* @param unit the time unit of the time parameter
|
|
* @param scheduledExecutor The executor service to enforce the timeout.
|
|
*/
|
|
- @GwtIncompatible // ScheduledExecutorService
|
|
- @SuppressWarnings("GoodTime") // should accept a java.time.Duration
|
|
- @Beta
|
|
+ @Beta // ScheduledExecutorService
|
|
+ @GwtIncompatible // should accept a java.time.Duration
|
|
+ @SuppressWarnings("GoodTime")
|
|
public final FluentFuture<V> withTimeout(
|
|
long timeout, TimeUnit unit, ScheduledExecutorService scheduledExecutor) {
|
|
return (FluentFuture<V>) Futures.withTimeout(this, timeout, unit, scheduledExecutor);
|
|
diff --git a/guava/src/com/google/common/util/concurrent/ForwardingBlockingDeque.java b/guava/src/com/google/common/util/concurrent/ForwardingBlockingDeque.java
|
|
index d0d72a8159..2ee8902208 100644
|
|
--- a/guava/src/com/google/common/util/concurrent/ForwardingBlockingDeque.java
|
|
+++ b/guava/src/com/google/common/util/concurrent/ForwardingBlockingDeque.java
|
|
@@ -90,14 +90,14 @@ public abstract class ForwardingBlockingDeque<E> extends ForwardingDeque<E>
|
|
return delegate().takeLast();
|
|
}
|
|
|
|
- @Override
|
|
@CheckForNull
|
|
+ @Override
|
|
public E pollFirst(long timeout, TimeUnit unit) throws InterruptedException {
|
|
return delegate().pollFirst(timeout, unit);
|
|
}
|
|
|
|
- @Override
|
|
@CheckForNull
|
|
+ @Override
|
|
public E pollLast(long timeout, TimeUnit unit) throws InterruptedException {
|
|
return delegate().pollLast(timeout, unit);
|
|
}
|
|
@@ -117,8 +117,8 @@ public abstract class ForwardingBlockingDeque<E> extends ForwardingDeque<E>
|
|
return delegate().take();
|
|
}
|
|
|
|
- @Override
|
|
@CheckForNull
|
|
+ @Override
|
|
public E poll(long timeout, TimeUnit unit) throws InterruptedException {
|
|
return delegate().poll(timeout, unit);
|
|
}
|
|
diff --git a/guava/src/com/google/common/util/concurrent/ForwardingBlockingQueue.java b/guava/src/com/google/common/util/concurrent/ForwardingBlockingQueue.java
|
|
index dc8511d94c..676b874e1a 100644
|
|
--- a/guava/src/com/google/common/util/concurrent/ForwardingBlockingQueue.java
|
|
+++ b/guava/src/com/google/common/util/concurrent/ForwardingBlockingQueue.java
|
|
@@ -63,8 +63,8 @@ public abstract class ForwardingBlockingQueue<E> extends ForwardingQueue<E>
|
|
return delegate().offer(e, timeout, unit);
|
|
}
|
|
|
|
- @Override
|
|
@CheckForNull
|
|
+ @Override
|
|
public E poll(long timeout, TimeUnit unit) throws InterruptedException {
|
|
return delegate().poll(timeout, unit);
|
|
}
|
|
diff --git a/guava/src/com/google/common/util/concurrent/ForwardingFuture.java b/guava/src/com/google/common/util/concurrent/ForwardingFuture.java
|
|
index 47002b03a3..fc08ae9328 100644
|
|
--- a/guava/src/com/google/common/util/concurrent/ForwardingFuture.java
|
|
+++ b/guava/src/com/google/common/util/concurrent/ForwardingFuture.java
|
|
@@ -14,8 +14,9 @@
|
|
|
|
package com.google.common.util.concurrent;
|
|
|
|
+import static com.google.common.base.Preconditions.checkNotNull;
|
|
+
|
|
import com.google.common.annotations.GwtCompatible;
|
|
-import com.google.common.base.Preconditions;
|
|
import com.google.common.collect.ForwardingObject;
|
|
import com.google.errorprone.annotations.CanIgnoreReturnValue;
|
|
import java.util.concurrent.ExecutionException;
|
|
@@ -85,7 +86,7 @@ public abstract class ForwardingFuture<V extends @Nullable Object> extends Forwa
|
|
private final Future<V> delegate;
|
|
|
|
protected SimpleForwardingFuture(Future<V> delegate) {
|
|
- this.delegate = Preconditions.checkNotNull(delegate);
|
|
+ this.delegate = checkNotNull(delegate);
|
|
}
|
|
|
|
@Override
|
|
diff --git a/guava/src/com/google/common/util/concurrent/ForwardingListenableFuture.java b/guava/src/com/google/common/util/concurrent/ForwardingListenableFuture.java
|
|
index 386809194b..83c001bc9e 100644
|
|
--- a/guava/src/com/google/common/util/concurrent/ForwardingListenableFuture.java
|
|
+++ b/guava/src/com/google/common/util/concurrent/ForwardingListenableFuture.java
|
|
@@ -14,8 +14,9 @@
|
|
|
|
package com.google.common.util.concurrent;
|
|
|
|
+import static com.google.common.base.Preconditions.checkNotNull;
|
|
+
|
|
import com.google.common.annotations.GwtCompatible;
|
|
-import com.google.common.base.Preconditions;
|
|
import com.google.errorprone.annotations.CanIgnoreReturnValue;
|
|
import java.util.concurrent.Executor;
|
|
import org.checkerframework.checker.nullness.qual.Nullable;
|
|
@@ -59,7 +60,7 @@ public abstract class ForwardingListenableFuture<V extends @Nullable Object>
|
|
private final ListenableFuture<V> delegate;
|
|
|
|
protected SimpleForwardingListenableFuture(ListenableFuture<V> delegate) {
|
|
- this.delegate = Preconditions.checkNotNull(delegate);
|
|
+ this.delegate = checkNotNull(delegate);
|
|
}
|
|
|
|
@Override
|
|
diff --git a/guava/src/com/google/common/util/concurrent/Futures.java b/guava/src/com/google/common/util/concurrent/Futures.java
|
|
index 09b5c3c1a4..8c3c053610 100644
|
|
--- a/guava/src/com/google/common/util/concurrent/Futures.java
|
|
+++ b/guava/src/com/google/common/util/concurrent/Futures.java
|
|
@@ -26,7 +26,6 @@ import com.google.common.annotations.GwtCompatible;
|
|
import com.google.common.annotations.GwtIncompatible;
|
|
import com.google.common.base.Function;
|
|
import com.google.common.base.MoreObjects;
|
|
-import com.google.common.base.Preconditions;
|
|
import com.google.common.collect.ImmutableList;
|
|
import com.google.common.util.concurrent.CollectionFuture.ListFuture;
|
|
import com.google.common.util.concurrent.ImmediateFuture.ImmediateCancelledFuture;
|
|
@@ -759,8 +758,8 @@ public final class Futures extends GwtFuturesCatchingSpecialization {
|
|
public ListenableFuture<?> run(final Runnable combiner, Executor executor) {
|
|
return call(
|
|
new Callable<@Nullable Void>() {
|
|
- @Override
|
|
@CheckForNull
|
|
+ @Override
|
|
public Void call() throws Exception {
|
|
combiner.run();
|
|
return null;
|
|
@@ -806,8 +805,8 @@ public final class Futures extends GwtFuturesCatchingSpecialization {
|
|
}
|
|
}
|
|
|
|
- @Override
|
|
@CheckForNull
|
|
+ @Override
|
|
protected String pendingToString() {
|
|
ListenableFuture<V> localDelegate = delegate;
|
|
if (localDelegate != null) {
|
|
@@ -979,8 +978,8 @@ public final class Futures extends GwtFuturesCatchingSpecialization {
|
|
state = null;
|
|
}
|
|
|
|
- @Override
|
|
@CheckForNull
|
|
+ @Override
|
|
protected String pendingToString() {
|
|
InCompletionOrderState<T> localState = state;
|
|
if (localState != null) {
|
|
@@ -1101,7 +1100,7 @@ public final class Futures extends GwtFuturesCatchingSpecialization {
|
|
final ListenableFuture<V> future,
|
|
final FutureCallback<? super V> callback,
|
|
Executor executor) {
|
|
- Preconditions.checkNotNull(callback);
|
|
+ checkNotNull(callback);
|
|
future.addListener(new CallbackListener<V>(future, callback), executor);
|
|
}
|
|
|
|
@@ -1330,8 +1329,8 @@ public final class Futures extends GwtFuturesCatchingSpecialization {
|
|
@Beta
|
|
@CanIgnoreReturnValue
|
|
@GwtIncompatible // reflection
|
|
- @SuppressWarnings("GoodTime") // should accept a java.time.Duration
|
|
- @ParametricNullness
|
|
+ @ParametricNullness // should accept a java.time.Duration
|
|
+ @SuppressWarnings("GoodTime")
|
|
public static <V extends @Nullable Object, X extends Exception> V getChecked(
|
|
Future<V> future, Class<X> exceptionClass, long timeout, TimeUnit unit) throws X {
|
|
return FuturesGetChecked.getChecked(future, exceptionClass, timeout, unit);
|
|
diff --git a/guava/src/com/google/common/util/concurrent/FuturesGetChecked.java b/guava/src/com/google/common/util/concurrent/FuturesGetChecked.java
|
|
index 6f09b8066d..bc3470ea78 100644
|
|
--- a/guava/src/com/google/common/util/concurrent/FuturesGetChecked.java
|
|
+++ b/guava/src/com/google/common/util/concurrent/FuturesGetChecked.java
|
|
@@ -51,8 +51,8 @@ final class FuturesGetChecked {
|
|
|
|
/** Implementation of {@link Futures#getChecked(Future, Class)}. */
|
|
@CanIgnoreReturnValue
|
|
- @VisibleForTesting
|
|
@ParametricNullness
|
|
+ @VisibleForTesting
|
|
static <V extends @Nullable Object, X extends Exception> V getChecked(
|
|
GetCheckedTypeValidator validator, Future<V> future, Class<X> exceptionClass) throws X {
|
|
validator.validateClass(exceptionClass);
|
|
@@ -228,7 +228,7 @@ final class FuturesGetChecked {
|
|
|
|
private static <X extends Exception> X newWithCause(Class<X> exceptionClass, Throwable cause) {
|
|
// getConstructors() guarantees this as long as we don't modify the array.
|
|
- @SuppressWarnings({"unchecked", "rawtypes"})
|
|
+ @SuppressWarnings({"rawtypes", "unchecked"})
|
|
List<Constructor<X>> constructors = (List) Arrays.asList(exceptionClass.getConstructors());
|
|
for (Constructor<X> constructor : preferringStrings(constructors)) {
|
|
X instance = newFromConstructor(constructor, cause);
|
|
diff --git a/guava/src/com/google/common/util/concurrent/InterruptibleTask.java b/guava/src/com/google/common/util/concurrent/InterruptibleTask.java
|
|
index bcec007303..6fbf846bcd 100644
|
|
--- a/guava/src/com/google/common/util/concurrent/InterruptibleTask.java
|
|
+++ b/guava/src/com/google/common/util/concurrent/InterruptibleTask.java
|
|
@@ -25,7 +25,7 @@ import java.util.concurrent.locks.LockSupport;
|
|
import org.checkerframework.checker.nullness.qual.Nullable;
|
|
|
|
@GwtCompatible(emulated = true)
|
|
-@ReflectionSupport(value = ReflectionSupport.Level.FULL)
|
|
+@ReflectionSupport(ReflectionSupport.Level.FULL)
|
|
@ElementTypesAreNonnullByDefault
|
|
// Some Android 5.0.x Samsung devices have bugs in JDK reflection APIs that cause
|
|
// getDeclaredField to throw a NoSuchFieldException when the field is definitely there.
|
|
@@ -52,8 +52,8 @@ abstract class InterruptibleTask<T extends @Nullable Object>
|
|
// Why 1000? WHY NOT!
|
|
private static final int MAX_BUSY_WAIT_SPINS = 1000;
|
|
|
|
- @SuppressWarnings("ThreadPriorityCheck") // The cow told me to
|
|
- @Override
|
|
+ @Override // The cow told me to
|
|
+ @SuppressWarnings("ThreadPriorityCheck")
|
|
public final void run() {
|
|
/*
|
|
* Set runner thread before checking isDone(). If we were to check isDone() first, the task
|
|
diff --git a/guava/src/com/google/common/util/concurrent/ListenerCallQueue.java b/guava/src/com/google/common/util/concurrent/ListenerCallQueue.java
|
|
index ed8c9065ac..ef7bcd1977 100644
|
|
--- a/guava/src/com/google/common/util/concurrent/ListenerCallQueue.java
|
|
+++ b/guava/src/com/google/common/util/concurrent/ListenerCallQueue.java
|
|
@@ -15,13 +15,13 @@
|
|
package com.google.common.util.concurrent;
|
|
|
|
import static com.google.common.base.Preconditions.checkNotNull;
|
|
+import static com.google.common.base.Preconditions.checkState;
|
|
+import static java.util.Collections.synchronizedList;
|
|
|
|
import com.google.common.annotations.GwtIncompatible;
|
|
-import com.google.common.base.Preconditions;
|
|
import com.google.common.collect.Queues;
|
|
import com.google.errorprone.annotations.concurrent.GuardedBy;
|
|
import java.util.ArrayList;
|
|
-import java.util.Collections;
|
|
import java.util.List;
|
|
import java.util.Queue;
|
|
import java.util.concurrent.Executor;
|
|
@@ -60,7 +60,7 @@ final class ListenerCallQueue<L> {
|
|
|
|
// TODO(chrisn): promote AppendOnlyCollection for use here.
|
|
private final List<PerListenerQueue<L>> listeners =
|
|
- Collections.synchronizedList(new ArrayList<PerListenerQueue<L>>());
|
|
+ synchronizedList(new ArrayList<PerListenerQueue<L>>());
|
|
|
|
/** Method reference-compatible listener event. */
|
|
interface Event<L> {
|
|
@@ -191,7 +191,7 @@ final class ListenerCallQueue<L> {
|
|
ListenerCallQueue.Event<L> nextToRun;
|
|
Object nextLabel;
|
|
synchronized (PerListenerQueue.this) {
|
|
- Preconditions.checkState(isThreadScheduled);
|
|
+ checkState(isThreadScheduled);
|
|
nextToRun = waitQueue.poll();
|
|
nextLabel = labelQueue.poll();
|
|
if (nextToRun == null) {
|
|
diff --git a/guava/src/com/google/common/util/concurrent/MoreExecutors.java b/guava/src/com/google/common/util/concurrent/MoreExecutors.java
|
|
index 90776bc9e6..d5d46ab499 100644
|
|
--- a/guava/src/com/google/common/util/concurrent/MoreExecutors.java
|
|
+++ b/guava/src/com/google/common/util/concurrent/MoreExecutors.java
|
|
@@ -17,6 +17,7 @@ package com.google.common.util.concurrent;
|
|
import static com.google.common.base.Preconditions.checkArgument;
|
|
import static com.google.common.base.Preconditions.checkNotNull;
|
|
import static com.google.common.util.concurrent.Internal.toNanosSaturated;
|
|
+import static java.util.Collections.emptyList;
|
|
|
|
import com.google.common.annotations.Beta;
|
|
import com.google.common.annotations.GwtCompatible;
|
|
@@ -32,7 +33,6 @@ import com.google.errorprone.annotations.concurrent.GuardedBy;
|
|
import java.lang.reflect.InvocationTargetException;
|
|
import java.time.Duration;
|
|
import java.util.Collection;
|
|
-import java.util.Collections;
|
|
import java.util.Iterator;
|
|
import java.util.List;
|
|
import java.util.concurrent.BlockingQueue;
|
|
@@ -347,7 +347,7 @@ public final class MoreExecutors {
|
|
@Override
|
|
public List<Runnable> shutdownNow() {
|
|
shutdown();
|
|
- return Collections.emptyList();
|
|
+ return emptyList();
|
|
}
|
|
|
|
@Override
|
|
@@ -772,9 +772,9 @@ public final class MoreExecutors {
|
|
* An implementation of {@link ExecutorService#invokeAny} for {@link ListeningExecutorService}
|
|
* implementations.
|
|
*/
|
|
- @SuppressWarnings("GoodTime") // should accept a java.time.Duration
|
|
- @GwtIncompatible
|
|
+ @GwtIncompatible // should accept a java.time.Duration
|
|
@ParametricNullness
|
|
+ @SuppressWarnings("GoodTime")
|
|
static <T extends @Nullable Object> T invokeAnyImpl(
|
|
ListeningExecutorService executorService,
|
|
Collection<? extends Callable<T>> tasks,
|
|
diff --git a/guava/src/com/google/common/util/concurrent/NullnessCasts.java b/guava/src/com/google/common/util/concurrent/NullnessCasts.java
|
|
index a3a914e897..a72f7a1459 100644
|
|
--- a/guava/src/com/google/common/util/concurrent/NullnessCasts.java
|
|
+++ b/guava/src/com/google/common/util/concurrent/NullnessCasts.java
|
|
@@ -50,8 +50,8 @@ final class NullnessCasts {
|
|
* addressed by this method is the case in which {@code T} has parametric nullness -- and thus its
|
|
* value may be legitimately {@code null}.)
|
|
*/
|
|
- @SuppressWarnings("nullness")
|
|
@ParametricNullness
|
|
+ @SuppressWarnings("nullness")
|
|
static <T extends @Nullable Object> T uncheckedCastNullableTToT(@CheckForNull T t) {
|
|
return t;
|
|
}
|
|
@@ -65,9 +65,9 @@ final class NullnessCasts {
|
|
* return to a caller, the code needs to a way to return {@code null} from a method that returns
|
|
* "plain {@code T}." This API provides that.
|
|
*/
|
|
- @SuppressWarnings({"nullness", "TypeParameterUnusedInFormals", "ReturnMissingNullable"})
|
|
- // The warnings are legitimate. Each time we use this method, we document why.
|
|
@ParametricNullness
|
|
+ // The warnings are legitimate. Each time we use this method, we document why.
|
|
+ @SuppressWarnings({"nullness", "ReturnMissingNullable", "TypeParameterUnusedInFormals"})
|
|
static <T extends @Nullable Object> T uncheckedNull() {
|
|
return null;
|
|
}
|
|
diff --git a/guava/src/com/google/common/util/concurrent/SequentialExecutor.java b/guava/src/com/google/common/util/concurrent/SequentialExecutor.java
|
|
index d0b600be84..84e43f4ea6 100644
|
|
--- a/guava/src/com/google/common/util/concurrent/SequentialExecutor.java
|
|
+++ b/guava/src/com/google/common/util/concurrent/SequentialExecutor.java
|
|
@@ -22,7 +22,6 @@ import static com.google.common.util.concurrent.SequentialExecutor.WorkerRunning
|
|
import static java.lang.System.identityHashCode;
|
|
|
|
import com.google.common.annotations.GwtIncompatible;
|
|
-import com.google.common.base.Preconditions;
|
|
import com.google.errorprone.annotations.concurrent.GuardedBy;
|
|
import com.google.j2objc.annotations.RetainedWith;
|
|
import java.util.ArrayDeque;
|
|
@@ -86,7 +85,7 @@ final class SequentialExecutor implements Executor {
|
|
|
|
/** Use {@link MoreExecutors#newSequentialExecutor} */
|
|
SequentialExecutor(Executor executor) {
|
|
- this.executor = Preconditions.checkNotNull(executor);
|
|
+ this.executor = checkNotNull(executor);
|
|
}
|
|
|
|
/**
|
|
@@ -249,8 +248,8 @@ final class SequentialExecutor implements Executor {
|
|
}
|
|
}
|
|
|
|
- @SuppressWarnings("GuardedBy")
|
|
@Override
|
|
+ @SuppressWarnings("GuardedBy")
|
|
public String toString() {
|
|
Runnable currentlyRunning = task;
|
|
if (currentlyRunning != null) {
|
|
diff --git a/guava/src/com/google/common/util/concurrent/ServiceManager.java b/guava/src/com/google/common/util/concurrent/ServiceManager.java
|
|
index 5ab95ffa6b..69206920a0 100644
|
|
--- a/guava/src/com/google/common/util/concurrent/ServiceManager.java
|
|
+++ b/guava/src/com/google/common/util/concurrent/ServiceManager.java
|
|
@@ -485,8 +485,8 @@ public final class ServiceManager implements ServiceManagerBridge {
|
|
super(ServiceManagerState.this.monitor);
|
|
}
|
|
|
|
- @Override
|
|
@GuardedBy("ServiceManagerState.this.monitor")
|
|
+ @Override
|
|
public boolean isSatisfied() {
|
|
// All services have started or some service has terminated/failed.
|
|
return states.count(RUNNING) == numberOfServices
|
|
@@ -505,8 +505,8 @@ public final class ServiceManager implements ServiceManagerBridge {
|
|
super(ServiceManagerState.this.monitor);
|
|
}
|
|
|
|
- @Override
|
|
@GuardedBy("ServiceManagerState.this.monitor")
|
|
+ @Override
|
|
public boolean isSatisfied() {
|
|
return states.count(TERMINATED) + states.count(FAILED) == numberOfServices;
|
|
}
|
|
diff --git a/guava/src/com/google/common/util/concurrent/SimpleTimeLimiter.java b/guava/src/com/google/common/util/concurrent/SimpleTimeLimiter.java
|
|
index c6ade6a3a0..e96903a0cd 100644
|
|
--- a/guava/src/com/google/common/util/concurrent/SimpleTimeLimiter.java
|
|
+++ b/guava/src/com/google/common/util/concurrent/SimpleTimeLimiter.java
|
|
@@ -84,8 +84,8 @@ public final class SimpleTimeLimiter implements TimeLimiter {
|
|
|
|
InvocationHandler handler =
|
|
new InvocationHandler() {
|
|
- @Override
|
|
@CheckForNull
|
|
+ @Override
|
|
public Object invoke(Object obj, Method method, @CheckForNull @Nullable Object[] args)
|
|
throws Throwable {
|
|
Callable<@Nullable Object> callable =
|
|
diff --git a/guava/src/com/google/common/util/concurrent/Striped.java b/guava/src/com/google/common/util/concurrent/Striped.java
|
|
index 2ea61cb324..f356c07060 100644
|
|
--- a/guava/src/com/google/common/util/concurrent/Striped.java
|
|
+++ b/guava/src/com/google/common/util/concurrent/Striped.java
|
|
@@ -14,13 +14,15 @@
|
|
|
|
package com.google.common.util.concurrent;
|
|
|
|
+import static com.google.common.base.Preconditions.checkArgument;
|
|
+import static com.google.common.base.Preconditions.checkElementIndex;
|
|
import static com.google.common.collect.Lists.newArrayList;
|
|
+import static java.util.Collections.unmodifiableList;
|
|
|
|
import com.google.common.annotations.Beta;
|
|
import com.google.common.annotations.GwtIncompatible;
|
|
import com.google.common.annotations.VisibleForTesting;
|
|
import com.google.common.base.MoreObjects;
|
|
-import com.google.common.base.Preconditions;
|
|
import com.google.common.base.Supplier;
|
|
import com.google.common.collect.ImmutableList;
|
|
import com.google.common.collect.MapMaker;
|
|
@@ -31,7 +33,6 @@ import java.lang.ref.ReferenceQueue;
|
|
import java.lang.ref.WeakReference;
|
|
import java.math.RoundingMode;
|
|
import java.util.Arrays;
|
|
-import java.util.Collections;
|
|
import java.util.List;
|
|
import java.util.concurrent.ConcurrentMap;
|
|
import java.util.concurrent.Semaphore;
|
|
@@ -181,7 +182,7 @@ public abstract class Striped<L> {
|
|
*/
|
|
@SuppressWarnings("unchecked") // we carefully replaced all keys with their respective L's
|
|
List<L> asStripes = (List<L>) result;
|
|
- return Collections.unmodifiableList(asStripes);
|
|
+ return unmodifiableList(asStripes);
|
|
}
|
|
|
|
// Static factories
|
|
@@ -340,7 +341,7 @@ public abstract class Striped<L> {
|
|
final int mask;
|
|
|
|
PowerOfTwoStriped(int stripes) {
|
|
- Preconditions.checkArgument(stripes > 0, "Stripes must be positive");
|
|
+ checkArgument(stripes > 0, "Stripes must be positive");
|
|
this.mask = stripes > Ints.MAX_POWER_OF_TWO ? ALL_SET : ceilToPowerOfTwo(stripes) - 1;
|
|
}
|
|
|
|
@@ -366,7 +367,7 @@ public abstract class Striped<L> {
|
|
|
|
private CompactStriped(int stripes, Supplier<L> supplier) {
|
|
super(stripes);
|
|
- Preconditions.checkArgument(stripes <= Ints.MAX_POWER_OF_TWO, "Stripes must be <= 2^30)");
|
|
+ checkArgument(stripes <= Ints.MAX_POWER_OF_TWO, "Stripes must be <= 2^30)");
|
|
|
|
this.array = new Object[mask + 1];
|
|
for (int i = 0; i < array.length; i++) {
|
|
@@ -374,8 +375,8 @@ public abstract class Striped<L> {
|
|
}
|
|
}
|
|
|
|
- @SuppressWarnings("unchecked") // we only put L's in the array
|
|
- @Override
|
|
+ @Override // we only put L's in the array
|
|
+ @SuppressWarnings("unchecked")
|
|
public L getAt(int index) {
|
|
return (L) array[index];
|
|
}
|
|
@@ -408,7 +409,7 @@ public abstract class Striped<L> {
|
|
@Override
|
|
public L getAt(int index) {
|
|
if (size != Integer.MAX_VALUE) {
|
|
- Preconditions.checkElementIndex(index, size());
|
|
+ checkElementIndex(index, size());
|
|
} // else no check necessary, all index values are valid
|
|
ArrayReference<? extends L> existingRef = locks.get(index);
|
|
L existing = existingRef == null ? null : existingRef.get();
|
|
@@ -479,7 +480,7 @@ public abstract class Striped<L> {
|
|
@Override
|
|
public L getAt(int index) {
|
|
if (size != Integer.MAX_VALUE) {
|
|
- Preconditions.checkElementIndex(index, size());
|
|
+ checkElementIndex(index, size());
|
|
} // else no check necessary, all index values are valid
|
|
L existing = locks.get(index);
|
|
if (existing != null) {
|
|
diff --git a/guava/src/com/google/common/util/concurrent/TimeLimiter.java b/guava/src/com/google/common/util/concurrent/TimeLimiter.java
|
|
index 0245fec3ca..c743db35c4 100644
|
|
--- a/guava/src/com/google/common/util/concurrent/TimeLimiter.java
|
|
+++ b/guava/src/com/google/common/util/concurrent/TimeLimiter.java
|
|
@@ -144,8 +144,8 @@ public interface TimeLimiter {
|
|
* @throws ExecutionError if {@code callable} throws an {@code Error}
|
|
* @since 22.0
|
|
*/
|
|
- @SuppressWarnings("GoodTime") // should accept a java.time.Duration
|
|
- @CanIgnoreReturnValue
|
|
+ @CanIgnoreReturnValue // should accept a java.time.Duration
|
|
+ @SuppressWarnings("GoodTime")
|
|
<T extends @Nullable Object> T callWithTimeout(
|
|
Callable<T> callable, long timeoutDuration, TimeUnit timeoutUnit)
|
|
throws TimeoutException, InterruptedException, ExecutionException;
|
|
@@ -191,8 +191,8 @@ public interface TimeLimiter {
|
|
* @throws ExecutionError if {@code callable} throws an {@code Error}
|
|
* @since 22.0
|
|
*/
|
|
- @SuppressWarnings("GoodTime") // should accept a java.time.Duration
|
|
- @CanIgnoreReturnValue
|
|
+ @CanIgnoreReturnValue // should accept a java.time.Duration
|
|
+ @SuppressWarnings("GoodTime")
|
|
<T extends @Nullable Object> T callUninterruptiblyWithTimeout(
|
|
Callable<T> callable, long timeoutDuration, TimeUnit timeoutUnit)
|
|
throws TimeoutException, ExecutionException;
|
|
diff --git a/guava/src/com/google/common/util/concurrent/TimeoutFuture.java b/guava/src/com/google/common/util/concurrent/TimeoutFuture.java
|
|
index ed8a7bfdbe..7cb535b872 100644
|
|
--- a/guava/src/com/google/common/util/concurrent/TimeoutFuture.java
|
|
+++ b/guava/src/com/google/common/util/concurrent/TimeoutFuture.java
|
|
@@ -14,10 +14,10 @@
|
|
|
|
package com.google.common.util.concurrent;
|
|
|
|
+import static com.google.common.base.Preconditions.checkNotNull;
|
|
import static com.google.common.util.concurrent.MoreExecutors.directExecutor;
|
|
|
|
import com.google.common.annotations.GwtIncompatible;
|
|
-import com.google.common.base.Preconditions;
|
|
import java.util.concurrent.ExecutionException;
|
|
import java.util.concurrent.Future;
|
|
import java.util.concurrent.ScheduledExecutorService;
|
|
@@ -77,7 +77,7 @@ final class TimeoutFuture<V extends @Nullable Object> extends FluentFuture.Trust
|
|
@CheckForNull private ScheduledFuture<?> timer;
|
|
|
|
private TimeoutFuture(ListenableFuture<V> delegate) {
|
|
- this.delegateRef = Preconditions.checkNotNull(delegate);
|
|
+ this.delegateRef = checkNotNull(delegate);
|
|
}
|
|
|
|
/** A runnable that is called when the delegate or the timer completes. */
|
|
@@ -153,8 +153,8 @@ final class TimeoutFuture<V extends @Nullable Object> extends FluentFuture.Trust
|
|
}
|
|
}
|
|
|
|
- @Override
|
|
@CheckForNull
|
|
+ @Override
|
|
protected String pendingToString() {
|
|
ListenableFuture<? extends V> localInputFuture = delegateRef;
|
|
ScheduledFuture<?> localTimer = timer;
|
|
diff --git a/guava/src/com/google/common/util/concurrent/TrustedListenableFutureTask.java b/guava/src/com/google/common/util/concurrent/TrustedListenableFutureTask.java
|
|
index 929c9fb1ea..e25d67c32b 100644
|
|
--- a/guava/src/com/google/common/util/concurrent/TrustedListenableFutureTask.java
|
|
+++ b/guava/src/com/google/common/util/concurrent/TrustedListenableFutureTask.java
|
|
@@ -102,8 +102,8 @@ class TrustedListenableFutureTask<V extends @Nullable Object> extends FluentFutu
|
|
this.task = null;
|
|
}
|
|
|
|
- @Override
|
|
@CheckForNull
|
|
+ @Override
|
|
protected String pendingToString() {
|
|
InterruptibleTask<?> localTask = task;
|
|
if (localTask != null) {
|
|
diff --git a/guava/src/com/google/common/util/concurrent/Uninterruptibles.java b/guava/src/com/google/common/util/concurrent/Uninterruptibles.java
|
|
index 09ace92fae..1c34bb2c92 100644
|
|
--- a/guava/src/com/google/common/util/concurrent/Uninterruptibles.java
|
|
+++ b/guava/src/com/google/common/util/concurrent/Uninterruptibles.java
|
|
@@ -14,13 +14,13 @@
|
|
|
|
package com.google.common.util.concurrent;
|
|
|
|
+import static com.google.common.base.Preconditions.checkNotNull;
|
|
import static com.google.common.base.Verify.verify;
|
|
import static com.google.common.util.concurrent.Internal.toNanosSaturated;
|
|
import static java.util.concurrent.TimeUnit.NANOSECONDS;
|
|
|
|
import com.google.common.annotations.GwtCompatible;
|
|
import com.google.common.annotations.GwtIncompatible;
|
|
-import com.google.common.base.Preconditions;
|
|
import com.google.errorprone.annotations.CanIgnoreReturnValue;
|
|
import java.time.Duration;
|
|
import java.util.concurrent.BlockingQueue;
|
|
@@ -190,7 +190,7 @@ public final class Uninterruptibles {
|
|
@GwtIncompatible // concurrency
|
|
@SuppressWarnings("GoodTime") // should accept a java.time.Duration
|
|
public static void joinUninterruptibly(Thread toJoin, long timeout, TimeUnit unit) {
|
|
- Preconditions.checkNotNull(toJoin);
|
|
+ checkNotNull(toJoin);
|
|
boolean interrupted = false;
|
|
try {
|
|
long remainingNanos = unit.toNanos(timeout);
|
|
@@ -296,8 +296,8 @@ public final class Uninterruptibles {
|
|
*/
|
|
@CanIgnoreReturnValue
|
|
@GwtIncompatible // TODO
|
|
- @SuppressWarnings("GoodTime") // should accept a java.time.Duration
|
|
- @ParametricNullness
|
|
+ @ParametricNullness // should accept a java.time.Duration
|
|
+ @SuppressWarnings("GoodTime")
|
|
public static <V extends @Nullable Object> V getUninterruptibly(
|
|
Future<V> future, long timeout, TimeUnit unit) throws ExecutionException, TimeoutException {
|
|
boolean interrupted = false;
|