Skip to content

[GR-68578] Add rewrite support for errorprone.refasterrules #11898

@Pankraz76

Description

@Pankraz76

Add rewrite support for errorprone.refasterrules

I’d like to propose integrating Google’s Error Prone and its Picnic extension (demonstrated in Automating Away Bugs with Error Prone | PlatformCon 2023) 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:

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

Feature request

Please include the following information:

Is your feature request related to a problem? Please describe.
A clear and concise description of what the problem is. E.g. I'm always frustrated when [...]

Describe the solution you'd like.
A clear and concise description of what you want to happen.

Describe who do you think will benefit the most.
GraalVM users, GraalVM contributors, developers of libraries and frameworks which depend on GraalVM, or somebody else?

Describe alternatives you've considered.
A clear and concise description of any alternative solutions or features you've considered.

Additional context.
Add any other context about the feature request here.
For example, link to the relevant projects, documentation, standards.

Express whether you'd like to help contributing this feature
If you'd like to contribute, please read the contribution guide.

Metadata

Metadata

Assignees

Labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions