Skip to content

Kotlin: Add support for 2.5.0 - #23328

Merged
igfoo merged 7 commits into
mainfrom
igfoo/kotlin-2.5.0
Dec 4, 2026
Merged

igfoo merged 7 commits into
mainfrom
igfoo/kotlin-2.5.0

Conversation

@igfoo

@igfoo igfoo commented Dec 2, 2026

Copy link
Copy Markdown
Contributor

No description provided.

@igfoo
igfoo requested review from a team as code owners December 2, 2026 13:20
Copilot AI adaptive review requested due to automatic review settings December 2, 2026 13:20

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.

🟡 Changes recommended

The generated diagnostic expectation was edited directly instead of updating the inline test source and regenerating it, making the test change vulnerable to being overwritten.

1 open issue
What changed in this PR

Adds Kotlin 2.5.0 support using the 2.5.0-RC2 compiler baseline.

Changes:

  • Registers Kotlin 2.5.0-RC2 dependencies and extractor version.
  • Adds compatibility implementations for changed Kotlin compiler APIs.
  • Updates diagnostics, documentation, change notes, and vendored artifacts.
File Description
MODULE.bazel Registers Kotlin 2.5.0-RC2 dependencies.
java/​ql/​lib/​change-notes/​2026-11-30-kotlin-2.5.0.md Documents Kotlin 2.5.0 support.
java/​ql/​integration-tests/​kotlin/​all-platforms/​diagnostics/​kotlin-version-too-new/​diagnostics.expected Updates the supported-version diagnostic expectation.
java/​kotlin-extractor/​versions.bzl Adds the Kotlin 2.5.0-RC2 compiler baseline.
java/​kotlin-extractor/​src/​main/​kotlin/​utils/​versions/​v_2_5_0-RC2/​getCurrentJvmModuleName.kt Provides Kotlin 2.5-compatible JVM module-name resolution.
java/​kotlin-extractor/​src/​main/​kotlin/​utils/​versions/​v_2_5_0-RC2/​createExternalPackageFragment.kt Provides Kotlin 2.5-compatible external package-fragment creation.
java/​kotlin-extractor/​src/​main/​kotlin/​utils/​versions/​v_1_8_0/​getCurrentJvmModuleName.kt Defines baseline JVM module-name resolution compatibility.
java/​kotlin-extractor/​src/​main/​kotlin/​utils/​versions/​v_1_8_0/​createExternalPackageFragment.kt Defines baseline external package-fragment creation compatibility.
java/​kotlin-extractor/​src/​main/​kotlin/​utils/​TypeSubstitution.kt Uses version-aware external package-fragment creation.
java/​kotlin-extractor/​src/​main/​kotlin/​KotlinUsesExtractor.kt Uses version-aware JVM module-name resolution.
java/​kotlin-extractor/​src/​main/​kotlin/​KotlinExtractorExtension.kt Passes module context through extractor state and refactors trap comparison.
java/​kotlin-extractor/​deps/​kotlin-stdlib-2.5.0-RC2.jar Adds the Kotlin 2.5.0-RC2 standard library artifact.
java/​kotlin-extractor/​deps/​kotlin-compiler-embeddable-2.5.0-RC2.jar Adds the Kotlin 2.5.0-RC2 embeddable compiler artifact.
java/​kotlin-extractor/​deps/​kotlin-compiler-2.5.0-RC2.jar Adds the Kotlin 2.5.0-RC2 compiler artifact.
docs/​codeql/​reusables/​supported-versions-compilers.rst Updates the documented Kotlin compiler support.

Review effort: Lite (adaptive)

@@ -1,5 +1,5 @@
{
"markdownMessage": "The Kotlin version installed (`999.999.999`) is too recent for this version of CodeQL. Install a version lower than 2.4.30.",
"markdownMessage": "The Kotlin version installed (`999.999.999`) is too recent for this version of CodeQL. Install a version lower than 2.5.10.",
RevoltOfTheAtoms pushed a commit to RevoltOfTheAtoms/tend that referenced this pull request Dec 2, 2026
CodeQL stops with "Kotlin version 2.5.0 is too recent" and has no
override, so every run failed. The workflow is disabled in the repository
settings and its badge is off the README. RELEASING.md tracks
github/codeql#23328 and says how to turn it back on.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@jketema

jketema commented Dec 4, 2026

Copy link
Copy Markdown
Contributor

Can we update this to the released version instead of RC2?

@igfoo
igfoo force-pushed the igfoo/kotlin-2.5.0 branch from 2a4d37b to 3ccfb04 Compare December 4, 2026 13:45
Comment thread MODULE.bazel Outdated
"kotlin-compiler-2.3.20",
"kotlin-compiler-2.4.0",
"kotlin-compiler-2.4.20",
"kotlin-compiler-2.5.0-RC2",

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.

These seem out-of-sync now

igfoo and others added 5 commits December 4, 2026 13:49
This means the first build when adding support for a new version
actually gets as far as giving a useful error message.
The Kotlin 2.5 compiler no longer accepts an endless `while (true)` loop,
nested inside inline `use { }` lambdas, as the end of a function returning
Boolean, and reports "missing return statement". Move the line comparison
loop into a helper, equivalentTrapLines, so that it is the function body
itself. Behaviour is unchanged, and this compiles with all supported
Kotlin versions.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Copilot-Session: 38400d2f-9060-4b63-8536-73ce77bb5c91
Kotlin 2.5 removed `JvmCodegenUtil` and `IrPluginContext.moduleDescriptor`,
and `IrExternalPackageFragmentImpl` now needs an `IrModuleFragment`.

Add two compatibility functions, with the previous behaviour in v_1_8_0 and
the new one in v_2_5_0:

- getCurrentJvmModuleName, used by KotlinUsesExtractor.getJvmModuleName
  for the name of the module being compiled. For 2.5 it applies the old
  JvmCodegenUtil.getModuleName logic to the module fragment's descriptor.
  KotlinExtractorGlobalState now holds the module fragment to support this.
- createExternalPackageFragment, used to make the synthetic
  `kotlin.internal.ir` package for RawTypeAnnotation. For 2.5 it passes
  IrErrorModuleFragment, as the compiler's own
  JvmIrSpecialAnnotationSymbolProvider does.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Copilot-Session: 38400d2f-9060-4b63-8536-73ce77bb5c91

X
@igfoo
igfoo force-pushed the igfoo/kotlin-2.5.0 branch from 3ccfb04 to fa797aa Compare December 4, 2026 13:49

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

LGTM

@igfoo
igfoo merged commit 2445840 into main Dec 4, 2026
92 of 100 checks passed
@igfoo
igfoo deleted the igfoo/kotlin-2.5.0 branch December 4, 2026 15:50
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