How to specifically suppress “Comparing identical expressions” in Eclipse-Helios JDT

拜拜、爱过 提交于 2019-12-06 17:27:26

问题


I tried annotating the enclosing method with

    @SuppressWarnings("compareIdentical")

but this does not work (worse yet, the annotation results in its own Unsupported @SuppressWarnings("compareIdentical") warning!)

I know that I can always use

    @SuppressWarnings("all")

but that'd be more warning-suppression than I want.

FWIW, I got the "compareIdentical" string from the "Warning Options" table in http://help.eclipse.org/helios/index.jsp?topic=/org.eclipse.jdt.doc.isv/guide/jdt_api_compile.htm (a hail-mary pass, to be sure).

Thanks!


回答1:


The list of tokens that can be used inside an SuppressWarning annotation is:

  • 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
  • raw to suppress warnings relative to usage of raw types
  • 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
  • super to suppress warnings relative to overriding a method without super invocations
  • 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 and dead code

So, there is nothing which might help you.



来源:https://stackoverflow.com/questions/6996631/how-to-specifically-suppress-comparing-identical-expressions-in-eclipse-helios

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!