Skip to content

Fix RemoveTryCatchFailBlocks failing when removing blocks within lambda expressions#970

Merged
sambsnyd merged 3 commits intomainfrom
fix-removetrycatch-lambda
Apr 15, 2026
Merged

Fix RemoveTryCatchFailBlocks failing when removing blocks within lambda expressions#970
sambsnyd merged 3 commits intomainfrom
fix-removetrycatch-lambda

Conversation

@sambsnyd
Copy link
Copy Markdown
Member

Noticed in flagship recipe runs

@sambsnyd sambsnyd merged commit 675b57d into main Apr 15, 2026
1 check passed
@sambsnyd sambsnyd deleted the fix-removetrycatch-lambda branch April 15, 2026 22:15
@github-project-automation github-project-automation Bot moved this from In Progress to Done in OpenRewrite Apr 15, 2026
timtebeek added a commit that referenced this pull request Apr 16, 2026
Follow-up to #970, which disabled `doNotChangeAlreadyUnitTestMethods` with
comment "flaky on CI but I don't know why".

Root cause: as of rewrite 8.79.4 (openrewrite/rewrite#7364), the Kotlin
parser maps non-nullable `kotlin.Unit` to JVM `JavaType.Primitive.Void`.
`TypeUtils.isOfClassType(type, "kotlin.Unit")` returns false for a
primitive, so the recipe no longer skips already-Unit methods and rewrites
them unnecessarily — tripping the single-cycle stability check on CI.
Locally, stale `rewrite-kotlin` snapshots still carry the pre-change
behaviour, which is why the failure was CI-only.

Use `KotlinTypeUtils.isKotlinUnit` (introduced in the same PR #7364)
which accepts either `JavaType.Primitive.Void` or a `kotlin.Unit` class
reference, and re-enable the disabled test.
timtebeek added a commit that referenced this pull request Apr 16, 2026
)

Follow-up to #970, which disabled `doNotChangeAlreadyUnitTestMethods` with
comment "flaky on CI but I don't know why".

Root cause: as of rewrite 8.79.4 (openrewrite/rewrite#7364), the Kotlin
parser maps non-nullable `kotlin.Unit` to JVM `JavaType.Primitive.Void`.
`TypeUtils.isOfClassType(type, "kotlin.Unit")` returns false for a
primitive, so the recipe no longer skips already-Unit methods and rewrites
them unnecessarily — tripping the single-cycle stability check on CI.
Locally, stale `rewrite-kotlin` snapshots still carry the pre-change
behaviour, which is why the failure was CI-only.

Use `KotlinTypeUtils.isKotlinUnit` (introduced in the same PR #7364)
which accepts either `JavaType.Primitive.Void` or a `kotlin.Unit` class
reference, and re-enable the disabled test.
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