解决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 首先介绍下问题出现的 ...
随机推荐
- tcpdump抓包二进制tcp协议详细分析
1.tcpdump -i eth0 port 11751 and src host 192.168.1.34 -x -s0 tcpdump: verbose output suppressed, us ...
- WebDriver 常用操作
1 浏览器操作 2 窗口和弹框操作 3 cookies 操作 4 简单对象的定位 5 页面元素操作 6 鼠标事件 7 键盘事件 1 浏览器操作 #属性: driver.current_url #用于获 ...
- dedecms手机站图片错误的解决方法
现在手机站(如m.*.com)是网站建设标配,在用dedecms建站也可以实现(不会的话欢迎来骚扰ytkah),手机站一个比较麻烦的事是图片一直显示不出来,为什么呢?程序一般是调用图片的相对地址,比如 ...
- JVM学习笔记-内存管理
第一章 内存分配 1. 内存区域. 方法区和堆(线程共享),程序计数器 , VM栈 和 本地方法栈(线程隔离). 1) java虚拟机栈:线程私有.描写叙述的是java方法执行的内存模 ...
- listview点击控件显示EditText,键盘弹出消失的解决方法:
1.软键盘弹出后消失解决方法 AndoridManifet 在activity中添加: android:windowSoftInputMode="adjustPan" 2.使用方式 ...
- TC命令流量控制测试(针对具体IP地址和IP协议)
这里测试系统为Linux操作系统,通过简单的TC命令来实现对带宽的控制. 1对具体IP地址的流量控制 这里采用iperf来进行带宽的测试,首先在服务器和客户端都安装上iperf软件,通过该软件下的命令 ...
- [py]str list切片-去除字符串首尾空格-递归思想
取出arr的前几项 #方法1 print([arr[0], arr[1]]) #方法2 arr2 = [] for i in range(2): arr2.append(arr[i]) print(a ...
- 字母统计-map
题目描述 输入一行字符串,计算其中A-Z大写字母出现的次数 输入描述: 案例可能有多组,每个案例输入为一行字符串. 输出描述: 对每个案例按A-Z的顺序输出其中大写字母出现的次数. 示例1 输入 复制 ...
- 搭建私有npm私库(使用verdaccio)
搭建 npm 离线服务器 为什么要搭建npm 服务器 原因: 公司内部开发的私有包,统一管理,方便开发和使用 安全性,由于公司内部开发的模块和一些内容并不希望其他无关人员能够看到,但是又希望内部能方便 ...
- SQL Server 将查询结果导出插入(insert)语句的简单方式
转自 http://blog.csdn.net/danny_style/article/details/45166391 1.首先将查询结果添加到一个原数据库中不存在的表,表名随意命名. 例:SELE ...