After updating to Android Studio 3.2, I've been getting a "Probable bugs" from lint saying:
"Not annotated method overrides method annotated with @NonNull".
I had no issue before updating to Android Studio 3.2, how do I solve this?
@NonNull
@Override
public View getView(int position, @Nullable View convertView, @NonNull ViewGroup parent) {
View row = convertView;
ViewHolder holder;
if (convertView == null) {
holder = new ViewHolder();
row = LayoutInflater.from(context).inflate(R.layout.gallery_view_row, parent, false);
holder.imageView = row.findViewById(R.id.filePath);
row.setTag(holder);
} else holder = (ViewHolder) row.getTag();
String file_path = objects.get(position);
GlideApp.with(context).load(MovieDB.IMAGE_URL + context.getResources().getString(R.string.galleryImgSize) + file_path)
.into(holder.imageView);
return row;
}
Android Lint never flagged this method before Android Studio 3.2 update, but now I get 2 flags on the method and on the "parent" parameter
Here are the 2 imports used
import androidx.annotation.NonNull;
import androidx.annotation.Nullable;
The problem only exists the the "ArrayAdapter" class, the superclass has those 5 imports highlighted in red
import android.annotation.ArrayRes;
import android.annotation.IdRes;
import android.annotation.LayoutRes;
import android.annotation.NonNull;
import android.annotation.Nullable;
I was having this same problem, finally discovered a fix, hope it works for you...
Open Settings, select "Editor", then "Inspections".
In the list of inspections, go to "Probable Bugs" and then "@NotNull/@Nullable problems".
On the right pane, select the "CONFIGURE ANNOTATIONS" button.
Add "androidx.annotation.Nullable" and "androidx.annotation.NonNull" to the respective lists. I also made them the default.
No longer seeing this maddening behavior.