问题
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 warningsboxing
to suppress warnings relative to boxing/unboxing operationscast
to suppress warnings relative to cast operationsdep-ann
to suppress warnings relative to deprecated annotationdeprecation
to suppress warnings relative to deprecationfallthrough
to suppress warnings relative to missing breaks in switch statementsfinally
to suppress warnings relative to finally block that don't returnhiding
to suppress warnings relative to locals that hide variableincomplete-switch
to suppress warnings relative to missing entries in a switch statement (enum case)nls
to suppress warnings relative to non-nls string literalsnull
to suppress warnings relative to null analysisraw
to suppress warnings relative to usage of raw typesrestriction
to suppress warnings relative to usage of discouraged or forbidden referencesserial
to suppress warnings relative to missing serialVersionUID field for a serializable classstatic-access
to suppress warnings relative to incorrect static accesssuper
to suppress warnings relative to overriding a method without super invocationssynthetic-access
to suppress warnings relative to unoptimized access from inner classesunchecked
to suppress warnings relative to unchecked operationsunqualified-field-access
to suppress warnings relative to field access unqualifiedunused
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