-
-
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.refasterrules
diffplug/spotless#2641 - Apply
StreamRulesRecipes
apache/maven#11159 - Issue #17487: Add
StreamRulesRecipes
apache/maven-parent#496 - Add
rewrite
support forerrorprone.refasterrules
checkstyle/checkstyle#17487 - PoC: Add
rewrite
support forerrorprone.refasterrules
apache/kafka#20219 - PoC: Add
rewrite
support forerrorprone.refasterrules
diffplug/spotless#2576
Proposal
- Support
errorprone.refasterrules
rewrites - 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