@SuppressWarnings的使用

在开发中,有时候IDE/编译器会给出一些没有必要的告警。可以通过@SuppressWarnings来屏蔽。@SuppressWarnings有很多种面向场景,下面一一列出:

  • 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
最后编辑于
©著作权归作者所有,转载或内容合作请联系作者
平台声明:文章内容(如有图片或视频亦包括在内)由作者上传并发布,文章内容仅代表作者本人观点,简书系信息发布平台,仅提供信息存储服务。

推荐阅读更多精彩内容

  • Correctness AdapterViewChildren Summary: AdapterViews can...
    MarcusMa阅读 8,900评论 0 6
  • Java 注解 Dependency injection 前言 Linus Benedict Torvalds :...
    CodePlayer_Jz阅读 1,044评论 0 8
  • NAME dnsmasq - A lightweight DHCP and caching DNS server....
    ximitc阅读 2,906评论 0 0
  • 今年回河北老家的次数比以往都多,这次回来主要是忙碌三年前买房子装修的事。我对“家”的定义并非是否在一个城市拥有自己...
    星寰Helen阅读 522评论 3 6
  • 曾经有这样一个姑娘,颜值不低、学业优秀,三好生、优秀干部、奖学金从未断过,一直生活在老师、同学和亲朋好友的赞扬声中...
    MaybeeCC阅读 423评论 1 2