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

Published NonNull Present #948

Closed xenoterracide closed 6 months ago

xenoterracide commented 6 months ago

So, this may be against the spirit of nullaway and jspecify... However, I think that for a long time it'd be good to annotate any published "interfaces" completley. Meaning that @NonNull should be present on something that is public/protected. Bonus points if it also checks to see if the package is exported if a module-info.java is present.

I'm going to speculate this will be closed ;)

msridhar commented 6 months ago

Not sure this is a NullAway issue really? Like are you asking for an error message if @NonNull is not present? If so then yes NullAway is not likely to report an error for that :-)

xenoterracide commented 6 months ago

yeah, basically. Didn't hurt to ask?

msridhar commented 6 months ago

FWIW if I understand the ask correctly this may not be very hard to implement as a separate Error Prone check

xenoterracide commented 6 months ago

yeah, probably not, I was thinking might be of your guys interest to implement. Could have 2 separate checks even... One that is "thorough" (public/protected must have something) and one that is just looking for NullMarked.

I could also ask EP itself.

xenoterracide commented 6 months ago

let me know if you want me to re-open

msridhar commented 6 months ago

I think it's very unlikely we would be able to prioritize implementing this any time in the near future. So probably best to leave this closed for now. If you or one of your colleagues has the cycles, I don't think it would be too hard of an EP check to implement yourselves and try out, and I'd be happy to give feedback on it