Android “的目的是什么?”@抑制警告(“未选中”);?

Android “的目的是什么?”@抑制警告(“未选中”);?,android,Android,我在网上找到了以下代码。我对第一行感到困惑。这条路线的目的是什么 @SuppressWarnings("unchecked") private void showAlert(String title,String msg,final Class cls) { AlertDialog alertDialog = new AlertDialog.Builder(this).create(); alertDialog.setTitle(title); alertDialog.s

我在网上找到了以下代码。我对第一行感到困惑。这条路线的目的是什么

@SuppressWarnings("unchecked")
private void showAlert(String title,String msg,final Class cls)
{
    AlertDialog alertDialog = new AlertDialog.Builder(this).create();
    alertDialog.setTitle(title);
    alertDialog.setMessage(msg);
    alertDialog.setButton("OK", new DialogInterface.OnClickListener() {
        public void onClick(DialogInterface dialog, int which) {
            Intent samepage = new Intent(LoginActivity.this,
                    cls);
            startActivity(samepage);

        }
    });
    alertDialog.setIcon(R.drawable.icon);
    alertDialog.show();
}

方法内部的代码中存在未经检查的泛型转换/转换


因此,通过指示
@SuppressWarnings
注释,您不会从IDE或编译中得到警告,因为您告诉编译器您知道并且不会得到警告。

方法内部的代码中存在未经检查的泛型转换/强制转换

因此,通过指示一个
@SuppressWarnings
注释,您不会从IDE或编译中得到警告,因为您告诉编译器您知道并且没有得到警告