Skip to content

Conversation

@copybara-service
Copy link
Contributor

@copybara-service copybara-service bot commented Oct 13, 2025

Suppress or address errors from a forthcoming Error Prone check that looks for calls like containsExactly(null) that always throw NPE.

(To check for a list that contains only a null element, the calls will soon need to be containsExactly((Object) null) (with a cast to the array's element type), not containsExactly(null) or containsExactly((Object[]) null) (with a cast to the array type).)

Also, sidestep other null-varargs fun by using Collections.singleton instead of the varargs methods Arrays.asList and Stream.of.)

(the check)

@copybara-service copybara-service bot changed the title Suppress or address errors from a forthcoming Error Prone check that looks for calls like asList(null) that always throw NPE. Suppress or address errors from a forthcoming Error Prone check that looks for calls like containsExactly(null) that always throw NPE. Oct 13, 2025
…looks for calls like `containsExactly(null)` that always throw NPE.

(To check for a list that contains only a null element, the calls will soon need to be `containsExactly((Object) null)` (with a cast to the array's _element_ type), not `containsExactly(null)` or `containsExactly((Object[]) null)` (with a cast to the _array_ type).)

Also, sidestep other null-varargs fun by using `Collections.singleton` instead of the varargs methods `Arrays.asList` and `Stream.of`.)

([the check](google/error-prone#5263))

PiperOrigin-RevId: 818803000
@copybara-service copybara-service bot merged commit 611972f into master Oct 13, 2025
@copybara-service copybara-service bot deleted the test_818740054 branch October 13, 2025 20:21
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant