Type safety: Unchecked cast from List to List<Book>

类似于:List<FileItem> fileItems = (List<FileItem>) fileload.parseRequest(request);

fileload.parseRequest返回的是List,cast的时候会出Type safety: Unchecked cast fromList<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") 来避免提示

转至:https://blog.csdn.net/u013532827/article/details/24868469

猜你喜欢

转载自blog.csdn.net/qq_37909508/article/details/80217743
今日推荐