Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Annotate
firstNonNull
as permitting nullable values for its second …
…parameter. It has permitted them at runtime since the beginning, and that's intentional. (This CL also adds a test, which somehow we didn't have for all these years? _And_ somehow the tests that we did have weren't open-sourced, so this CL open-sources them.) And based on testing, I can say: Many callers pass not only values whose static type is nullable but also whose _actual runtime value_ is `null`. I don't have my testing results handy anymore, so I don't have a real-world example to share right now, but you can imagine something like this: ```java for (Key key : union(map1.keySet(), map2.keySet()) { Value value = firstNonNull(map1.get(key), map2.get(key)); } ``` RELNOTES=n/a PiperOrigin-RevId: 531596646
- Loading branch information