Java class 使用未经检查或不安全的操作

Java class uses unchecked or unsafe operations

我有一个名为 LB_Adapter.java 的 class 来帮助在 ListView 中显示我的数据库。我的程序的所有功能都运行良好,但每次编译时我仍然收到警告错误

Note: Project/LB_Adapter.java uses unchecked or unsafe operations.
Note: Recompile with -Xlint:unchecked for details.

通过谷歌搜索,我了解到错误来自我的 ArrayList,但我已经尝试实施 ArrayList(),但它不起作用。有没有办法消除错误,或者因为它不影响任何东西,所以它甚至重要吗?

相关代码:

public class LB_Adapter extends ArrayAdapter<Object> {
List<Object> list = new ArrayList<>();

public LB_Adapter(Context context, int resource){
    super(context, resource);
}

public void add(LB object){
    list.add(object);
    super.add(object);
}

@Override
public int getCount(){
    return list.size();
}

@Override
public Object getItem(int position){
    return list.get(position);
}

@Override
public View getView(int position, View convertView, ViewGroup parent) {
    View row = convertView;
    LBHolder lbholder;

    if(row==null){
        LayoutInflater layoutinflater = (LayoutInflater) this.getContext().getSystemService(getContext().LAYOUT_INFLATER_SERVICE);
        row = layoutinflater.inflate(R.layout.display_leaderboard_row, parent, false);
        lbholder = new LBHolder();
        lbholder.lb_rank = (TextView) row.findViewById(R.id.lb_rank);
        lbholder.lb_score = (TextView) row.findViewById(R.id.lb_score);
        lbholder.lb_time = (TextView) row.findViewById(R.id.lb_time);
        row.setTag(lbholder);
    }
    else {
        lbholder = (LBHolder) row.getTag();
    }
    LB leaderboard = (LB) getItem(position);
    lbholder.lb_rank.setText(leaderboard.getRank().toString());
    lbholder.lb_score.setText(Integer.toString(leaderboard.getScore()));
    lbholder.lb_time.setText(leaderboard.getTime().toString());

    return row;
}

static class LBHolder{
    TextView lb_rank, lb_score, lb_time;
}
}

自从在 Java 中引入泛型以来,不鼓励使用原始类型 5. 您应该只为正在使用的 ArrayAdapterArrayList 键入参数:

public class LB_Adapter extends ArrayAdapter<LB> {
    // Here --------------------------------^

    // And here:
    List<LB> list = new ArrayList<>();

    public LB_Adapter(Context context, int resource){
        super(context, resource);
    }

    public void add(LB object){
        list.add(object);
        super.add(object);
    }
}