Annotation Type CheckReturnValue


@Target(METHOD) @Retention(CLASS) public @interface CheckReturnValue
Lombok adds this annotation to generated methods where the return value should not be ignored.

For example, @With methods return a new instance, so ignoring the return value is always a bug. Similarly, @Builder's build() method produces the built object.

Static analysis tools (Error Prone, IntelliJ, SpotBugs) recognize @CheckReturnValue by simple class name, regardless of package, and will warn when the return value is discarded.

If you want to opt in, you can add lombok.checkReturnValueAnnotation = lombok to lombok.config.