解决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的更多相关文章

  1. 【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" ...

  2. 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] ...

  3. block中出现此种报错: Incompatible block pointer types initializing 'float (^__strong)(float, float)' with an expression of type 'int (^)(float, float)'

    当block(代码块)的返回值是float时,应注意的地方:定义的返回值类型一定要与return的返回值类型一样 我们以两个数的四则运算来举例 在main.m文件中的四则运算中,我采用两种返回值类型( ...

  4. The expression of type Integer is unboxed into int

    问题:The expression of type Integer is unboxed into int 原因:java的包装类,方法里面要的是Integer,传入的参数确实int类型 解决方案: ...

  5. 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 ...

  6. 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 ...

  7. 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之前要求所有的声明必须放在函数块的起始部分, ...

  8. [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 ...

  9. Golang报错:Cannot convert expression of type interface{} to type []byte

    在使用golang实现后端登录逻辑的时候,碰到下面的问题:Cannot convert expression of type interface{} to type []byte 首先介绍下问题出现的 ...

随机推荐

  1. 新建虚拟机_WIN7 32位系统

    准备工作:下载win7 32位纯净版镜像文件 大部分步骤与安装XP系统相似,此处只说明一下不同: 创建好虚拟机后启动有报错:CHS data ERROR,无法从CD/DVD启动 编辑虚拟机--> ...

  2. elasticsearch的重启

    没有重启的操作,只有关闭了再启动的操作. ps -ef | grep elastic e表示全部的进程,f表示展示进程间的相关关系,如父子进程. 然后找到你启动es的那个账号,不是root,一般是新建 ...

  3. lua 获取指定目录下指定后缀文件名

    lfs库是很好的选择,可惜不会编译,无奈只能自己写个简单的lua库.代码如下: #include <io.h> #include <stdio.h> #include &quo ...

  4. 【解决】win10 启用系统保护 灰色 不可选 的解决办法

    安装Win10后,发现系统保护无法启用.'启用系统保护' 灰色 不可选状态: 搜了一堆解决办法,包括: 1.组策略修改 2.服务启用 3.各种重启 等,不适用. 然后,我把系统预留分区 删了,删了…… ...

  5. dedecms用keyword标签调用含有某一关键词的文章

    前面我们探讨了调用{dede:likewords}为dedecms添加相关搜索词,如果要调用含有某一关键词的文章可以实现吗?比如ytkah的网站有很多文章中含有“微信”的词,那么想在网站首页.频道页. ...

  6. android 网络监测

    public class NetWorkStateReceiver extends BroadcastReceiver { @Override public void onReceive(Contex ...

  7. PAT 1016 Phone Bills[转载]

    1016 Phone Bills (25)(25 分)提问 A long-distance telephone company charges its customers by the followi ...

  8. Django的基本开发环境配置和MTV模型

    一.MTV模型 Django的MTV分别代表: Model(模型):负责业务对象与数据库的对象(ORM) Template(模版):负责如何把页面展示给用户 View(视图):负责业务逻辑,并在适当的 ...

  9. Summary: Prime

    最近遇到很多问题都跟Prime有关,于是总结一下: Prime definition:A prime number (or a prime) is a natural number greater t ...

  10. 【Rewrite重定向】Nginx使用rewrite重新定向

    使用nginx做重新定向. nginx参考网址:http://blog.sina.com.cn/s/blog_97688f8e0100zws5.html 语法规则: location [=|~|~*| ...