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

NonNullApi, NonNullFields and inverse #907

Closed xenoterracide closed 8 months ago

xenoterracide commented 8 months ago

So after reading https://github.com/uber/NullAway/wiki/Supported-Annotations I'm assuming that the @NonNullApi and NonNullFields aren't in any way supported (they're spring)? https://www.baeldung.com/spring-null-safety-annotations if they aren't could they be?

I'd also love to support a mythical NullableApi and NullableFields obviously saying the inverse is the default... I say mythical, but making my own annotations, but they're really only good if something supports them.

Maybe to add on to this, a setting(? or additional ep rule) that requires you to have one or the other defined.

msridhar commented 8 months ago

Hi @xenoterracide NullAway already assumes everything is @NonNull by default, so I'm not sure what would be required to additionally support these annotations. Do you have an example you're thinking of?

xenoterracide commented 8 months ago

To be honest I'm not sure how well they're supported outside of spring, and with all the talk around jspecify, that I only found out about 4 days ago, probably shortly after creating this. Probably not worth the conversation. Really it's all around the problem of "all tools aren't making the same assumptions as to what the defaults are, and so we still have to set both annotations on everything"