如何在Eclipse-Helios JDT中专门抑制"比较相同的表达式"

kjo*_*kjo 15 java eclipse warnings suppress-warnings eclipse-jdt

我尝试用括号注释封闭方法

    @SuppressWarnings("compareIdentical")
Run Code Online (Sandbox Code Playgroud)

但这不起作用(更糟糕的是,注释会产生自己的Unsupported @SuppressWarnings("compareIdentical")警告!)

我知道我可以随时使用

    @SuppressWarnings("all")
Run Code Online (Sandbox Code Playgroud)

但这比我想要的更多警告抑制.

FWIW,我从http://help.eclipse.org/helios/index.jsp?topic=/org.eclipse.jdt.doc.isv/guide/jdt_api_compile中的"警告选项"表中获得了"compareIdentical"字符串. htm(冰雹通过,当然).

谢谢!

Mar*_*aux 14

可以在SuppressWarning注释中使用的标记列表是:

  • all 压制所有警告
  • boxing 禁止相对于装箱/拆箱操作的警告
  • cast 禁止相对于强制转换操作的警告
  • dep-ann 禁止相对于已弃用的注释的警告
  • deprecation 禁止相对于弃用的警告
  • fallthrough 禁止相对于switch语句中丢失的中断的警告
  • finally 抑制相对于不返回的finally块的警告
  • hiding 禁止相对于隐藏变量的本地人的警告
  • incomplete-switch 禁止相对于switch语句中缺少条目的警告(枚举案例)
  • nls 禁止相对于非nls字符串文字的警告
  • null 禁止相对于空分析的警告
  • raw 禁止相对于原始类型的使用的警告
  • restriction 禁止使用劝阻或禁止引用的警告
  • serial 禁止相对于可序列化类缺少serialVersionUID字段的警告
  • static-access 禁止相对于不正确的静态访问的警告
  • super 禁止相对于覆盖没有超级调用的方法的警告
  • synthetic-access 禁止相对于内部类的未优化访问的警告
  • unchecked 禁止相对于未经检查的操作的警告
  • unqualified-field-access 禁止相对于字段访问不合格的警告
  • unused 禁止相对于未使用的代码和死代码的警告

所以,没有什么可以帮助你.