uber / NullAway

A tool to help eliminate NullPointerExceptions (NPEs) in your Java code with low build-time overhead
MIT License
3.63k stars 293 forks source link

In generics code, get rid of checks for ClassType #861

Closed msridhar closed 10 months ago

msridhar commented 11 months ago

There are various places in GenericsChecks that we only perform checks for ClassTypes, e.g.:

https://github.com/uber/NullAway/blob/4b6e6728e0d0f82307884e333b6df07d501364bf/nullaway/src/main/java/com/uber/nullaway/generics/GenericsChecks.java#L304-L304 https://github.com/uber/NullAway/blob/4b6e6728e0d0f82307884e333b6df07d501364bf/nullaway/src/main/java/com/uber/nullaway/generics/GenericsChecks.java#L336-L338

I don't think these checks are needed, and in fact we may miss issues (e.g., if both types are array types and inside there are nested type arguments with mismatched nullability). We should remove these checks and add corresponding tests.