Skip to content

Fix Kotlin tests after K2 compiler upgrade#940

Merged
timtebeek merged 1 commit intomainfrom
timtebeek/fix-ci-failures
Feb 19, 2026
Merged

Fix Kotlin tests after K2 compiler upgrade#940
timtebeek merged 1 commit intomainfrom
timtebeek/fix-ci-failures

Conversation

@timtebeek
Copy link
Copy Markdown
Member

@timtebeek timtebeek commented Feb 19, 2026

Summary

  • Fixes CI failures in 4 Kotlin test files caused by the K2 compiler upgrade (Upgrade rewrite-kotlin to Kotlin 2 compiler (K2) rewrite#6766). The new KotlinParser.Builder.classpathFromResources() strips version suffixes with regex -\d+$ but version patterns with .+ (e.g., "spring-beans-5.+") don't match the regex and fail to resolve on the runtime classpath.

Changes

Removes .+ suffixes from KotlinParser classpath version patterns:

  • NoAutowiredOnConstructorTest: "spring-beans-5.+""spring-beans-5", etc. (4 names)
  • ImplicitWebAnnotationNamesTest: "spring-web-5.+""spring-web-5"
  • DatabaseComponentAndBeanInitializationOrderingTest: 4 version patterns updated
  • SimplifyWebTestClientCallsTest: "spring-web-6.+", "spring-test-6.+" → remove .+

JavaParser calls remain unchanged (still use dependenciesFromResources).

Test Plan

Run the previously failing Kotlin tests:

  • ./gradlew test --tests "NoAutowiredOnConstructorTest"
  • ./gradlew test --tests "ImplicitWebAnnotationNamesTest"
  • ./gradlew test --tests "DatabaseComponentAndBeanInitializationOrderingTest"
  • ./gradlew test --tests "SimplifyWebTestClientCallsTest.replaceKotlinInt"

Remove .+ version suffixes from KotlinParser.classpathFromResources() calls so
the K2 compiler's version stripping regex (-\d+$) can properly resolve JAR files.
Affects 4 test files with Kotlin parser configuration.
@github-project-automation github-project-automation Bot moved this to In Progress in OpenRewrite Feb 19, 2026
@timtebeek timtebeek merged commit 16a5dfc into main Feb 19, 2026
1 check failed
@timtebeek timtebeek deleted the timtebeek/fix-ci-failures branch February 19, 2026 19:34
@github-project-automation github-project-automation Bot moved this from In Progress to Done in OpenRewrite Feb 19, 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