From ad391df03f6374541ace46a8a5eb45b37b9fe35e Mon Sep 17 00:00:00 2001 From: Ian Lynagh Date: Fri, 11 Jul 2025 12:53:42 +0100 Subject: [PATCH 1/7] Kotlin: Support 2.2.20 --- docs/codeql/reusables/supported-versions-compilers.rst | 2 +- .../diagnostics/kotlin-version-too-new/diagnostics.expected | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/docs/codeql/reusables/supported-versions-compilers.rst b/docs/codeql/reusables/supported-versions-compilers.rst index 904a60b71cbd..78641764660b 100644 --- a/docs/codeql/reusables/supported-versions-compilers.rst +++ b/docs/codeql/reusables/supported-versions-compilers.rst @@ -21,7 +21,7 @@ Java,"Java 7 to 24 [6]_","javac (OpenJDK and Oracle JDK), Eclipse compiler for Java (ECJ) [7]_",``.java`` - Kotlin,"Kotlin 1.6.0 to 2.2.0\ *x*","kotlinc",``.kt`` + Kotlin,"Kotlin 1.6.0 to 2.2.2\ *x*","kotlinc",``.kt`` JavaScript,ECMAScript 2022 or lower,Not applicable,"``.js``, ``.jsx``, ``.mjs``, ``.es``, ``.es6``, ``.htm``, ``.html``, ``.xhtm``, ``.xhtml``, ``.vue``, ``.hbs``, ``.ejs``, ``.njk``, ``.json``, ``.yaml``, ``.yml``, ``.raml``, ``.xml`` [8]_" Python [9]_,"2.7, 3.5, 3.6, 3.7, 3.8, 3.9, 3.10, 3.11, 3.12, 3.13",Not applicable,``.py`` Ruby [10]_,"up to 3.3",Not applicable,"``.rb``, ``.erb``, ``.gemspec``, ``Gemfile``" diff --git a/java/ql/integration-tests/kotlin/all-platforms/diagnostics/kotlin-version-too-new/diagnostics.expected b/java/ql/integration-tests/kotlin/all-platforms/diagnostics/kotlin-version-too-new/diagnostics.expected index 39e1f6e6b984..50cbd2609f26 100644 --- a/java/ql/integration-tests/kotlin/all-platforms/diagnostics/kotlin-version-too-new/diagnostics.expected +++ b/java/ql/integration-tests/kotlin/all-platforms/diagnostics/kotlin-version-too-new/diagnostics.expected @@ -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.2.10.", + "markdownMessage": "The Kotlin version installed (`999.999.999`) is too recent for this version of CodeQL. Install a version lower than 2.2.30.", "severity": "error", "source": { "extractorName": "java", From f148f434e198653d54d39e7c97667d7e66a78592 Mon Sep 17 00:00:00 2001 From: Ian Lynagh Date: Wed, 23 Jul 2025 11:49:38 +0100 Subject: [PATCH 2/7] Kotlin: Add a changenote for the addition of 2.2.2x support --- java/ql/lib/change-notes/2025-07-23-kotlin-2.2.20.md | 4 ++++ 1 file changed, 4 insertions(+) create mode 100644 java/ql/lib/change-notes/2025-07-23-kotlin-2.2.20.md diff --git a/java/ql/lib/change-notes/2025-07-23-kotlin-2.2.20.md b/java/ql/lib/change-notes/2025-07-23-kotlin-2.2.20.md new file mode 100644 index 000000000000..994cb1546135 --- /dev/null +++ b/java/ql/lib/change-notes/2025-07-23-kotlin-2.2.20.md @@ -0,0 +1,4 @@ +--- +category: feature +--- +* Kotlin versions up to 2.2.2\ *x* are now supported. From 965f1fc54792aceb5604bf12426a380d93295153 Mon Sep 17 00:00:00 2001 From: Ian Lynagh Date: Wed, 23 Jul 2025 11:51:45 +0100 Subject: [PATCH 3/7] Kotlin: Add 2.2.20 deps --- java/kotlin-extractor/deps/kotlin-compiler-2.2.20-Beta1.jar | 3 +++ .../deps/kotlin-compiler-embeddable-2.2.20-Beta1.jar | 3 +++ java/kotlin-extractor/deps/kotlin-stdlib-2.2.20-Beta1.jar | 3 +++ 3 files changed, 9 insertions(+) create mode 100644 java/kotlin-extractor/deps/kotlin-compiler-2.2.20-Beta1.jar create mode 100644 java/kotlin-extractor/deps/kotlin-compiler-embeddable-2.2.20-Beta1.jar create mode 100644 java/kotlin-extractor/deps/kotlin-stdlib-2.2.20-Beta1.jar diff --git a/java/kotlin-extractor/deps/kotlin-compiler-2.2.20-Beta1.jar b/java/kotlin-extractor/deps/kotlin-compiler-2.2.20-Beta1.jar new file mode 100644 index 000000000000..3c8c6d983429 --- /dev/null +++ b/java/kotlin-extractor/deps/kotlin-compiler-2.2.20-Beta1.jar @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:1a244757dd8d015ca84f60acf37b9d2a1db094e5f340137f7a193eb697a2e2ab +size 58137156 diff --git a/java/kotlin-extractor/deps/kotlin-compiler-embeddable-2.2.20-Beta1.jar b/java/kotlin-extractor/deps/kotlin-compiler-embeddable-2.2.20-Beta1.jar new file mode 100644 index 000000000000..b3cfdc383306 --- /dev/null +++ b/java/kotlin-extractor/deps/kotlin-compiler-embeddable-2.2.20-Beta1.jar @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:c537c05d90415d0c105b66910374f74cdfe513c29b4aefb0bd492bb82e0310c2 +size 56700664 diff --git a/java/kotlin-extractor/deps/kotlin-stdlib-2.2.20-Beta1.jar b/java/kotlin-extractor/deps/kotlin-stdlib-2.2.20-Beta1.jar new file mode 100644 index 000000000000..784697995223 --- /dev/null +++ b/java/kotlin-extractor/deps/kotlin-stdlib-2.2.20-Beta1.jar @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:248ffeafe6b539c0409c4781d506d15fc4b058a2ba4ebdbd65c051fe32bde9e0 +size 1760046 From 8432f6e42ecc0a96e81e1ec90ca22a364bee91d4 Mon Sep 17 00:00:00 2001 From: Ian Lynagh Date: Wed, 23 Jul 2025 11:52:48 +0100 Subject: [PATCH 4/7] Kotlin: Add 2.2.20-Beta1 version --- java/kotlin-extractor/versions.bzl | 1 + 1 file changed, 1 insertion(+) diff --git a/java/kotlin-extractor/versions.bzl b/java/kotlin-extractor/versions.bzl index e389bfd9514d..0a4dc749da11 100644 --- a/java/kotlin-extractor/versions.bzl +++ b/java/kotlin-extractor/versions.bzl @@ -12,6 +12,7 @@ VERSIONS = [ "2.1.0-Beta1", "2.1.20-Beta1", "2.2.0-Beta1", + "2.2.20-Beta1", ] def _version_to_tuple(v): From d1da041fcfd97986be3f88281dc8584ccd1f7bbe Mon Sep 17 00:00:00 2001 From: Ian Lynagh Date: Wed, 23 Jul 2025 11:53:06 +0100 Subject: [PATCH 5/7] Kotlin: Regenerate Ran "../tools/bazel mod tidy" --- MODULE.bazel | 3 +++ 1 file changed, 3 insertions(+) diff --git a/MODULE.bazel b/MODULE.bazel index 474e6df0aba8..9592f7ced402 100644 --- a/MODULE.bazel +++ b/MODULE.bazel @@ -230,6 +230,7 @@ use_repo( "kotlin-compiler-2.1.0-Beta1", "kotlin-compiler-2.1.20-Beta1", "kotlin-compiler-2.2.0-Beta1", + "kotlin-compiler-2.2.20-Beta1", "kotlin-compiler-embeddable-1.6.0", "kotlin-compiler-embeddable-1.6.20", "kotlin-compiler-embeddable-1.7.0", @@ -242,6 +243,7 @@ use_repo( "kotlin-compiler-embeddable-2.1.0-Beta1", "kotlin-compiler-embeddable-2.1.20-Beta1", "kotlin-compiler-embeddable-2.2.0-Beta1", + "kotlin-compiler-embeddable-2.2.20-Beta1", "kotlin-stdlib-1.6.0", "kotlin-stdlib-1.6.20", "kotlin-stdlib-1.7.0", @@ -254,6 +256,7 @@ use_repo( "kotlin-stdlib-2.1.0-Beta1", "kotlin-stdlib-2.1.20-Beta1", "kotlin-stdlib-2.2.0-Beta1", + "kotlin-stdlib-2.2.20-Beta1", ) go_sdk = use_extension("@rules_go//go:extensions.bzl", "go_sdk") From 709c111522ce5f1b45cbb72c29a7e95b9b1b0570 Mon Sep 17 00:00:00 2001 From: Ian Lynagh Date: Wed, 23 Jul 2025 12:40:01 +0100 Subject: [PATCH 6/7] Kotlin: Add getJvmModuleNameForDeserializedDescriptor wrapper It has been removed in 2.2.20. --- .../src/main/kotlin/KotlinUsesExtractor.kt | 1 - ...tJvmModuleNameForDeserializedDescriptor.kt | 9 ++++++ ...tJvmModuleNameForDeserializedDescriptor.kt | 32 +++++++++++++++++++ 3 files changed, 41 insertions(+), 1 deletion(-) create mode 100644 java/kotlin-extractor/src/main/kotlin/utils/versions/v_1_6_0/getJvmModuleNameForDeserializedDescriptor.kt create mode 100644 java/kotlin-extractor/src/main/kotlin/utils/versions/v_2_2_20-Beta1/getJvmModuleNameForDeserializedDescriptor.kt diff --git a/java/kotlin-extractor/src/main/kotlin/KotlinUsesExtractor.kt b/java/kotlin-extractor/src/main/kotlin/KotlinUsesExtractor.kt index 56deb81da012..2f87c77f8ee1 100644 --- a/java/kotlin-extractor/src/main/kotlin/KotlinUsesExtractor.kt +++ b/java/kotlin-extractor/src/main/kotlin/KotlinUsesExtractor.kt @@ -37,7 +37,6 @@ import org.jetbrains.kotlin.load.java.JvmAbi import org.jetbrains.kotlin.load.java.sources.JavaSourceElement import org.jetbrains.kotlin.load.java.structure.* import org.jetbrains.kotlin.load.java.typeEnhancement.hasEnhancedNullability -import org.jetbrains.kotlin.load.kotlin.getJvmModuleNameForDeserializedDescriptor import org.jetbrains.kotlin.name.FqName import org.jetbrains.kotlin.name.NameUtils import org.jetbrains.kotlin.name.SpecialNames diff --git a/java/kotlin-extractor/src/main/kotlin/utils/versions/v_1_6_0/getJvmModuleNameForDeserializedDescriptor.kt b/java/kotlin-extractor/src/main/kotlin/utils/versions/v_1_6_0/getJvmModuleNameForDeserializedDescriptor.kt new file mode 100644 index 000000000000..003be521ce0e --- /dev/null +++ b/java/kotlin-extractor/src/main/kotlin/utils/versions/v_1_6_0/getJvmModuleNameForDeserializedDescriptor.kt @@ -0,0 +1,9 @@ +package com.github.codeql.utils.versions + +import org.jetbrains.kotlin.descriptors.CallableMemberDescriptor +import org.jetbrains.kotlin.load.kotlin.getJvmModuleNameForDeserializedDescriptor + +fun getJvmModuleNameForDeserializedDescriptor(descriptor: CallableMemberDescriptor): String? { + return org.jetbrains.kotlin.load.kotlin.getJvmModuleNameForDeserializedDescriptor(descriptor) +} + diff --git a/java/kotlin-extractor/src/main/kotlin/utils/versions/v_2_2_20-Beta1/getJvmModuleNameForDeserializedDescriptor.kt b/java/kotlin-extractor/src/main/kotlin/utils/versions/v_2_2_20-Beta1/getJvmModuleNameForDeserializedDescriptor.kt new file mode 100644 index 000000000000..7a29d2dd4fc3 --- /dev/null +++ b/java/kotlin-extractor/src/main/kotlin/utils/versions/v_2_2_20-Beta1/getJvmModuleNameForDeserializedDescriptor.kt @@ -0,0 +1,32 @@ +package com.github.codeql.utils.versions + +import org.jetbrains.kotlin.descriptors.* +import org.jetbrains.kotlin.load.kotlin.JvmPackagePartSource +import org.jetbrains.kotlin.metadata.deserialization.* +import org.jetbrains.kotlin.metadata.jvm.deserialization.* +import org.jetbrains.kotlin.metadata.jvm.JvmProtoBuf +import org.jetbrains.kotlin.resolve.DescriptorUtils.* +import org.jetbrains.kotlin.serialization.deserialization.descriptors.* + +fun getJvmModuleNameForDeserializedDescriptor(descriptor: CallableMemberDescriptor): String? { + val parent = getParentOfType(descriptor, ClassOrPackageFragmentDescriptor::class.java, false) + + when { + parent is DeserializedClassDescriptor -> { + val classProto = parent.classProto + val nameResolver = parent.c.nameResolver + return classProto.getExtensionOrNull(JvmProtoBuf.classModuleName) + ?.let(nameResolver::getString) + ?: JvmProtoBufUtil.DEFAULT_MODULE_NAME + } + descriptor is DeserializedMemberDescriptor -> { + val source = descriptor.containerSource + if (source is JvmPackagePartSource) { + return source.moduleName + } + } + } + + return null +} + From 604af65b02ebc2a270a59421fea0645447d06a2a Mon Sep 17 00:00:00 2001 From: Ian Lynagh Date: Wed, 23 Jul 2025 12:50:17 +0100 Subject: [PATCH 7/7] Kotlin: Opt in to DeprecatedForRemovalCompilerApi We'll need a proper fix for this, but this will keep things working in the meantime. --- java/kotlin-extractor/BUILD.bazel | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/java/kotlin-extractor/BUILD.bazel b/java/kotlin-extractor/BUILD.bazel index 575b9788e8c5..a714e06d4111 100644 --- a/java/kotlin-extractor/BUILD.bazel +++ b/java/kotlin-extractor/BUILD.bazel @@ -83,7 +83,7 @@ kt_javac_options( "kotlin.RequiresOptIn", "org.jetbrains.kotlin.ir.symbols.%s" % ("IrSymbolInternals" if version_less(v, "2.0.0") else "UnsafeDuringIrConstructionAPI"), - ], + ] + ([] if version_less(v, "2.2.20") else ["org.jetbrains.kotlin.DeprecatedForRemovalCompilerApi"]), x_suppress_version_warnings = True, ), # * extractor.name is different for each version, so we need to put it in different output dirs pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy