Skip to content

Align ASM and Kotlin stdlib versions across modules#7474

Merged
knutwannheden merged 2 commits intomainfrom
consolidate-rewrite-classpath-partitions
Apr 27, 2026
Merged

Align ASM and Kotlin stdlib versions across modules#7474
knutwannheden merged 2 commits intomainfrom
consolidate-rewrite-classpath-partitions

Conversation

@knutwannheden
Copy link
Copy Markdown
Contributor

Motivation

The classpath partition cache at ~/.rewrite/classpath/.partitions/ keys by exact GAV, so each distinct resolved version of an artifact produces its own partition file even when the underlying types are nearly identical. Surveying the cache showed several artifacts with multiple resolved versions purely from accidental drift in this multi-module build (no intentional cross-version testing). Two patterns drove most of the drift:

  1. ASM artifacts split between 9.3 and 9.9.1. io.quarkus.gizmo:gizmo:1.0.11.Final (declared in rewrite-core) pins asm-util/asm-tree/asm-analysis to 9.3. rewrite-java requests asm and asm-util at latest.release, but as an implementation dependency that does not propagate to project consumers. The result: :rewrite-java-21:runtimeClasspath and :rewrite-java-25:runtimeClasspath (and most non-Java modules) hold asm:9.9.1 together with asm-util/-tree/-analysis:9.3 — an inconsistent ASM stack and an extra set of cache partitions for every artifact.

  2. Kotlin stdlib family fragmented. rewrite-kotlin deliberately uses Kotlin 2.3.20, but clikt:3.5.0 drags kotlin-stdlib-jdk7/-jdk8/-common back to 1.6.20. In rewrite-gradle, mockwebserver:4.+ pulls those same artifacts at 1.9.10. In rewrite-maven, transitives bring 1.8.21 / 1.9.25. The deprecated -jdk7/-jdk8 artifacts are not aligned to kotlin-stdlib, so each module ends up with a different Kotlin minor version mix and another batch of partitions.

Verified with dependencyInsight before and after the changes.

Summary

  • Declare asm, asm-util, asm-tree, and asm-analysis at latest.release in rewrite-core (alongside the gizmo dependency that pins them). Conflict resolution then bumps all four artifacts in lockstep across every module that depends on rewrite-core.
  • Apply org.jetbrains.kotlin:kotlin-bom as a testImplementation platform dependency in rewrite-kotlin, rewrite-gradle, and rewrite-maven. The BOM constrains the whole kotlin-stdlib-* family to a single Kotlin version per test classpath.

Test plan

  • ./gradlew :rewrite-java-21:dependencyInsight --dependency org.ow2.asm:asm-util --configuration runtimeClasspath resolves to 9.9.1 (was 9.3).
  • ./gradlew :rewrite-kotlin:dependencyInsight --dependency org.jetbrains.kotlin:kotlin-stdlib-jdk7 --configuration testRuntimeClasspath resolves to 2.3.20 by BOM constraint (was 1.6.20).
  • Same check for :rewrite-gradle (was 1.9.10) and :rewrite-maven (was 1.8.21) — both now 2.3.20.
  • ./gradlew :rewrite-core:test :rewrite-kotlin:test :rewrite-gradle:test :rewrite-maven:testBUILD SUCCESSFUL.

The classpath partition cache (~/.rewrite/classpath/.partitions) keys by
exact GAV, so each distinct resolved version of an artifact produces its
own partition file. Two sources of accidental version drift across the
multi-module build were each producing duplicate partitions:

- ASM: gizmo (in rewrite-core) pins asm-util/-tree/-analysis to 9.3
  transitively. rewrite-java requests asm/asm-util at latest.release as
  `implementation`, but that does not propagate to project consumers, so
  modules consuming :rewrite-java (rewrite-java-21/-25, rewrite-yaml/json/
  etc.) keep the 9.3 transitive while still bumping `asm` itself to 9.9.1.
  Declaring all four asm artifacts at latest.release in rewrite-core (where
  gizmo lives) lets conflict resolution bump them in lockstep everywhere.

- Kotlin stdlib: rewrite-kotlin's clikt 3.5.0, rewrite-gradle's
  mockwebserver 4.x, and rewrite-maven's maven-resolver each drag the
  deprecated kotlin-stdlib-jdk7/-jdk8/-common artifacts in at older
  versions (1.6.20 / 1.9.10 / 1.8.21) that the main kotlin-stdlib does
  not align. Applying kotlin-bom as a test platform constrains the whole
  family to a single Kotlin version per module.
@knutwannheden knutwannheden force-pushed the consolidate-rewrite-classpath-partitions branch from af3c51a to bcef3ec Compare April 27, 2026 08:32
@knutwannheden knutwannheden merged commit e156df4 into main Apr 27, 2026
1 check passed
@knutwannheden knutwannheden deleted the consolidate-rewrite-classpath-partitions branch April 27, 2026 09:06
@github-project-automation github-project-automation Bot moved this from In Progress to Done in OpenRewrite Apr 27, 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