apache / apache/maven-parent

Proposal: Add `rewrite` support for `errorprone.refasterrules`

Open
#491 0 comments 0 reactions 0 assignees View on GitHub
enhancement
Dominant language
No language data
Stars
36
Forks
30
Avg merge
1d 7h
Merged PRs (30d)
7

Description

## Proposal: Add `rewrite` support for `errorprone.refasterrules`

I’d like to propose integrating [Google’s Error Prone](https://github.com/google/error-prone) and its Picnic extension (demonstrated in [Automating Away Bugs with Error Prone | PlatformCon 2023](https://www.youtube.com/watch?v=6llnrUtVlrE)) to enable automated bug fixes via `rewrite` rules. This would complement Checkstyle’s static analysis capabilities by addressing semantic bugs rather than stylistic issues.

## Motivation
Error Prone’s `refaster`/`rewrite` rules can automatically:
- Fix common bug patterns (e.g., `String.equals()` misuse)
- Modernize code (e.g., JDK migration helpers)
- Enforce best practices (e.g., null-check improvements)

Real-world adoptions show tangible benefits:
- https://github.com/pmd/pmd/pull/5956
- https://github.com/checkstyle/checkstyle/pull/17490
- https://github.com/apache/kafka/pull/20219
- https://github.com/diffplug/spotless/pull/2576

## Proposal
1. Add support for `errorprone.refasterrules`-based rewrites
2. Implement with opt-in adoption (no breaking changes)
3. Include suppression mechanisms for API constraints

## Discussion Points
- Need consensus on:
- Scope of auto-fixes
- Preferred suppression strategy
- Integration approach

## Next Steps
I’m happy to:
- Prepare a PoC demonstrating the value
- Collaborate on implementation strategy
- Address any concerns about compatibility

relates to:

- https://github.com/apache/maven-parent/issues/238

Contributor guide

No contributing guide indexed for this repository

Research direction

No files, tests, or implementation entry points are named. Start by reviewing the Maven parent POMs and the linked Error Prone, Picnic, PMD, Checkstyle, Kafka, and Spotless examples; done means reaching consensus on scope, suppression, compatibility, and an opt-in integration approach.

Written by the indexing model from the issue text.

Assessment

Tech stack
java
Domain
build-system, tooling
Issue type
Feature
Difficulty
5/5
Estimated time
Over a week
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.