From c5d7b86c19e75438d93effc176470e3a25494a08 Mon Sep 17 00:00:00 2001 From: cpovirk Date: Tue, 15 Nov 2022 14:33:14 -0800 Subject: [PATCH] Suppress some `CheckReturnValue` errors. We may just improve our checker to not issue errors for this `try`-`fail` pattern, but for now, let's get the build green. RELNOTES=n/a PiperOrigin-RevId: 488760922 --- .../collect/testing/google/MultimapContainsEntryTester.java | 4 ++-- .../collect/testing/google/MultimapContainsKeyTester.java | 2 +- .../collect/testing/google/MultimapContainsValueTester.java | 2 +- .../common/collect/testing/google/MultimapGetTester.java | 2 +- .../common/collect/testing/google/MultisetCountTester.java | 2 +- .../collect/testing/google/MultisetNavigationTester.java | 4 ++-- .../collect/testing/google/MultimapContainsEntryTester.java | 4 ++-- .../collect/testing/google/MultimapContainsKeyTester.java | 2 +- .../collect/testing/google/MultimapContainsValueTester.java | 2 +- .../common/collect/testing/google/MultimapGetTester.java | 2 +- .../common/collect/testing/google/MultisetCountTester.java | 2 +- .../collect/testing/google/MultisetNavigationTester.java | 4 ++-- 12 files changed, 16 insertions(+), 16 deletions(-) diff --git a/android/guava-testlib/src/com/google/common/collect/testing/google/MultimapContainsEntryTester.java b/android/guava-testlib/src/com/google/common/collect/testing/google/MultimapContainsEntryTester.java index 9da7fe3f2ac8..1f442149fcdc 100644 --- a/android/guava-testlib/src/com/google/common/collect/testing/google/MultimapContainsEntryTester.java +++ b/android/guava-testlib/src/com/google/common/collect/testing/google/MultimapContainsEntryTester.java @@ -69,7 +69,7 @@ public void testContainsEntryNullNo() { @MapFeature.Require(absent = ALLOWS_NULL_KEY_QUERIES) public void testContainsEntryNullDisallowedBecauseKeyQueriesDisallowed() { try { - multimap().containsEntry(null, v3()); + boolean unused = multimap().containsEntry(null, v3()); fail("Expected NullPointerException"); } catch (NullPointerException expected) { // success @@ -79,7 +79,7 @@ public void testContainsEntryNullDisallowedBecauseKeyQueriesDisallowed() { @MapFeature.Require(absent = ALLOWS_NULL_VALUE_QUERIES) public void testContainsEntryNullDisallowedBecauseValueQueriesDisallowed() { try { - multimap().containsEntry(k3(), null); + boolean unused = multimap().containsEntry(k3(), null); fail("Expected NullPointerException"); } catch (NullPointerException expected) { // success diff --git a/android/guava-testlib/src/com/google/common/collect/testing/google/MultimapContainsKeyTester.java b/android/guava-testlib/src/com/google/common/collect/testing/google/MultimapContainsKeyTester.java index a7dcd6626e0f..e42f1d7cef79 100644 --- a/android/guava-testlib/src/com/google/common/collect/testing/google/MultimapContainsKeyTester.java +++ b/android/guava-testlib/src/com/google/common/collect/testing/google/MultimapContainsKeyTester.java @@ -82,7 +82,7 @@ public void testContainsKeyNullAbsent() { @MapFeature.Require(absent = ALLOWS_NULL_KEY_QUERIES) public void testContainsKeyNullDisallowed() { try { - multimap().containsKey(null); + boolean unused = multimap().containsKey(null); fail("Expected NullPointerException"); } catch (NullPointerException expected) { // success diff --git a/android/guava-testlib/src/com/google/common/collect/testing/google/MultimapContainsValueTester.java b/android/guava-testlib/src/com/google/common/collect/testing/google/MultimapContainsValueTester.java index 00ca12ad514b..4fae07f352c0 100644 --- a/android/guava-testlib/src/com/google/common/collect/testing/google/MultimapContainsValueTester.java +++ b/android/guava-testlib/src/com/google/common/collect/testing/google/MultimapContainsValueTester.java @@ -59,7 +59,7 @@ public void testContainsNullValueNo() { @MapFeature.Require(absent = ALLOWS_NULL_VALUE_QUERIES) public void testContainsNullValueFails() { try { - multimap().containsValue(null); + boolean unused = multimap().containsValue(null); fail("Expected NullPointerException"); } catch (NullPointerException expected) { // success diff --git a/android/guava-testlib/src/com/google/common/collect/testing/google/MultimapGetTester.java b/android/guava-testlib/src/com/google/common/collect/testing/google/MultimapGetTester.java index 6978473232fa..c04cf97ceb8e 100644 --- a/android/guava-testlib/src/com/google/common/collect/testing/google/MultimapGetTester.java +++ b/android/guava-testlib/src/com/google/common/collect/testing/google/MultimapGetTester.java @@ -142,7 +142,7 @@ public void testGetNullAbsent() { @MapFeature.Require(absent = ALLOWS_NULL_KEY_QUERIES) public void testGetNullForbidden() { try { - multimap().get(null); + Collection unused = multimap().get(null); fail("Expected NullPointerException"); } catch (NullPointerException expected) { // success diff --git a/android/guava-testlib/src/com/google/common/collect/testing/google/MultisetCountTester.java b/android/guava-testlib/src/com/google/common/collect/testing/google/MultisetCountTester.java index 7c07cd33d06c..5d272eda45f3 100644 --- a/android/guava-testlib/src/com/google/common/collect/testing/google/MultisetCountTester.java +++ b/android/guava-testlib/src/com/google/common/collect/testing/google/MultisetCountTester.java @@ -64,7 +64,7 @@ public void testCount_nullAbsent() { @CollectionFeature.Require(absent = ALLOWS_NULL_QUERIES) public void testCount_null_forbidden() { try { - getMultiset().count(null); + int unused = getMultiset().count(null); fail("Expected NullPointerException"); } catch (NullPointerException expected) { } diff --git a/android/guava-testlib/src/com/google/common/collect/testing/google/MultisetNavigationTester.java b/android/guava-testlib/src/com/google/common/collect/testing/google/MultisetNavigationTester.java index ce8e283a9c3e..b5474c438e43 100644 --- a/android/guava-testlib/src/com/google/common/collect/testing/google/MultisetNavigationTester.java +++ b/android/guava-testlib/src/com/google/common/collect/testing/google/MultisetNavigationTester.java @@ -178,7 +178,7 @@ public void testPollFirst() { @CollectionFeature.Require(absent = SUPPORTS_REMOVE) public void testPollFirstUnsupported() { try { - sortedMultiset.pollFirstEntry(); + Entry unused = sortedMultiset.pollFirstEntry(); fail(); } catch (UnsupportedOperationException e) { } @@ -234,7 +234,7 @@ public void testPollLast() { @CollectionSize.Require(SEVERAL) public void testPollLastUnsupported() { try { - sortedMultiset.pollLastEntry(); + Entry unused = sortedMultiset.pollLastEntry(); fail(); } catch (UnsupportedOperationException e) { } diff --git a/guava-testlib/src/com/google/common/collect/testing/google/MultimapContainsEntryTester.java b/guava-testlib/src/com/google/common/collect/testing/google/MultimapContainsEntryTester.java index 9da7fe3f2ac8..1f442149fcdc 100644 --- a/guava-testlib/src/com/google/common/collect/testing/google/MultimapContainsEntryTester.java +++ b/guava-testlib/src/com/google/common/collect/testing/google/MultimapContainsEntryTester.java @@ -69,7 +69,7 @@ public void testContainsEntryNullNo() { @MapFeature.Require(absent = ALLOWS_NULL_KEY_QUERIES) public void testContainsEntryNullDisallowedBecauseKeyQueriesDisallowed() { try { - multimap().containsEntry(null, v3()); + boolean unused = multimap().containsEntry(null, v3()); fail("Expected NullPointerException"); } catch (NullPointerException expected) { // success @@ -79,7 +79,7 @@ public void testContainsEntryNullDisallowedBecauseKeyQueriesDisallowed() { @MapFeature.Require(absent = ALLOWS_NULL_VALUE_QUERIES) public void testContainsEntryNullDisallowedBecauseValueQueriesDisallowed() { try { - multimap().containsEntry(k3(), null); + boolean unused = multimap().containsEntry(k3(), null); fail("Expected NullPointerException"); } catch (NullPointerException expected) { // success 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 a7dcd6626e0f..e42f1d7cef79 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 @@ -82,7 +82,7 @@ public void testContainsKeyNullAbsent() { @MapFeature.Require(absent = ALLOWS_NULL_KEY_QUERIES) public void testContainsKeyNullDisallowed() { try { - multimap().containsKey(null); + boolean unused = multimap().containsKey(null); fail("Expected NullPointerException"); } catch (NullPointerException expected) { // success 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 00ca12ad514b..4fae07f352c0 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 @@ -59,7 +59,7 @@ public void testContainsNullValueNo() { @MapFeature.Require(absent = ALLOWS_NULL_VALUE_QUERIES) public void testContainsNullValueFails() { try { - multimap().containsValue(null); + boolean unused = multimap().containsValue(null); fail("Expected NullPointerException"); } catch (NullPointerException expected) { // success 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 6978473232fa..c04cf97ceb8e 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 @@ -142,7 +142,7 @@ public void testGetNullAbsent() { @MapFeature.Require(absent = ALLOWS_NULL_KEY_QUERIES) public void testGetNullForbidden() { try { - multimap().get(null); + Collection unused = multimap().get(null); fail("Expected NullPointerException"); } catch (NullPointerException expected) { // success 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 7c07cd33d06c..5d272eda45f3 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 @@ -64,7 +64,7 @@ public void testCount_nullAbsent() { @CollectionFeature.Require(absent = ALLOWS_NULL_QUERIES) public void testCount_null_forbidden() { try { - getMultiset().count(null); + int unused = getMultiset().count(null); fail("Expected NullPointerException"); } catch (NullPointerException expected) { } 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 ce8e283a9c3e..b5474c438e43 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 @@ -178,7 +178,7 @@ public void testPollFirst() { @CollectionFeature.Require(absent = SUPPORTS_REMOVE) public void testPollFirstUnsupported() { try { - sortedMultiset.pollFirstEntry(); + Entry unused = sortedMultiset.pollFirstEntry(); fail(); } catch (UnsupportedOperationException e) { } @@ -234,7 +234,7 @@ public void testPollLast() { @CollectionSize.Require(SEVERAL) public void testPollLastUnsupported() { try { - sortedMultiset.pollLastEntry(); + Entry unused = sortedMultiset.pollLastEntry(); fail(); } catch (UnsupportedOperationException e) { }