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

JSpecify: Use `@NullMarked` instead of `-XepOpt:NullAway:AnnotatedPackages` #1042

Closed pemistahl closed 1 month ago

pemistahl commented 1 month ago

While testing the JSpecify annotations with NullAway, I thought I would be able to remove the -XepOpt:NullAway:AnnotatedPackages setting in favor of using the @NullMarked annotation. I want to specify the code to be checked on class level instead of package level. This does not seem to be possible right now. Setting the @NullMarked annotation does not have any effect. However, when I remove the AnnotatedPackages setting NullAway even fails to initialize at all.

Will this be fixed in a future release to provide conformity with the JSpecify specification?

beatbrot commented 1 month ago

Just a sidenote: I think both variants should work at the same time. In my codebase, it is not feasable to add NullMarked everywhere, therefore I enjoyed using NullAway:AnnotatedPackages. I want to keep doing this :)

msridhar commented 1 month ago

Thanks for the feedback! We have an open issue on this, #574. Let's continue the discussion there.

msridhar commented 1 month ago

Duplicate of #574