@Target(value=METHOD) @Retention(value=CLASS) public @interface CheckReturnValue
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.
Copyright © 2026. All rights reserved.