Add @lombok.CheckReturnValue to @With and @Builder build() methods for static analysis - #4013
Add @lombok.CheckReturnValue to @With and @Builder build() methods for static analysis#4013timtebeek wants to merge 7 commits into
@lombok.CheckReturnValue to @With and @Builder build() methods for static analysis#4013Conversation
…ted methods where the return value should not be ignored. Adds the annotation to @with, @Withby, @Builder.build(), and @SuperBuilder.build() methods. Controlled via lombok.addCheckReturnValueAnnotation config key (default: true). Static analysis tools (Error Prone, IntelliJ, SpotBugs) recognize @CheckReturnValue by simple name and will warn when the return value is discarded.
…han opt-out to avoid breaking existing tests.
|
The concept is approved, but we want to release a JDK26 compatible version first. A few changes to the design:
We can solve both of those in one swoop with a
Later on we can add more values, such as |
|
Great to hear and thanks for the new release; let me know if you'd want me to make any changes, or if you'd prefer to do so yourself. |
…d `lombok.checkReturnValueAnnotation` config key. Per PR projectlombok#4013 review, swap the boolean `lombok.addCheckReturnValueAnnotation` for an enum-valued `lombok.checkReturnValueAnnotation` (values: `none`, `lombok`; default: `none`). This leaves room for additional flavors (`jetbrains`, `errorprone`, `custom: FQN`) in future releases without another key rename, and for flipping the default to `lombok` after a release cycle or two.
|
I've made the above changes on my branch, as well as merged |
|
@timtebeek LGTM, but you haven't added your name to the AUTHORS file. Can you throw one more commit in here with that update? |
|
Done, thanks! Looking forward to using this in our analyses. |
As briefly discussed at JFall.
@CheckReturnValueannotation on generated methods where applicable #3984