@ Suppresswarnings Annotation

Source: Internet
Author: User

Introduction: Java. Lang. suppresswarnings is one of the standard annotation in j2se 5.0. It can be labeled on classes, fields, methods, parameters, constructor methods, and local variables.
Purpose: Tells the compiler to ignore the specified warning without warning after compilation.
Usage:
@ Suppresswarnings ("")
@ Suppresswarnings ({})
@ Suppresswarnings (value = {})

According to Sun's official documentation:
Value-the warning set that will be removed by the compiler in the annotated element. Duplicate names are allowed. The second and subsequent names are ignored. Unrecognized warning name No Error: the compiler must ignore all unrecognized warning names. However, if a comment contains an unrecognized warning name, the compiler can send a warning at will. Compiler vendors should record the warning names they support along with the annotation type. Vendors are encouraged to work with each other to ensure that the same name is used in multiple compilers. Example: · @ Suppresswarnings ("unchecked") tells the compiler to ignore unchecked warning information, such as warnings generated without parameterization using list or arraylist. · @ Suppresswarnings ("serial") if the compiler displays the following warning message: the serializable class wmailcalendar does notdeclare a static final serialversionuid field of type long
Use this annotation to remove the warning information. · @ Suppresswarnings ("deprecation") if the @ deprecated annotation method is used, the compiler displays a warning message.
Use this annotation to remove the warning information. · @ Suppresswarnings ("unchecked", "deprecation") tells the compiler to ignore both unchecked and deprecation warnings. · @ Suppresswarnings (value = {"unchecked", "deprecation"}) is equivalent to @ suppresswarnings ("unchecked", "deprecation ")

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.