Skip to content

Skip Python sources in CombineSemanticallyEqualCatchBlocks#908

Merged
timtebeek merged 1 commit into
mainfrom
tim/issue-907
May 28, 2026
Merged

Skip Python sources in CombineSemanticallyEqualCatchBlocks#908
timtebeek merged 1 commit into
mainfrom
tim/issue-907

Conversation

@timtebeek
Copy link
Copy Markdown
Member

@timtebeek timtebeek commented May 28, 2026

Summary

  • Fixes CombineSemanticallyEqualCatchBlocks crashes on Python catch blocks (TreeVisitorAdapter + Python RPC) #907. CombineSemanticallyEqualCatchBlocks crashed in TreeVisitorAdapter when the recipe's inner CommentVisitor (a JavaIsoVisitor) was adapted to Python Py.CompilationUnit sources. Added a new PythonFileChecker mirroring the existing KotlinFileChecker/GroovyFileChecker pattern, and used it as a precondition (Preconditions.not(new PythonFileChecker<>())) so the recipe still runs on Java, Kotlin, and Groovy files but skips Python. Also added rewrite-python as a provided dependency to support the checker.

Test plan

  • ./gradlew test --tests CombineSemanticallyEqualCatchBlocksTest

The recipe's `CommentVisitor` is a `JavaIsoVisitor` that crashes in
`TreeVisitorAdapter` when adapted to Python `Py.CompilationUnit`
sources. Add a `PythonFileChecker` and use it as a precondition to
exclude Python files while keeping Java, Kotlin, and Groovy support.
@github-project-automation github-project-automation Bot moved this to In Progress in OpenRewrite May 28, 2026
@timtebeek timtebeek merged commit 5ab23a2 into main May 28, 2026
1 check passed
@timtebeek timtebeek deleted the tim/issue-907 branch May 28, 2026 10:24
@github-project-automation github-project-automation Bot moved this from In Progress to Done in OpenRewrite May 28, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Status: Done

Development

Successfully merging this pull request may close these issues.

CombineSemanticallyEqualCatchBlocks crashes on Python catch blocks (TreeVisitorAdapter + Python RPC)

1 participant