javase:suppresswarnings[Turn]

Source: Internet
Author: User
Tags deprecated finally block

There are a lot of warnings during the Java compilation process, many of which are secure, but there are a lot of warnings for each compilation that affect our filtering and modification of error, and we can add

@SuppressWarnings ("XXXX") to resolve

For example: @SuppressWarnings ("deprecation") indicates that a warning is not displayed when a class or method is used that is deprecated

Specific xxxx meaning can refer to the blog

http://www.thebuzzmedia.com/supported-values-for-suppresswarnings/

Update #1: All These annotations is still valid in Eclipse 3.4 and 3.5, there has been no new Suppresswarni Ng arguments added in those versions of the JDT compiler.

If you is a Java developer and use the new @SuppressWarnings annotation in your code from Time-to-time to suppress Compil  Er warnings you, like me, has wondered probably about a million times alreadyjust exactly what is the supported values that can is used with this annotation.

The reason the list isn ' t easy-to-find is because it's compiler specific, which means Sun may has a different set of supp Orted values than say IBM, GCJ or Apache Harmony.

Fortunately for us, the eclipse folks has documented the values they support (as of Eclipse 3.3), here they is For reference:

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

javase:suppresswarnings[Turn]

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.