How to tell IDEA/Studio that the null check has been done?

后端 未结 6 1918
我在风中等你
我在风中等你 2020-12-06 06:14

I\'m developing with Android Studio/IntelliJ IDEA.

I have enabled the inspection check called "Constant conditions & exceptions" that shows a warning if

6条回答
  •  感情败类
    2020-12-06 06:56

    You can use @SuppressWarnings("ConstantConditions") annotation.

    @SuppressWarnings("ConstantConditions")
    @Override
    public RecyclerView.ViewHolder onCreateViewHolder(ViewGroup parent, int indexViewType) {
        if (inflater == null) {
            inflater = LayoutInflater.from(parent.getContext());
        }
        ItemViewProvider provider = getProviderByIndex(indexViewType);
        provider.adapter = MultiTypeAdapter.this;
        return provider.onCreateViewHolder(inflater, parent);
    }
    

提交回复
热议问题