Suppress potential NullPointerException in Android Studio
问题 This: @Nullable Item[] mItems; public Item getItem(int position) { return mItems[position]; } produces the warning: Array access 'mItems[position]' may produce NullPointerException I want to suppress this warning (I know that getItem() will not be called if mItems is null). I've tried using the following annotations: @SuppressWarnings({"NullableProblems"}) @SuppressWarnings({"null"}) as well as with the //noinspection notation, but they're all not working. Using @SuppressWarnings({"all"})