Home | History | Annotate | Download | only in mockito
      1 /*
      2  * Copyright (c) 2017 Mockito contributors
      3  * This program is made available under the terms of the MIT License.
      4  */
      5 package org.mockito;
      6 
      7 import java.lang.annotation.ElementType;
      8 import java.lang.annotation.Retention;
      9 import java.lang.annotation.RetentionPolicy;
     10 import java.lang.annotation.Target;
     11 
     12 
     13 /**
     14  * This annotation is not supposed to be used by Mockito end-users. Instead, we
     15  * use it to annotate methods for Static Analysis tools, including FindBugs and ErrorProne.
     16  * These tools can check whether the return value of our Mockito methods are actually
     17  * used. As such, Mockito State Validation can be performed at compile-time rather than run-time.
     18  * This annotation is public, because we have to use it in multiple packages.
     19  *
     20  * @see <a href="https://github.com/findbugsproject/findbugs/blob/264ae7baf890d2b347d91805c90057062b5dcb1e/findbugs/src/java/edu/umd/cs/findbugs/detect/BuildCheckReturnAnnotationDatabase.java#L120">Findbugs source code</a>
     21  * @see <a href="http://errorprone.info/bugpattern/CheckReturnValue">ErrorProne check</a>
     22  * @since 2.11.4
     23  */
     24 @Target({
     25     ElementType.CONSTRUCTOR,
     26     ElementType.METHOD,
     27     ElementType.PACKAGE,
     28     ElementType.TYPE
     29 })
     30 @Retention(RetentionPolicy.CLASS)
     31 @interface CheckReturnValue {
     32 }
     33