解决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 首先介绍下问题出现的 ...
随机推荐
- git push 文件过大时出错,fatal: The remote end hung up unexpectedly
可以修改配置文件: 1 使用命令:git config http.postBuffer = 524288000 2修改git文件夹中的config文件,加入如下一段: [http] postBuffe ...
- CF1044B Intersecting Subtrees 构造+树论
正解:构造 解题报告: 传送门 又是一道交互题!爱了爱了! 这题真的,极妙!非常神仙!就非常非常思维题! 直接说解法了吼 说起来实在是简单鸭 就是先问一个对方的联通块中的一个点在我这儿的编号,记为x ...
- 关于static、内部类
1.static不能修饰外部类的原因 static修饰的成员是属于某个类的.而外部类的上一级程序单元是包,所以static不能修饰外部类. 2.外部类,内部类有不同访问权限的原因 外部类的上一级程序单 ...
- qt——QObject 与 QWidget 的区别
QObject是QT中所有类的基类,QWidget是所有UI Widget类的基类,所以QObject是QWidget的基类,从QWidget继承也就表示继承了QObject的所有属性.
- requests库的post请求
requests库的post请求 #coding:utf-8 import requests import json class Trans(object): def __init__(self, w ...
- mysql 操作sql语句 操作数据库
sql语句 #1. 操作文件夹 创建数据库:create database db1 charset utf8; 查数据库:show databases; mysql> create databa ...
- vue:Group XSwitch Actionsheet,Toast控件使用
<template> <div> <div class="vux-demo"> <img class="logo" s ...
- Lodash 中文文档 (v4.16.1) 手机版
http://lodash.swift.ren/ 手机扫描二维码直接进入
- Centos 7(Linux)环境下安装PHP(编译添加)相应动态扩展模块so(以openssl.so为例)
https://blog.csdn.net/shinesun001/article/details/54312402 在centos 7环境下搭建好Lnmp环境之后,发现安装的php有好多扩展都没有安 ...
- ab压力测试遭遇apr_socket_recv: Connection reset by peer (104) 怎么办
ab -r -c 2000 -n 200000 www.baidu.com 其实只要加上-r就可以了.但是为什么呢?ab --help就知道了 当Socket接收到错误的时候不退出,就是这句.事实 ...