Skip to content

Conversation

Pankraz76
Copy link

@Pankraz76 Pankraz76 commented Aug 3, 2025

checkstyle/checkstyle#17487

OPE-930: 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

@Pankraz76 Pankraz76 marked this pull request as ready for review August 4, 2025 14:07
@Pankraz76 Pankraz76 requested a review from a team as a code owner August 4, 2025 14:07
@Pankraz76
Copy link
Author

Pankraz76 commented Aug 4, 2025

kindly request some feedback, thanks.

FYI:
@elharo

@lukasz-jarocki-sonarsource
Copy link
Member

lukasz-jarocki-sonarsource commented Aug 4, 2025

Internally we will track the review of this PR under this ticket: https://sonarsource.atlassian.net/browse/OPE-930

@Pankraz76
Copy link
Author

waiting for simple enabler:

@Pankraz76
Copy link
Author

closing to stop starting start finishing.

@Pankraz76 Pankraz76 closed this Aug 17, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants