Skip to content

Kotlin: support 2.4.20-RC2 - #22404

Open
andersfugmann wants to merge 8 commits into
mainfrom
andersfugmann/kotlin-2.4.20rc
Open

Kotlin: support 2.4.20-RC2#22404
andersfugmann wants to merge 8 commits into
mainfrom
andersfugmann/kotlin-2.4.20rc

Conversation

@andersfugmann

@andersfugmann andersfugmann commented Aug 21, 2026

Copy link
Copy Markdown
Contributor

Summary

Support Kotlin 2.4.20-RC2 in the Kotlin extractor. Kotlin 2.4.20 GA remains unsupported.

The implementation is split between release-driven compatibility changes and two observed RC2 behaviours. The release changelog explicitly removes remaining ComponentRegistrar usage (KT-85816) and applies @K1Deprecation to public K1 APIs (KT-86046). The RC2 compiler also gives generated interface forwarders synthetic source offsets and rejects the previous repeatable-annotation access path. The extractor adapts to those behaviours without changing query results.

Motivation for each change

Change Motivation
Add standalone, embeddable, and standard-library RC2 artefacts Build and test the extractor against the published v2.4.20-RC2 compiler rather than an inferred compatible version.
Add an 2.4.20-specific CompilerPluginRegistrar implementation ComponentRegistrar is absent from the 2.4.20 compiler, matching KT-85816. The existing registrar cannot be loaded because it implements both APIs.
Package the legacy ComponentRegistrar service only before 2.4.20 Older compilers still require the legacy service, while 2.4.20 fails if that service refers to the removed class. This keeps compatibility selection at the build boundary.
Opt in to org.jetbrains.kotlin.K1Deprecation from 2.4.20 The extractor still uses K1 compatibility APIs. KT-86046 makes the opt-in an error-level requirement in 2.4.20.
Reuse the annotationClass compatibility extension 2.4.20 rejects the previous IR parent access. The existing extension uses constructedClass and also compiles with the oldest supported Kotlin 1.8.0 compiler.
Assign fabricated interface forwarders the enclosing class location 2.4.20 reports synthetic offsets for these generated declarations. They have no direct source declaration, so the enclosing class is the stable location and preserves previous database and query output. This behaviour was observed during extraction and is not called out explicitly in the release changelog.
Make 2.4.20-RC2 the development and Kotlin 2 test default Exercise the newly supported compiler in the normal Kotlin 2 suite.
Test 2.4.20 GA in the too-new diagnostic Verify the intended RC2-only boundary directly.
Update documentation and the change note to 2.4.20-RC2 Avoid implying support for 2.4.20 GA.

Compatibility

  • Compiler variants before 2.4.20 retain their existing registrar and service packaging.
  • The K1 opt-in changes compilation only and does not change extracted data.
  • Repeatable annotation extraction uses the existing cross-version compatibility path.
  • Generated forwarders retain their previous observable locations. No fake-override, AST, expression-type, or inherited-interface-default expectations change.
  • Kotlin 2.4.20 GA and other prerelease spellings remain unsupported.

Validation

  • Built all 26 extractor variants: standalone and embeddable for every compiler version declared in VERSIONS
  • Ran ten representative tests for every supported compiler and applicable language mode: K1 for Kotlin 1.8 through 2.3, and K2 for Kotlin 2.0 through 2.4
  • Built standalone and embeddable 2.4.20-RC2 extractor variants
  • Built the oldest supported 1.8.0 extractor variant
  • Full Kotlin 2 suite passed in eight sequential shards with one test thread
  • Full Kotlin 1 suite passed with 2.3.20 in eight sequential shards with one test thread
  • All 36 Kotlin all-platform extraction tests passed in eight sequential shards
  • All 63 Kotlin all-platform QL integration tests passed in eight sequential shards
  • The published v2.4.20-RC2 compiler passed the Kotlin basic functionality extraction test
  • The too-new diagnostic test rejects 2.4.20 GA

No tests are disabled. The only changed generated expectation is the too-new diagnostic.

@andersfugmann
andersfugmann force-pushed the andersfugmann/kotlin-2.4.20rc branch 7 times, most recently from f74d5b1 to 2fa6f32 Compare August 26, 2026 10:43
andersfugmann and others added 7 commits August 26, 2026 13:24
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Kotlin 2.4.20-RC removes the remaining ComponentRegistrar API under KT-85816.

Use an RC-specific registrar that only implements CompilerPluginRegistrar, and package the legacy ComponentRegistrar service only for older compilers.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Kotlin 2.4.20-RC marks public K1 APIs with K1Deprecation under KT-86046 and rejects the previous repeatable-annotation IR access path.

Opt in to K1Deprecation for 2.4.20 and later, and use the existing annotationClass compatibility extension.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Kotlin 2.4.20-RC assigns synthetic source offsets to generated interface forwarders.

Use the enclosing class location for each fabricated forwarder and its generated body and accesses, preserving existing database and query output.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
@andersfugmann
andersfugmann force-pushed the andersfugmann/kotlin-2.4.20rc branch from 2fa6f32 to b9c81d5 Compare August 26, 2026 11:25
@andersfugmann andersfugmann self-assigned this Aug 26, 2026
@github-actions github-actions Bot added the Java label Aug 26, 2026
Replace the previous 2.4.20-RC dependency set and compatibility marker with RC2 while preserving existing extraction output.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
@andersfugmann andersfugmann changed the title Kotlin: support 2.4.20-RC Kotlin: support 2.4.20-RC2 Aug 28, 2026
@andersfugmann

Copy link
Copy Markdown
Contributor Author

Bumped artifacts to Kotlin 2.4.20-RC2

@andersfugmann
andersfugmann marked this pull request as ready for review August 28, 2026 11:42
Copilot AI balanced review requested due to automatic review settings August 28, 2026 11:42
@andersfugmann
andersfugmann requested review from a team as code owners August 28, 2026 11:42

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copilot review overview

Review tier: Balanced
Findings: None

What changed in this PR

Adds preliminary Kotlin 2.4.20-RC2 extractor support while continuing to reject Kotlin 2.4.20 GA.

Changes:

  • Adds RC2 compiler dependencies and extractor variants.
  • Adapts compiler registration, annotations, and synthetic forwarder locations.
  • Updates defaults, diagnostics, documentation, and release notes.
File Description
MODULE.bazel Registers RC2 dependency repositories.
java/​ql/​lib/​change-notes/​2026-08-21-kotlin-2.4.20.md Announces preliminary support.
java/​ql/​integration-tests/​kotlin/​all-platforms/​diagnostics/​kotlin-version-too-new/​fake-kotlinc-source/​kotlin/​KotlinVersion.java Tests the GA rejection boundary.
java/​ql/​integration-tests/​kotlin/​all-platforms/​diagnostics/​kotlin-version-too-new/​diagnostics.expected Updates the expected diagnostic.
java/​kotlin-extractor/​versions.bzl Adds the RC2 extractor version.
java/​kotlin-extractor/​src/​main/​kotlin/​utils/​versions/​v_2_4_20-RC2/​Kotlin2ComponentRegistrar.kt Implements the supported registrar API.
java/​kotlin-extractor/​src/​main/​kotlin/​MetaAnnotationSupport.kt Uses compatible annotation-class access.
java/​kotlin-extractor/​src/​main/​kotlin/​KotlinFileExtractor.kt Stabilizes generated forwarder locations.
java/​kotlin-extractor/​dev/​wrapper.py Makes RC2 the development default.
java/​kotlin-extractor/​deps/​kotlin-stdlib-2.4.20-RC2.jar Adds the RC2 standard library artifact.
java/​kotlin-extractor/​deps/​kotlin-compiler-embeddable-2.4.20-RC2.jar Adds the embeddable compiler artifact.
java/​kotlin-extractor/​deps/​kotlin-compiler-2.4.20-RC2.jar Adds the standalone compiler artifact.
java/​kotlin-extractor/​BUILD.bazel Configures version-specific APIs and services.
docs/​codeql/​reusables/​supported-versions-compilers.rst Documents preliminary RC2 support.

💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants