Java中有效的@SuppressWarnings警告名称是什么? [英] What is the list of valid @SuppressWarnings warning names in Java?

查看:583
本文介绍了Java中有效的@SuppressWarnings警告名称是什么?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述



c code code code code code code $ c =h2_lin>解决方案

这取决于您的IDE或编译器。



这是一个 list



  • 全部以禁止所有警告

  • 拳击以禁止相对于拳击/拆箱操作的警告

  • 投放以遏制相对于投射操作的警告

  • dep-ann 可以抑制相对于已弃用的注释

  • 弃用以禁止相对于弃用的警告

  • fallthrough 错过了休息切换
    语句

  • 终于可以抑制相对于finally块的警告
    返回

  • 隐藏以抑制相对于隐藏变量

  • 不完整开关的本地人的警告,以抑制相对于缺少条目的警告
    在switch语句(枚举大小写)中

  • nls 以禁止相对于非nls字符串文字的警告

  • null 以禁止相对于空分析的警告

  • 限制可以抑制与使用不鼓励或
    禁止引用的警告

  • serial 可以抑制相对于serialVersionUID的错误警告
    字段为可序列化类

  • 静态访问以抑制相对于不正确的静态
    访问的警告

  • 合成访问以抑制w

  • 未选中相对于未优化的
    访问相对于未选中操作的警告

  • <强>不合格的现场访问可以抑制相对于字段的警告
    访问不合格

  • 未使用可禁止相对于未使用的代码的警告


列表添加:



  • javadoc 可抑制相对于javadoc警告的警告

  • rawtypes 相对于使用原始类型的警告

  • static-method 可以抑制相对于可以声明为静态的方法的警告

  • 超级可以抑制相对于覆盖我的警告没有超级调用的方法


列表为Juno添加:



  • 资源以抑制相对于使用类型Closeable的资源的警告

  • 同步覆盖可抑制警告,因为覆盖同步方法时缺少同步




开普勒和Luna使用与Juno相同的令牌列表(

其他将类似但不同。


What is the list of valid @SuppressWarnings warning names in Java?

The bit that comes in between the ("") in @SuppressWarnings("").

解决方案

It depends on your IDE or compiler.

Here is a list for Eclipse Galileo:

  • 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
  • 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

List for Indigo adds:

  • javadoc to suppress warnings relative to javadoc warnings
  • rawtypes to suppress warnings relative to usage of raw types
  • static-method to suppress warnings relative to methods that could be declared as static
  • super to suppress warnings relative to overriding a method without super invocations

List for Juno adds:

  • resource to suppress warnings relative to usage of resources of type Closeable
  • sync-override to suppress warnings because of missing synchronize when overriding a synchronized method

Kepler and Luna use the same token list as Juno (list).

Others will be similar but vary.

这篇关于Java中有效的@SuppressWarnings警告名称是什么?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆