Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

@NonNull Annotation not working in Android Studio

import android.support.annotation.NonNull;

public
@NonNull
Result handleFollowForwardResult(@NonNull Result tempResult, @NonNull Result oldResult) {
    return null;
}

does not give any errors or warning? Isn't the point of the annotation to check for exactly this?

like image 203
fweigl Avatar asked Oct 08 '14 12:10

fweigl


1 Answers

This works in my copy of Android Studio 0.8.11. Try the following:

  • If you're running an old version of Android Studio, update.
  • Make sure your Inspections > Constant conditions & exceptions inspection is enabled.
  • In Inspections > Configure annotations, make sure your Nullable annotations list includes android.support.annotation.Nullable, and your NotNull annotations list includes android.support.annotation.NonNull.
like image 184
Scott Barta Avatar answered Oct 27 '22 01:10

Scott Barta