Skip to content

Kotlin: support 2.4.20 - #22404

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

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

Conversation

@andersfugmann

@andersfugmann andersfugmann commented Aug 21, 2026

Copy link
Copy Markdown
Contributor

Summary

Add support for Kotlin 2.4.20 in the Kotlin extractor.

The release removes the remaining ComponentRegistrar API and requires an explicit opt-in for deprecated K1 compiler APIs. It also changes compiler-generated IR used by interface forwarders and repeatable annotations. The extractor adapts to these changes while preserving compatibility with Kotlin 1.8.0 and later supported versions.

Changes

Change Motivation
Add standalone, embeddable, and standard-library 2.4.20 artefacts Build and run the extractor against the published Kotlin 2.4.20 compiler.
Add a 2.4.20-specific CompilerPluginRegistrar implementation ComponentRegistrar is absent from Kotlin 2.4.20, as described in https://youtrack.jetbrains.com/issue/KT-85816.
Package the legacy ComponentRegistrar service only before 2.4.20 Older compilers still require the service, while Kotlin 2.4.20 cannot load its removed API.
Opt in to org.jetbrains.kotlin.K1Deprecation from 2.4.20 The extractor still uses K1 compatibility APIs. Kotlin 2.4.20 requires the opt-in described in https://youtrack.jetbrains.com/issue/KT-86046.
Reuse the annotationClass compatibility extension Kotlin 2.4.20 rejects the previous IR parent access. The compatibility extension also compiles with Kotlin 1.8.0.
Assign generated interface forwarders the enclosing class location Kotlin 2.4.20 reports synthetic offsets for these declarations. Using the enclosing class preserves their previous observable location.
Make 2.4.20 the development and Kotlin 2 test default Exercise the latest supported compiler in normal development and tests.
Update the support documentation and change note Document Kotlin 2.4.20 as fully supported.

Compatibility

  • Compiler variants before 2.4.20 retain their existing registrar and service packaging.
  • The K1 opt-in changes compilation only.
  • Repeatable annotation extraction uses the existing cross-version compatibility path.
  • Generated interface forwarders retain their previous observable locations.

Validation

  • Built the standalone and embeddable Kotlin 2.4.20 extractor variants with JDK 17.
  • Built the full Java CodeQL distribution with all Kotlin extractor variants.
  • Ran the interface-forwarder, repeatable-annotation, and future-version diagnostic integration tests sequentially against kotlinc 2.4.20.
  • All 3 integration tests and their 4 nested QL tests passed.

No tests are disabled. The only changed generated expectation is the future-version diagnostic.

@andersfugmann
andersfugmann force-pushed the andersfugmann/kotlin-2.4.20rc branch 8 times, most recently 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
@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.

@jketema jketema 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.

First round of comments. There is an RC3 btw.

Comment thread docs/codeql/reusables/supported-versions-compilers.rst Outdated
Comment thread java/kotlin-extractor/src/main/kotlin/KotlinFileExtractor.kt
@andersfugmann

andersfugmann commented Sep 3, 2026

Copy link
Copy Markdown
Contributor Author

First round of comments. There is an RC3 btw.

I will address the other comments first and then push an update to move support to RC3.

@andersfugmann
andersfugmann force-pushed the andersfugmann/kotlin-2.4.20rc branch from a07ec7b to 00bb879 Compare September 3, 2026 14:41
@andersfugmann andersfugmann changed the title Kotlin: support 2.4.20-RC2 Kotlin: support 2.4.20-RC3 Sep 3, 2026

@jketema jketema 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.

One remaining question, otherwise this LGTM.

metaAnnotations.find {
it.symbol.owner.parentAsClass.fqNameWhenAvailable ==
JvmAnnotationNames.REPEATABLE_ANNOTATION
it.annotationClass.fqNameWhenAvailable == JvmAnnotationNames.REPEATABLE_ANNOTATION

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.

Why does this work with earlier Kotlin versions?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

annotationClass resolves the class though symbol.owner.constructedClass, which is available for all Kotlin versions, and is already (prior to this PR) used in groupRepeatableAnnotations.

symbol.owner.constructedClass and parentAsClass are for an  IrConstructor semantically equivalent. constructor.constructedClass is implemented as constructor.parent as IrClass. parentAsClass  also reads parent and requires it to be an IrClass. The only difference is the exception produces if its not an IrClass

Copilot has scanned all the supported versions (>= 1.8.0) to verify that its supported:

I checked every compiler variant supported by this extractor, from Kotlin 1.8.0 through 2.4.20-RC3.  constructedClass  has the same implementation in all of them. This is safe for our supported versions because an  IrConstructor  is expected to be parented by the class it constructs

@andersfugmann
andersfugmann force-pushed the andersfugmann/kotlin-2.4.20rc branch from 00bb879 to e7e97c4 Compare September 4, 2026 08:24
jketema
jketema previously approved these changes Sep 4, 2026

@jketema jketema 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.

Approving the current version. I assume this will still need to be rebase/updated a few times, but let's hope the extractor fixes will be stable.

@andersfugmann
andersfugmann force-pushed the andersfugmann/kotlin-2.4.20rc branch from e7e97c4 to a123d89 Compare September 7, 2026 06:58
andersfugmann and others added 11 commits September 7, 2026 13:26
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>
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>
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 a123d89 to 8b72dd3 Compare September 7, 2026 11:27
thoser666 added a commit to thoser666/Vivid that referenced this pull request Sep 7, 2026
Der 2.4.20-Versuch (e5cd592) brach den CodeQL-Workflow: Der Kotlin-
Extractor meldet "Kotlin version 2.4.20 is too recent" (nur RC2 ist
supported, GA bewusst blockiert — Tracking github/codeql#22404).
Revert auf 2.4.10 (letzte CodeQL-kompatible Version). RELEASE.md-
Sektion auf 🚧 Blockiert mit Blocker-Doku umgeschrieben, PARITY-Eintrag
korrigiert. Alert #63 bleibt dismissed bis codeql#22404 gemerged ist.

🤖 Generated with Codebuff
Co-Authored-By: Codebuff <noreply@codebuff.com>
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
@andersfugmann andersfugmann changed the title Kotlin: support 2.4.20-RC3 Kotlin: support 2.4.20 Sep 7, 2026
thoser666 added a commit to thoser666/Vivid that referenced this pull request Sep 7, 2026
…odeQL Kotlin guard

- BotCommandsCatalog (feature-chat) drives HELP_TEXT and the in-app help
  screen; BotCommandsCatalogTest proves every primary+alias resolves in
  dispatch(), HelpScreen Robolectric test enforces per-command descriptions
  (new help_cmd_* strings for !fix/!filter/!boost/!battery/!lut/!colorspace/
  !poll/!vote/!pollend/!prev/!play in DE/EN/FR)
- sync_wiki.sh now generates Home + User-Guide-EN + User-Guide-FR mirrors
  with per-language links; offline self-test (6 cases) wired into pre-push
  gate and CI
- new weekly automation-codeql-kotlin.yml watches github/codeql#22404 and
  comments on issue #110 once Kotlin 2.4.20 GA support lands (exit-code
  contract, offline fixture self-test)
- regenerate fdroidserver-requirements.txt closure (pre-existing drift)
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.

3 participants