@SuppressWarnings注解详解
@SupperessWarnings
一.简介:java.lang.SupperessWarnings是J2SE5.0标准的Annotation之一。可以标注在类,字段,方法,参数,构造方法,局部变量上。
二.作用:该注解的作用是给编译器一条指令,告诉它对批注的代码元素内部的某些警告保持静默,不在编译完成后出现警告信息。
三.使用
@SuppressWarnings(“”)
@SuppressWarnings({})
@SuppressWarnings(value={})
示例:
使用这个注释将警告信息去掉。
使用这个注释将警告信息去掉。
等同于@SuppressWarnings("unchecked", "deprecation")
编码时候出现如下的警告提示:
上述的代码编译可以运行,但每行前面的“感叹号”就严重阻碍了我们判断该行是否设置断点。这是我们可以在方法的前面增加@SuppressWarnings(“unused”)来去除”感叹号“
四.注解里面使用的关键字
- all to suppress all warnings (抑制所有警告)
- boxing to suppress warnings relative to boxing/unboxing operations(抑制装箱、拆箱操作时候的警告)
- cast to suppress warnings relative to cast operations (抑制映射相关的警告)
- dep-ann to suppress warnings relative to deprecated annotation(抑制启用注释的警告)
- deprecation to suppress warnings relative to deprecation(抑制过期方法警告)
- fallthrough to suppress warnings relative to missing breaks in switch statements(抑制确在switch中缺失breaks的警告)
- finally to suppress warnings relative to finally block that don’t return (抑制finally模块没有返回的警告)
- hiding to suppress warnings relative to locals that hide variable()
- incomplete-switch to suppress warnings relative to missing entries in a switch statement (enum case)(忽略没有完整的switch语句)
- nls to suppress warnings relative to non-nls string literals(忽略非nls格式的字符)
- null to suppress warnings relative to null analysis(忽略对null的操作)
- rawtypes to suppress warnings relative to un-specific types when using generics on class params(使用generics时忽略没有指定相应的类型)
- restriction to suppress warnings relative to usage of discouraged or forbidden references
- serial to suppress warnings relative to missing serialVersionUID field for a serializable class(忽略在serializable类中没有声明serialVersionUID变量)
- static-access to suppress warnings relative to incorrect static access(抑制不正确的静态访问方式警告)
- synthetic-access to suppress warnings relative to unoptimized access from inner classes(抑制子类没有按最优方法访问内部类的警告)
- unchecked to suppress warnings relative to unchecked operations(抑制没有进行类型检查操作的警告)
- unqualified-field-access to suppress warnings relative to field access unqualified (抑制没有权限访问的域的警告)
- unused to suppress warnings relative to unused code (抑制没被使用过的代码的警告)
@SuppressWarnings注解详解相关推荐
- Java基础13:反射与注解详解
Java基础13:反射与注解详解 什么是反射? 反射(Reflection)是Java 程序开发语言的特征之一,它允许运行中的 Java 程序获取自身的信息,并且可以操作类或对象的内部属性. Orac ...
- 26.SpringBoot事务注解详解
转自:https://www.cnblogs.com/kesimin/p/9546225.html @Transactional spring 事务注解 1.简单开启事务管理 @EnableTrans ...
- mybatis注解详解
mybatis注解详解 首 先当然得下载mybatis-3.0.5.jar和mybatis-spring-1.0.1.jar两个JAR包,并放在WEB-INF的lib目录下 (如果你使用maven,则 ...
- 开启注解缓存_Spring Boot 2.x基础教程:进程内缓存的使用与Cache注解详解
随着时间的积累,应用的使用用户不断增加,数据规模也越来越大,往往数据库查询操作会成为影响用户使用体验的瓶颈,此时使用缓存往往是解决这一问题非常好的手段之一.Spring 3开始提供了强大的基于注解的缓 ...
- spring-boot注解详解(一)
spring-boot注解详解(一) @SpringBootApplication @SpringBootApplication = (默认属性)@Configuration + @EnableAut ...
- Spring零配置之@Configuration注解详解
转载自 Spring零配置之@Configuration注解详解 @Configuration介绍 Spring3.0之前要使用Spring必须要有一个xml配置文件,这也是Spring的核心文件,而 ...
- Spring Boot注解详解
文章目录 使用注解的优势 注解详解(配备了完善的释义) 注解列表如下 JPA注解 springMVC相关注解 全局异常处理 项目中具体配置解析和使用环境 使用注解的优势 采用纯java代码,不在需要配 ...
- 【SpringBoot 】SpringBoot注解详解
[SpringBoot ]SpringBoot注解详解 一.注解(annotations)列表 @SpringBootApplication:包含了@ComponentScan.@Configura ...
- java method 注解_JAVA 注解详解及简单实例
JAVA 注解详解及简单实例 何为注解 注解(Annotation)又称为元数据,在JDK1.5后引入,它的作用是: 生成文档 这是注解的原始用途,可以通过注解生成JavaDoc文档 跟踪代码的依赖 ...
最新文章
- python 使用import导入不同文件下的文件
- 据说这是大多数人【减肥】的真实写照
- 详解GCN、GAT、凸优化、贝叶斯、MCMC、LDA
- insert获取主键、联合关联查询
- Prolog 语言入门
- validate验证长度 vue_vue input 输入校验字母数字组合且长度小于30的实现代码
- 你还在为20倍的连麦成本发愁吗?
- 自己实现JSON、XML的解析 没那么难
- Taro+react开发(5)--tora项目开发安装
- iOS逆向工程(简单利用dumpdecrypted给ipa砸壳)
- CompletableFuture 异步编程
- 树状数组--快捷的线段树
- TCP的电话系统比喻
- wpf 自动完成comboxBox
- iphone 控制 android手机,新潮来袭:苹果手机控制安卓手机
- nginx源码编译安装和配置
- Re: 一个公司如何才能留住员工呢?
- CryEngine事件监听器概览
- 解决win2003里IIS运行ASP时出现请求资源在使用中的问题
- 年轻人转行需三思,未来5-10年什么工作真吃香?