openrewrite / rewrite-static-analysis

OpenRewrite recipes for identifying and fixing static analysis issues.
Apache License 2.0
27 stars 43 forks source link

Skip RenamePrivateFieldsToCamelCase when using lombok #268

Closed timtebeek closed 3 months ago

timtebeek commented 4 months ago

Fixes https://github.com/openrewrite/rewrite-static-analysis/issues/267

Mirrors what we do in RemoveUnusedPrivateFields https://github.com/openrewrite/rewrite-static-analysis/blob/106421ad4d1db3fe062c8743d042627e07598a8c/src/main/java/org/openrewrite/staticanalysis/RemoveUnusedPrivateFields.java#L42

Anyone you would like to review specifically?

@blipper

blipper commented 4 months ago

Weird.

It seems to have lost my comments

blipper commented 4 months ago

I suspect that any lombok annotation is overly broad. Things like @NonNull are useful and don't indicate anything about usage. https://projectlombok.org/features/

I would suggest filtering on @Getter @Setter @Data @Value @Builder @With

And then filter out everything in the experimental package.
https://projectlombok.org/features/experimental/

timtebeek commented 3 months ago

Thanks for the suggestion! Think that would make a worthwhile addition, but due to time constraints I'm merging as is for now, such that we do no harm in cases where we should not make a change. We can restore more selective changes in a followup PR both here in RenamePrivateFieldsToCamelCase and in RemoveUnusedPrivateFields.