在java编译过程中会出现很多警告,有很多是安全的,但是每次编译有很多警告影响我们对error的过滤和修改,我们可以在代码中加上

@SuppressWarnings(“XXXX”) 来解决

例如:@SuppressWarnings("deprecation")表示不显示使用了不赞成使用的类或方法时的警告

具体的XXXX的意义可以参考博文

http://www.thebuzzmedia.com/supported-values-for-suppresswarnings/

Update #1All these annotations are still valid in Eclipse 3.4 and 3.5, there have been no new SuppressWarning arguments added in those versions of the JDT compiler.

If you are a Java developer and use the new @SuppressWarnings annotation in your code from time-to-time to suppress compiler warnings you, like me, have wondered probably about a million times alreadyjust exactly what are the supported values that can be used with this annotation.

The reason the list isn’t easy to find is because it’s compiler specific, which means Sun may have a different set of supported values than say IBM, GCJ or Apache Harmony.

Fortunately for us, the Eclipse folks have documented the values they support (As of Eclipse 3.3), here they are for reference:

  • 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
  • finally to suppress warnings relative to finally block that don’t return
  • 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)
  • nls to suppress warnings relative to non-nls string literals
  • null to suppress warnings relative to null analysis
  • rawtypes to suppress warnings relative to un-specific types when using generics on class params
  • 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
  • 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

JavaSE: SuppressWarnings[转]相关推荐

  1. JavaSE总结知识点 重要的点(并不是详细的教材语录)

    JavaSE总结知识点 9天看完 Day1 一.Java基础概述 1.常用DOS命令 2.Java发展史 3.Java语言特点 4.JVM.JRE.JDK 5.Java和C++的区别 6.import ...

  2. 「JavaSE」- 常用类

    常用类 Object类 Object是所有类的父类,任何类都默认继承Object.理论上Object类是所有类的父类,即直接或间接的继承java.lang.Object类.由于所有的类都继承在Obje ...

  3. JavaSE阶段笔记

    JavaSE 一.Java编程基础 ①.数据类型 基本数据类型 数值型(int,long) 字符型(char) 布尔型(boolean) 引用数据类型 类(class) 接口(interface) 数 ...

  4. JAVASE知识点整理(超万字)

    本文章只写每个知识点的例句,想了解具体的,请到JavaSE目录查看 javaSE阶段各知识点 javaSE阶段各知识点 一.环境配置 1 JDK环境变量path配置作用: 2 JDK,JRE,JVM的 ...

  5. javaSE基础重点知识点总结 持续更新

    javaSE基础重点知识点解析 文章目录 javaSE基础重点知识点解析 前言 1.重载和重写 2.匿名对象 3.可变个数形参的方法 4.MVC设计模式 5.java.lang.Object类 6.自 ...

  6. 【JavaSE】之注解与反射

    [JavaSE]注解与反射 前言 一.注解 1.注解概述 2.内置注解 3.元注解 4.自定义注解 二.反射 1.静态语言&动态语言 2.反射概述 3.Class类及获取Class类实例 4. ...

  7. JAVASE高级部分

    javaSE高级部分: 1 多线程: 创建多线程的方式: 1 继承Thread类 ​ 步骤: ​ 1 创建一个继承于Thread类的子类 ​ 2 重写Thread类的run(),将线程需要执行的操作声 ...

  8. JavaSE - 14 枚举 + 注解

    提示:文章写完后,目录可以自动生成,如何生成可参考右边的帮助文档 文章目录 1.枚举 1.1 概述 1.2 枚举的定义格式 1.3 枚举常用的方法 2.注解 2.1 注解概述 2.2 自定义注解 2. ...

  9. 重学JavaSE 第12章 : 枚举和注解、注解的实战使用

    文章目录 一.枚举类的使用 1.1.枚举类的理解 1.2.自定义枚举类 1.3.使用enum关键字定义枚举类 1.4.Enum类中的常用方法 1.5.使用enum关键字定义的枚举类实现接口 二.注解的 ...

最新文章

  1. 如何在一个程序集中序列化在另一个中反序列化
  2. python教程:os.chdir() 基本用法
  3. windows编程,消息函数中拦截消息的问题
  4. oracle分页查询前10条,Oracle查询前十条记录及分页查询(第5条到第10记录)
  5. LeetCode Gray Code 格雷码
  6. catia圆管焊接焊接_CATIA焊接教程.ppt
  7. DNN 汉化中的问题????
  8. java动态数据国际化_基于 AOP 的动态数据国际化框架的设计与实现
  9. Effective C++ 笔记(1)让自己习惯c++
  10. 他人笑我太疯癫 我笑他人看不穿
  11. 大学生程序员被勒索比特币后,绝地反击! | 原力计划
  12. arcgis绘制shp文件
  13. node-sass 安装失败,原因总结
  14. 如何提高电路工作频率
  15. PCB贴片元器件手工焊接技巧及要点
  16. Python制作古诗生成器
  17. 大学英语B116-阅读理解
  18. java清空购物车方法_Javaweb网上商城项目实战(21)删除和清空购物车
  19. python代码画大白_Python turtle 画个大白
  20. MySql安装与使用

热门文章

  1. java空间大战,看这篇足矣了!
  2. html一段文字弹窗提示代码,css3提示文字弹窗代码
  3. android主题切换框架,Android主题切换日夜间模式与换肤框架小结
  4. python中英文字频率_python统计文本字符串里单词出现频率的方法
  5. python 生成excel_python 数据生成excel导出(xlwt,wlsxwrite)代码实例
  6. 删除文件部分内容 php,php实现遍历目录并删除指定文件中指定内容_php技巧
  7. python在docx指定位置插表格_超简单Python将指定数据插入到docx模板指定位置渲染并保存...
  8. HTTP/2中的二进制分帧
  9. 彻底理解AMD和CMD
  10. html5三角函数怎么用,HTML5(五)html5<canvas路径和三角函数的故事>(下)