对原始类型成员的未选中调用
Android Studio 2.1.2
我有这个警告,我似乎找不到原因。我没有使用任何原始类型。
Unchecked call to attachView(DownloadViewContract) as a member of raw type
我有以下界面
public interface DownloadPresenterContract {
interface Operations<DownloadViewContract> {
void attachView(DownloadViewContract view);
void detachView();
void getData();
}
}
以及以下实现
public class DownloadPresenterImp implements
DownloadPresenterContract.Operations<DownloadViewContract> {
private DownloadViewContract mView;
private DownloadPresenterImp() {
}
public static DownloadPresenterImp getNewInstance() {
return new DownloadPresenterImp();
}
/* Operations */
@Override
public void attachView(DownloadViewContract view) {
mView = view;
}
}
这是我的视图界面
public interface DownloadViewContract {
void onSuccessDownload();
void onFailureDownload(String errMsg);
}
在我的片段中,这是我的观点
public class DownloadView extends Fragment implements DownloadViewContract {
@Override
public void onActivityCreated(Bundle savedInstanceState) {
mDownloadPresenterContract = DownloadPresenterImp.getNewInstance();
/* UNCHECKED MEMBER TO RAW TYPE */
mDownloadPresenterContract.attachView(DownloadView.this);
}
.....
}
我不明白为什么我会收到警告,因为我在演示器界面中显式命名了类型。由于我的观点实现了接口,我认为应该没有任何问题。DownloadViewContract
DownloadViewContract
非常感谢您的任何建议,