Skip to content

Emit @lombok.CheckReturnValue on Lombok-generated methods - #9012

Merged
timtebeek merged 1 commit into
mainfrom
tim/lombok.checkreturnvalueannotation-apply
Oct 2, 2026
Merged

timtebeek merged 1 commit into
mainfrom
tim/lombok.checkreturnvalueannotation-apply

Conversation

@timtebeek

Copy link
Copy Markdown
Member

Sets lombok.checkReturnValueAnnotation = lombok (new in Lombok 1.18.48), so generated getters, withers, build(), toString, equals and hashCode carry @lombok.CheckReturnValue. IntelliJ, Error Prone and SpotBugs then warn when a result is discarded, such as a tree.withPrefix(..) whose result is never assigned, including in downstream recipe modules. A bytecode scan of all main and test classes found no such ignored calls; the only five hits are deliberate "does not throw" checks in tests. The annotation has CLASS retention, and consumers compile cleanly with -Xlint:all -Werror even without Lombok on their classpath.

@timtebeek timtebeek changed the title Emit @lombok.CheckReturnValue on Lombok-generated methods Emit @lombok.CheckReturnValue on Lombok-generated methods Oct 1, 2026
@timtebeek
timtebeek merged commit 0e4ff8e into main Oct 2, 2026
1 check passed
@timtebeek
timtebeek deleted the tim/lombok.checkreturnvalueannotation-apply branch October 2, 2026 08:17
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Status: Done

Development

Successfully merging this pull request may close these issues.

1 participant