Kotlin: support 2.4.20-RC2 - #22404
Conversation
f74d5b1 to
2fa6f32
Compare
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>
2fa6f32 to
b9c81d5
Compare
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>
|
Bumped artifacts to Kotlin 2.4.20-RC2 |
There was a problem hiding this comment.
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.
Keep the branch tip separate from the merge commit so semmle-code QLDoc checks compare against the merged CodeQL tree rather than the pre-merge first parent. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
jketema
left a comment
There was a problem hiding this comment.
First round of comments. There is an RC3 btw.
|
|
||
| Eclipse compiler for Java (ECJ) [6]_",``.java`` | ||
| Kotlin,"Kotlin 1.8.0 to 2.4.1\ *x*","kotlinc",``.kt`` | ||
| Kotlin [13]_,"Kotlin 1.8.0 to 2.4.20-RC2","kotlinc",``.kt`` |
There was a problem hiding this comment.
Footnotes should be ordered. I don't think we need a footnote though, as there's nothing really preliminary about this.
| public class KotlinVersion { | ||
|
|
||
| public static String CURRENT = "999.999.999"; | ||
| public static String CURRENT = "2.4.20"; |
There was a problem hiding this comment.
I understand why you changed this, but in the long run this seems non-ideal because we'll need to keep updating the test.
| ) : Label<out DbCallable> = | ||
| forceExtractFunction( | ||
| ) : Label<out DbCallable> { | ||
| val sourceLoc = tw.getLocation(f.parentClassOrNull ?: f) |
There was a problem hiding this comment.
What breaks without the changes to this file?
| @@ -0,0 +1,32 @@ | |||
| package com.github.codeql | |||
There was a problem hiding this comment.
This file basically mimics what older compilers supplied by default somehow?
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
ComponentRegistrarusage (KT-85816) and applies@K1Deprecationto 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
v2.4.20-RC2compiler rather than an inferred compatible version.CompilerPluginRegistrarimplementationComponentRegistraris absent from the 2.4.20 compiler, matching KT-85816. The existing registrar cannot be loaded because it implements both APIs.ComponentRegistrarservice only before 2.4.20org.jetbrains.kotlin.K1Deprecationfrom 2.4.20annotationClasscompatibility extensionconstructedClassand also compiles with the oldest supported Kotlin 1.8.0 compiler.Compatibility
Validation
VERSIONSv2.4.20-RC2compiler passed the Kotlin basic functionality extraction test2.4.20GANo tests are disabled. The only changed generated expectation is the too-new diagnostic.