Java - Warning: Unchecked cast from object to array list
来源:互联网 发布:单片机地址总线 编辑:程序博客网 时间:2024/05/01 14:47
Warning: Unchecked cast from object to array list
本文地址:http://blog.csdn.net/caroline_wendy
警告发生在对象(Object)强制转换为数组(ArrayList)类型,如:
infos = (ArrayList<VideoInfo>) data.getData();
因为对象转换为数组类型,未经过检查,有一定危险.
使数组对象强制转换,如ArrayList<?>,比较容易控制风险。
但是,为了书写简便和适配其他不规范接口,这么做是可以的。
可以在方法(method)前,进行警告抑制(SuppressWarning),即
@SuppressWarnings("unchecked”)
参考: http://stackoverflow.com/questions/509076/how-do-i-address-unchecked-cast-warnings
2 0
- Java - Warning: Unchecked cast from object to array list
- The Solutions of Warning:Unchecked cast from object to arraylist
- Type safety: Unchecked cast from List to List<Book>
- Unchecked cast: 'java.lang.Object' to 'java.util.List<java.lang.xxx>'
- idea警告:Unchecked cast: 'java.lang.Object' to 'java.util.List<java.lang.String[]>'
- java中的类型安全问题-Type safety: Unchecked cast from Object to ...
- 消除unchecked cast Warning
- 关于Unchecked cast from List<String> to Iterator<String>的警告
- 关于 Unchecked cast from Iterator to Iterator String 提示
- warning: cast to pointer from integer of diffe
- warning: cast to pointer from integer of different size
- JAVA int 强制类型转换错误提示(Cannot cast from Object to int)
- JAVA int 强制类型转换错误提示(Cannot cast from Object to int)
- JAVA int 强制类型转换错误提示(Cannot cast from Object to int)
- warning: cast to pointer from integer of different size [-Wint-to-pointer-cast]错误
- warning: cast to pointer from integer of different size [-Wint-to-pointer-cast]
- JAVA List to Array,Array to List
- LINUX下warning: cast from pointer to integer of different size问题
- 10 个很棒的 jQuery 代码片段
- 怎么确定一个变量的类型
- hdu,2050,折线分割平面
- 学术休假---100~999中的水仙花数
- 游戏服务器构架优秀文章(转载)
- Java - Warning: Unchecked cast from object to array list
- Max Points on a Line
- Maven学习笔记(八)Maven的入门使用—2.编写主代码
- CSS中如何使父DIV内部的DIV垂直居中对齐!!!!
- 阿里巴巴网站推广——扬州渠道中心
- 宽带连接错误的处理办法
- NDK下获取IEIM并且使用MD5算法加密
- APB_IIS模块DUT&Testbench实践
- SimpleDateFormat