未经检查的转换:'java.io.Serialized' 到 'java.util.ArrayList'
我的代码是这样的:
Activity.java
ArrayList<Department> departments = new ArrayList<>();
Intent i = getIntent();
departments = (ArrayList<Department>) i.getSerializableExtra("DepartmentList");
Department.java
public class Department implements Serializable {
private int department_id;
private String dept_name;
private ArrayList<Course> courses;
private ArrayList<Batch>batches;
public Department() {
}
public ArrayList<Batch> getBatches() {
return batches;
}
public void setBatches(ArrayList<Batch> batches) {
this.batches = batches;
}
public int getDepartment_id() {
return department_id;
}
public void setDepartment_id(int department_id) {
this.department_id = department_id;
}
public String getDept_name() {
return dept_name;
}
public void setDept_name(String dept_name) {
this.dept_name = dept_name;
}
public ArrayList<Course> getCourses() {
return courses;
}
public void setCourses(ArrayList<Course> courses) {
this.courses = courses;
}
@Override
public String toString() {
return dept_name;
}
}
该应用程序运行良好,但我收到以下消息:
未经检查的强制转换:'java.io.Serialized' 到 'java.util.ArrayList' 检查信息:向编译器发出未经检查的警告的位置发出信号,例如:
void f(HashMap map) { map.put("key", "value"); }
提示:将 -Xlint:unchecked 传递给 javac 以获取更多详细信息。
开满天机
相关分类