Skip to content

Use JavaFileChecker preconditions instead of isAcceptable overrides - #1219

Merged
timtebeek merged 1 commit into
mainfrom
tim/java-file-checker-precondition
Oct 24, 2026
Merged

timtebeek merged 1 commit into
mainfrom
tim/java-file-checker-precondition

Conversation

@timtebeek

Copy link
Copy Markdown
Member

Follow-up to 6f44114 in #1217, which made the same change in TestMethodsShouldBeVoid. Five more recipes limited themselves to Java (or Java and Kotlin) by overriding isAcceptable on their visitor. They now state that limit as a precondition instead, with new JavaFileChecker<>() (or Preconditions.or(new JavaFileChecker<>(), new KotlinFileChecker<>()) in AssertThrowsOnLastStatement) added to the existing precondition. Which files each recipe visits doesn't change, and the comments explaining why other languages are skipped stay next to the precondition.

Verified with ./gradlew test on the tests of the five changed recipes: all 65 pass.

@github-project-automation github-project-automation Bot moved this to In Progress in OpenRewrite Oct 24, 2026
@timtebeek
timtebeek merged commit 35949bc into main Oct 24, 2026
2 checks passed
@timtebeek
timtebeek deleted the tim/java-file-checker-precondition branch October 24, 2026 12:27
@github-project-automation github-project-automation Bot moved this from In Progress to Done in OpenRewrite Oct 24, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Archived in project

Development

Successfully merging this pull request may close these issues.

1 participant