uber / NullAway

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

Suggestion: Accept a `Nullable` annotation name and suggest it in cases where it's missing #438

Open ZacSweers opened 3 years ago

ZacSweers commented 3 years ago

Error-prone itself has some checks for this, but nullaway is obviously better at it.

Given an error like this

/Users/zsweers/dev/slack/restructure/slack-android-ng/libraries/foundation/slack-commons/src/main/java/slack/commons/logger/DebugLogger.java:62: error: [NullAway] parameter tag is @NonNull, but parameter in superclass method slack.commons.logger.Logger.log(java.lang.String,java.lang.String,java.lang.Throwable) is @Nullable
  public void log(final String tag, final String message, final Throwable throwable) {
                               ^
    (see http://t.uber.com/nullaway )

I'd like to be able to define my desired @Nullable annotation as an option and have nullaway suggest adding the annotation.

lazaroclapp commented 3 years ago

We are actively working on this, actually! 😉

Just to set expectations, though: the general version of "take an annotated codebase and add annotations in all the right places" is a hard research problem. Also, by "we", I mean @nimakarimipour is working on this for Ph.D. under @msridhar's direction.

So, @nimakarimipour, assigning this one to you.