-
-
Notifications
You must be signed in to change notification settings - Fork 1.6k
Open
Description
Add rewrite support for errorprone.refasterrules
I propose integrating Google Error Prone (https://github.com/google/error-prone) with its Picnic extension (demo: https://www.youtube.com/watch?v=6llnrUtVlrE) to enable automated fixes via rewrite rules.
This would complement Checkstyle by addressing semantic bugs rather than just stylistic issues.
Motivation
Error Prone’s refaster/rewrite rules can:
- Fix common bug patterns (e.g.,
String.equals()misuse) - Modernize code (e.g., JDK migration helpers)
- Enforce best practices (e.g., null-checks)
Adoption examples:
- [openrewrite] add
tech.picnic.errorprone.refasterrulesdiffplug/spotless#2641 - Apply
StreamRulesRecipesapache/maven#11159 - Issue #17487: Add
StreamRulesRecipesapache/maven-parent#496 - Add
rewritesupport forerrorprone.refasterrulescheckstyle/checkstyle#17487 - PoC: Add
rewritesupport forerrorprone.refasterrulesapache/kafka#20219 - PoC: Add
rewritesupport forerrorprone.refasterrulesdiffplug/spotless#2576
Proposal
- Support
errorprone.refasterrulesrewrites - Keep adoption opt-in (no breaking changes)
- Provide suppression mechanisms for API constraints
Open Questions
- Scope of auto-fixes
- Suppression strategy
- Integration approach
Next Steps
I can:
- Prepare a PoC
- Help with implementation design
- Address compatibility concerns