Type safety: Unchecked cast from List to List<Book>
2014-05-02 10:53
363 查看
该问题实质是 处理MyEclipse中泛型转换的警告
类似于:List<FileItem> fileItems = (List<FileItem>) fileload.parseRequest(request);
fileload.parseRequest返回的是List,cast的时候会出Type safety: Unchecked cast from
List<FileItem> to
List<FileItem>,
如果不让eclipse忽略,这个警告就永远都无法避免
1、可以在eclipse中修改:
Eclipse-->首选项--->JAVA-->Compiler-->Errors/Warnings-->Generic types-->下面三个全部改成Ignore就OK了。
2、不让eclipse检查jsp的有效性
在windows->preferences->editors->jsp里将那个复选框取消。
3、这个只是提示,并不影响运行,你如果不想看到,完全没有必要理会
如果你公司非要使用checkStyle检查的话可以使用在泛型前面加上@SuppressWarnings("unchecked") 来避免提示
该问题实质是 处理MyEclipse中泛型转换的警告
类似于:List<FileItem> fileItems = (List<FileItem>) fileload.parseRequest(request);
fileload.parseRequest返回的是List,cast的时候会出Type safety: Unchecked cast from
List<FileItem> to
List<FileItem>,
如果不让eclipse忽略,这个警告就永远都无法避免
1、可以在eclipse中修改:
Eclipse-->首选项--->JAVA-->Compiler-->Errors/Warnings-->Generic types-->下面三个全部改成Ignore就OK了。
2、不让eclipse检查jsp的有效性
在windows->preferences->editors->jsp里将那个复选框取消。
3、这个只是提示,并不影响运行,你如果不想看到,完全没有必要理会
如果你公司非要使用checkStyle检查的话可以使用在泛型前面加上@SuppressWarnings("unchecked") 来避免提示
相关文章推荐
- 关于Unchecked cast from List<String> to Iterator<String>的警告
- java中的类型安全问题-Type safety: Unchecked cast from Object to ... 或者 Type safety: Unchecked cast from Type to Class<T>
- Downcast from'[NSObject:AnyObject]?'to'Dictionary<NSObject,AnyObject>'only unwraps
- How to cast List<Object> to List<MyClass> Object集合转换成实体集合
- Pushing a Geneic List of <T> to View state
- error: invalid cast from type _gnu_cxx::__normal_iterator<> to unsigned char*
- SqlDataReader to IList<T>
- 【小熊刷题】Remove Nth Node From End of List <Leetcode 19, Java>
- net.sf.ezmorph.bean.MorphDynaBean cannotbe cast to xxx 关于JSON对象解析List<XXX>在调用时出错问题
- How to sort a generic List<T>
- <<Beginning XML with DOM and Ajax From Novice to Professiona>>Contents
- java中的类型安全问题-Type safety: Unchecked cast from Object to ...
- LeetCode Algorithms #83 <Remove Duplicates from Sorted List>
- Type mismatch: cannot convert from Enumeration<String> to Enumeration<Object>
- Type safety: Unchecked invocation sort(List<Cell>) of the generic method sort(List<T>) 问题
- struts2的<s:iterator>标签 遇到的问题:java.lang.ClassCastException:cannot be cast to java.lang.String
- pass all options of <select> from View to controller
- 【小熊刷题】Convert Sorted List to Balanced Binary Search Tree<可再复习>
- Java - Warning: Unchecked cast from object to array list
- <LeetCode OJ> 109 / 108 Convert Sorted ( List / Array ) to Binary Search Tree