Android-warning:not Annotated parameter overrides @NonNull parameter

Source: Internet
Author: User

Warning:not Annotated parameter overrides @NonNull parameter


This address: Http://blog.csdn.net/caroline_wendy


Warning:the @NonNull annotation can is used to indicate, a given parameter can not be null.
The meaning of "@NonNull" is that the comment is non-null, and if the above warning appears, the parameter should have a non-empty callout; as added:

public void OnReceive (@NonNull context context, @NonNull Intent Intent);

Specific:It's an annotation, and the correct name is nonnull:
protected void Onsaveinstancestate (@NonNull Bundle outstate)(and also)import Android.support.annotation.NoNNull;
The compiler to warn when certain assumptions was being violated (such as a parameter of a Met purpose Hod that should always has a value, as in this particular case, although there is others). From the Support Annotations documentation:
The @NonNull annotation can used to indicate, a given parameter can not be null.
If A local variable is known to being null (for example because some earlier code checked whether it's null), and you P The parameter to a method where this parameter is marked as @NonNull, the IDE would warn you have a pote Ntial crash.
They is tools for static analysis. Runtime behavior is isn't altered at all.
Reference: http://stackoverflow.com/questions/24728627/ Meaning-of-android-studio-error-not-annotated-parameter-overrides-notnull-para




Android-warning:not Annotated parameter overrides @NonNull parameter

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.