Android Studio - Infer Nullity?
android, android-studio, intellij-idea
Solution
This option analyses your code and adds `@Nullable` and `@NotNull` annotations to your variables and parameters. This assists IntelliJ in detecting contract violations in your code and suggesting null-checks where necessary. To get the full benefit of this feature, you must annotate as much of your code as possible.
The downside of "Infer Nullity" is that, by default, it uses annotations from a JetBrains IntelliJ specific Jar (`com.intellij.annotations.NotNull`). As of version 10.5 of IntelliJ, there does seem to be some support for using other annotations.
For more information check out the detailed How-To on this feature.
Problem
While looking at the various options in Android Studio's Analyze tab, I came across an option called "infer nullity". I am just curious how this tool is supposed to be used and what can it do for my Android Studio project?