From 9a97bed5c36a5be7b446ab94a52a87b3b3cfbe27 Mon Sep 17 00:00:00 2001 From: cpovirk Date: Fri, 1 May 2026 11:16:40 -0700 Subject: [PATCH] Suppress a forthcoming https://errorprone.info/bugpattern/NullNeedsCastForVarargs error. PiperOrigin-RevId: 908817127 --- .../common/truth/IterableSubjectCorrespondenceTest.java | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/core/src/test/java/com/google/common/truth/IterableSubjectCorrespondenceTest.java b/core/src/test/java/com/google/common/truth/IterableSubjectCorrespondenceTest.java index 0b3b21c33..ebcbc3876 100644 --- a/core/src/test/java/com/google/common/truth/IterableSubjectCorrespondenceTest.java +++ b/core/src/test/java/com/google/common/truth/IterableSubjectCorrespondenceTest.java @@ -37,6 +37,7 @@ import static com.google.common.truth.TestCorrespondences.WITHIN_10_OF; import static com.google.common.truth.Truth.assertThat; import static java.util.Arrays.asList; +import static java.util.Collections.singletonList; import static org.junit.Assert.assertThrows; import com.google.common.collect.ImmutableList; @@ -1273,10 +1274,12 @@ public void containsExactly_nullValueInArray() { .containsExactly(128, null); } + // We intentionally test the behavior of the method under a call that will soon fail. + @SuppressWarnings("NullNeedsCastForVarargs") @Test public void containsExactly_nullArray() { // Truth is tolerant of this erroneous varargs call. - List actual = Arrays.asList((String) null); + List actual = singletonList(null); IterableSubject.UsingCorrespondence subject = assertThat(actual).comparingElementsUsing(STRING_PARSES_TO_INTEGER_CORRESPONDENCE); Ordered ordered;