Annotation Type CheckReturnValue
@Documented
@Target({METHOD,CONSTRUCTOR,TYPE,PACKAGE})
@Retention(RUNTIME)
public @interface CheckReturnValue
Indicates that the return value of the annotated method must be used. An error is triggered when
one of these methods is called but the result is not used.
@CheckReturnValue
may be applied to a class or package to indicate that all methods in
that class (including indirectly; that is, methods of inner classes within the annotated class)
or package must have their return values used. For convenience, we provide an annotation, CanIgnoreReturnValue
, to exempt specific methods or classes from this behavior.