Commit 83d1f44
authored
Use KotlinTypeUtils.isKotlinUnit to match Kotlin void return types (#971)
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.1 parent 675b57d commit 83d1f44
2 files changed
Lines changed: 2 additions & 3 deletions
File tree
- src
- main/java/org/openrewrite/java/testing/cleanup
- test/java/org/openrewrite/java/testing/cleanup
Lines changed: 2 additions & 1 deletion
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
26 | 26 | | |
27 | 27 | | |
28 | 28 | | |
| 29 | + | |
29 | 30 | | |
30 | 31 | | |
31 | 32 | | |
| |||
52 | 53 | | |
53 | 54 | | |
54 | 55 | | |
55 | | - | |
| 56 | + | |
56 | 57 | | |
57 | 58 | | |
58 | 59 | | |
| |||
Lines changed: 0 additions & 2 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
15 | 15 | | |
16 | 16 | | |
17 | 17 | | |
18 | | - | |
19 | 18 | | |
20 | 19 | | |
21 | 20 | | |
| |||
309 | 308 | | |
310 | 309 | | |
311 | 310 | | |
312 | | - | |
313 | 311 | | |
314 | 312 | | |
315 | 313 | | |
| |||
0 commit comments