解决Type safety: The expression of type List needs
解决Type safety: The expression of type List needs unchecked conversion to conform to
在方法前加上这句话就可以了@SuppressWarnings("unchecked")
例如:
@SuppressWarnings("unchecked")
public List<TMrTraceLog> findMrTraceLog(String mrClass,String mrNo) {
return this.mrTraceLogDao.findMrTraceLog(mrClass, mrNo);
}
jdk1.5以后支持泛型后,提倡用使用 这种方式定义:List<String>,Map<String> ,若你还是使用List ,Map 这种方式来定义,
eclipse,或者myeclipse 就会抛出“警告”,也就是一个带黄色的感叹号。如果这个时候你不想看见这种提示,就可以使用上面的注解。 J2SE 提供的最后一个批注是 @SuppressWarnings。该批注的作用是给编译器一条指令, 告诉它对被批注的代码元素内部的某些警告保持静默。
关键字 | 用途 |
deprecation |
使用了不赞成使用的类或方法时的警告 |
unchecked |
执行了未检查的转换时的警告,例如当使用集合时没有用泛型 (Generics) 来指定集合保存的类型。 |
fallthrough |
当 Switch 程序块直接通往下一种情况而没有 Break 时的警告。 |
path |
在类路径、源文件路径等中有不存在的路径时的警告。 |
serial |
当在可序列化的类上缺少 serialVersionUID 定义时的警告。 |
finally |
任何 finally 子句不能正常完成时的警告。 |
all | 关于以上所有情况的警告。 |
解决Type safety: The expression of type List needs的更多相关文章
- 【hibernate postgresql】注解@TypeDef/@Enumerated/数据库字段gender为枚举类型,从前台接受到实体后进行保存报错:org.postgresql.util.PSQLException: ERROR: column "gender" is of type gender but expression is of type character varying
数据库字段gender为枚举类型,从前台接受到实体后进行保存报错:org.postgresql.util.PSQLException: ERROR: column "gender" ...
- paip . 解决spring No unique bean of type [com.mijie.homi.search.service.index.MoodUserIndexService]
paip . 解决spring No unique bean of type [com.mijie.homi.search.service.index.MoodUserIndexService] ...
- block中出现此种报错: Incompatible block pointer types initializing 'float (^__strong)(float, float)' with an expression of type 'int (^)(float, float)'
当block(代码块)的返回值是float时,应注意的地方:定义的返回值类型一定要与return的返回值类型一样 我们以两个数的四则运算来举例 在main.m文件中的四则运算中,我采用两种返回值类型( ...
- The expression of type Integer is unboxed into int
问题:The expression of type Integer is unboxed into int 原因:java的包装类,方法里面要的是Integer,传入的参数确实int类型 解决方案: ...
- Type Safety and Type Inference
Swift is a type-safe language. A type safe language encourages you to be clear about the types of va ...
- windows7下解决caffe check failed registry.count(type) == 1(0 vs. 1) unknown layer type问题
在Windows7下调用vs2013生成的Caffe静态库时经常会提示Check failed: registry.count(type) == 1 (0 vs. 1) Unknown layer t ...
- error C2275: 'SOCKET' : illegal use of this type as an expression
在VC中编译xxx.c文件出现错误error C2275 illegal use of this type as an expression 问题在于C99之前要求所有的声明必须放在函数块的起始部分, ...
- [TypeScript] Increase TypeScript's type safety with noImplicitAny
TypeScript tries to infer as much about your code as it can. But sometimes there really is not enoug ...
- Golang报错:Cannot convert expression of type interface{} to type []byte
在使用golang实现后端登录逻辑的时候,碰到下面的问题:Cannot convert expression of type interface{} to type []byte 首先介绍下问题出现的 ...
随机推荐
- 启动了SSH服务后,一定要关闭Telnet服务
https://baike.baidu.com/item/ssh/10407 https://baike.baidu.com/item/Telnet/810597
- arcgis server multipoint 服务 applyedit功能
首先打开arcmap,在catalog中新建 File GDB 在File GDB 中新建 Feature Class 类型选择 Multipoint 选择坐标 此时图层列表中有了新建的要素,点击Ed ...
- Photoshop制作倒影的两种方法
图片加了倒影,画面立刻变得生动起来.而用PS,制作倒影是如此的方便. 素材1 将素材1导入文档,ctrl+J复制图层,编辑-变换-垂直翻转将翻转的图层拖至下方 为翻转的图层添加图层蒙版,选中渐变工具, ...
- 站内SEO规范
一:文章的原创性 1.修改文章的标题,尽可能的选择新颖的,符合用户搜索习惯的标题. 2.修 改首段内容或自己动手来添加首段文字信息. 3.文章中图片ALT属性的修改和添加. 4.在不影响阅读的情况下, ...
- A Bug's Life-----poj2492(关系并查集)
题目链接:http://poj.org/problem?id=2492 题意是问是否存在同性恋, 就是a喜欢b,b喜欢c,a又喜欢c,所以就有同性恋了: #include<stdio.h> ...
- C++三大特性之继承
原文地址:https://qunxinghu.github.io/2016/09/12/C++%20%E4%B8%89%E5%A4%A7%E7%89%B9%E6%80%A7%E4%B9%8B%E7%B ...
- Eclipse+Pydev 搭建开发环境(转)
add by zhj: 对原文略有修改 原文:http://www.cnblogs.com/TankXiao/archive/2013/05/29/3033640.html C#之所以容易让人感兴趣, ...
- javaScript高级教程(十) iframe
1.iframe的基础,深入理解frame是何物,属性该如何设置. iframe即内联框架.不同于frame,frame与frameset综合使用,成为帧,框架集.frame已经不大使用了.说白了,f ...
- 008-spring cloud gateway-路由谓词RoutePredicate、RoutePredicateFactory
一.概述 Spring Cloud Gateway将路由作为Spring WebFlux HandlerMapping基础结构的一部分进行匹配. Spring Cloud Gateway包含许多内置的 ...
- Java接口多线程并发测试 (二)
原文地址http://www.cnblogs.com/yezhenhan/archive/2012/01/09/2317636.html 这是一篇很不错的文章,感谢原博主的分享! JAVA多线程实现和 ...