Skip to content

Add rewrite support for errorprone.refasterrules #2634

@Pankraz76

Description

@Pankraz76

Add rewrite support for errorprone.refasterrules

I propose integrating Google Error Prone with its Picnic extension (see Automating Away Bugs with Error Prone | PlatformCon 2023) 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:

Proposal

  1. Add support for errorprone.refasterrules rewrites
  2. Make adoption opt-in (no breaking changes)
  3. Provide suppression mechanisms for API constraints

Open Questions

  • Scope of auto-fixes
  • Preferred suppression strategy
  • Integration approach

Next Steps

I can:

  • Prepare a PoC
  • Help design the implementation
  • Address compatibility concerns

Most earlier objections have been resolved; from a technical perspective, there’s little reason not to automate this now—unless new concerns arise.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions