From 777cc357ee864346bfd1cd42ee25ea0848752c3f Mon Sep 17 00:00:00 2001 From: Ian Lynagh Date: Wed, 19 Jun 2024 12:22:53 +0100 Subject: [PATCH 1/6] Kotlin: Support 2.0.20 --- docs/codeql/reusables/supported-versions-compilers.rst | 2 +- .../diagnostics/kotlin-version-too-new/diagnostics.expected | 2 +- java/ql/lib/change-notes/2024-06-19-kotlin-2.0.20.md | 4 ++++ 3 files changed, 6 insertions(+), 2 deletions(-) create mode 100644 java/ql/lib/change-notes/2024-06-19-kotlin-2.0.20.md diff --git a/docs/codeql/reusables/supported-versions-compilers.rst b/docs/codeql/reusables/supported-versions-compilers.rst index 211189b9d745..241b2eef8766 100644 --- a/docs/codeql/reusables/supported-versions-compilers.rst +++ b/docs/codeql/reusables/supported-versions-compilers.rst @@ -20,7 +20,7 @@ Java,"Java 7 to 22 [5]_","javac (OpenJDK and Oracle JDK), Eclipse compiler for Java (ECJ) [6]_",``.java`` - Kotlin,"Kotlin 1.5.0 to 2.0.0\ *x*","kotlinc",``.kt`` + Kotlin,"Kotlin 1.5.0 to 2.0.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`` [7]_" Python [8]_,"2.7, 3.5, 3.6, 3.7, 3.8, 3.9, 3.10, 3.11, 3.12",Not applicable,``.py`` Ruby [9]_,"up to 3.3",Not applicable,"``.rb``, ``.erb``, ``.gemspec``, ``Gemfile``" diff --git a/java/ql/integration-tests/all-platforms/kotlin/diagnostics/kotlin-version-too-new/diagnostics.expected b/java/ql/integration-tests/all-platforms/kotlin/diagnostics/kotlin-version-too-new/diagnostics.expected index 3cb70963c893..4f7b421d600c 100644 --- a/java/ql/integration-tests/all-platforms/kotlin/diagnostics/kotlin-version-too-new/diagnostics.expected +++ b/java/ql/integration-tests/all-platforms/kotlin/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.0.10.", + "markdownMessage": "The Kotlin version installed (`999.999.999`) is too recent for this version of CodeQL. Install a version lower than 2.0.30.", "severity": "error", "source": { "extractorName": "java", diff --git a/java/ql/lib/change-notes/2024-06-19-kotlin-2.0.20.md b/java/ql/lib/change-notes/2024-06-19-kotlin-2.0.20.md new file mode 100644 index 000000000000..f9023051191b --- /dev/null +++ b/java/ql/lib/change-notes/2024-06-19-kotlin-2.0.20.md @@ -0,0 +1,4 @@ +--- +category: feature +--- +* Kotlin versions up to 2.0.2\ *x* are now supported. From eb0bcdd9b262773706fff4d84260dbd4e76fa178 Mon Sep 17 00:00:00 2001 From: Ian Lynagh Date: Thu, 20 Jun 2024 12:59:20 +0100 Subject: [PATCH 2/6] Kotlin: Add 2.0.20-Beta1 deps --- java/kotlin-extractor/deps/kotlin-compiler-2.0.20-Beta1.jar | 3 +++ .../deps/kotlin-compiler-embeddable-2.0.20-Beta1.jar | 3 +++ java/kotlin-extractor/deps/kotlin-stdlib-2.0.20-Beta1.jar | 3 +++ 3 files changed, 9 insertions(+) create mode 100644 java/kotlin-extractor/deps/kotlin-compiler-2.0.20-Beta1.jar create mode 100644 java/kotlin-extractor/deps/kotlin-compiler-embeddable-2.0.20-Beta1.jar create mode 100644 java/kotlin-extractor/deps/kotlin-stdlib-2.0.20-Beta1.jar diff --git a/java/kotlin-extractor/deps/kotlin-compiler-2.0.20-Beta1.jar b/java/kotlin-extractor/deps/kotlin-compiler-2.0.20-Beta1.jar new file mode 100644 index 000000000000..b802ca730cf4 --- /dev/null +++ b/java/kotlin-extractor/deps/kotlin-compiler-2.0.20-Beta1.jar @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:521ba5c99d835f56a5f5554613159ca137532612c851e660b3f9cf22386e9e9d +size 58570910 diff --git a/java/kotlin-extractor/deps/kotlin-compiler-embeddable-2.0.20-Beta1.jar b/java/kotlin-extractor/deps/kotlin-compiler-embeddable-2.0.20-Beta1.jar new file mode 100644 index 000000000000..05e92a5e6fc9 --- /dev/null +++ b/java/kotlin-extractor/deps/kotlin-compiler-embeddable-2.0.20-Beta1.jar @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:c48f3b04192eba4c9cd47ae70a9b742aecec043592ad9b813d778f8f39b49b2d +size 57093064 diff --git a/java/kotlin-extractor/deps/kotlin-stdlib-2.0.20-Beta1.jar b/java/kotlin-extractor/deps/kotlin-stdlib-2.0.20-Beta1.jar new file mode 100644 index 000000000000..bf6308a4b9ca --- /dev/null +++ b/java/kotlin-extractor/deps/kotlin-stdlib-2.0.20-Beta1.jar @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:f9abb8fa51ef4d3092d9e1eb95898c600187804ad3fd726098a964c38e044a92 +size 1731715 From 64ebfc629791f2c8f500c6842dc1a39f292067da Mon Sep 17 00:00:00 2001 From: Ian Lynagh Date: Thu, 20 Jun 2024 13:15:51 +0100 Subject: [PATCH 3/6] Kotlin: Add 2.0.20-Beta1 --- MODULE.bazel | 3 +++ java/kotlin-extractor/versions.bzl | 1 + 2 files changed, 4 insertions(+) diff --git a/MODULE.bazel b/MODULE.bazel index b0957b89a75c..39f221d8fef4 100644 --- a/MODULE.bazel +++ b/MODULE.bazel @@ -112,6 +112,7 @@ use_repo( "kotlin-compiler-1.9.0-Beta", "kotlin-compiler-1.9.20-Beta", "kotlin-compiler-2.0.0-RC1", + "kotlin-compiler-2.0.20-Beta1", "kotlin-compiler-embeddable-1.5.0", "kotlin-compiler-embeddable-1.5.10", "kotlin-compiler-embeddable-1.5.20", @@ -124,6 +125,7 @@ use_repo( "kotlin-compiler-embeddable-1.9.0-Beta", "kotlin-compiler-embeddable-1.9.20-Beta", "kotlin-compiler-embeddable-2.0.0-RC1", + "kotlin-compiler-embeddable-2.0.20-Beta1", "kotlin-stdlib-1.5.0", "kotlin-stdlib-1.5.10", "kotlin-stdlib-1.5.20", @@ -136,6 +138,7 @@ use_repo( "kotlin-stdlib-1.9.0-Beta", "kotlin-stdlib-1.9.20-Beta", "kotlin-stdlib-2.0.0-RC1", + "kotlin-stdlib-2.0.20-Beta1", ) go_sdk = use_extension("@rules_go//go:extensions.bzl", "go_sdk") diff --git a/java/kotlin-extractor/versions.bzl b/java/kotlin-extractor/versions.bzl index 728672ead6de..ee20c7bbf60f 100644 --- a/java/kotlin-extractor/versions.bzl +++ b/java/kotlin-extractor/versions.bzl @@ -12,6 +12,7 @@ VERSIONS = [ "1.9.0-Beta", "1.9.20-Beta", "2.0.0-RC1", + "2.0.20-Beta1", ] def _version_to_tuple(v): From adaeb019065fa9daa9a5432ac3b7cf616004b2da Mon Sep 17 00:00:00 2001 From: Ian Lynagh Date: Thu, 11 Jul 2024 15:30:33 +0100 Subject: [PATCH 4/6] Kotlin: Update deps to 2.0.20-Beta2 --- java/kotlin-extractor/deps/kotlin-compiler-2.0.20-Beta1.jar | 3 --- java/kotlin-extractor/deps/kotlin-compiler-2.0.20-Beta2.jar | 3 +++ .../deps/kotlin-compiler-embeddable-2.0.20-Beta1.jar | 3 --- .../deps/kotlin-compiler-embeddable-2.0.20-Beta2.jar | 3 +++ java/kotlin-extractor/deps/kotlin-stdlib-2.0.20-Beta1.jar | 3 --- java/kotlin-extractor/deps/kotlin-stdlib-2.0.20-Beta2.jar | 3 +++ 6 files changed, 9 insertions(+), 9 deletions(-) delete mode 100644 java/kotlin-extractor/deps/kotlin-compiler-2.0.20-Beta1.jar create mode 100644 java/kotlin-extractor/deps/kotlin-compiler-2.0.20-Beta2.jar delete mode 100644 java/kotlin-extractor/deps/kotlin-compiler-embeddable-2.0.20-Beta1.jar create mode 100644 java/kotlin-extractor/deps/kotlin-compiler-embeddable-2.0.20-Beta2.jar delete mode 100644 java/kotlin-extractor/deps/kotlin-stdlib-2.0.20-Beta1.jar create mode 100644 java/kotlin-extractor/deps/kotlin-stdlib-2.0.20-Beta2.jar diff --git a/java/kotlin-extractor/deps/kotlin-compiler-2.0.20-Beta1.jar b/java/kotlin-extractor/deps/kotlin-compiler-2.0.20-Beta1.jar deleted file mode 100644 index b802ca730cf4..000000000000 --- a/java/kotlin-extractor/deps/kotlin-compiler-2.0.20-Beta1.jar +++ /dev/null @@ -1,3 +0,0 @@ -version https://git-lfs.github.com/spec/v1 -oid sha256:521ba5c99d835f56a5f5554613159ca137532612c851e660b3f9cf22386e9e9d -size 58570910 diff --git a/java/kotlin-extractor/deps/kotlin-compiler-2.0.20-Beta2.jar b/java/kotlin-extractor/deps/kotlin-compiler-2.0.20-Beta2.jar new file mode 100644 index 000000000000..b9007eae8eba --- /dev/null +++ b/java/kotlin-extractor/deps/kotlin-compiler-2.0.20-Beta2.jar @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:b5cdb8728892eee348f52dbd00eeeffffe8f39a7ec48ceac496dab5f41554915 +size 59652360 diff --git a/java/kotlin-extractor/deps/kotlin-compiler-embeddable-2.0.20-Beta1.jar b/java/kotlin-extractor/deps/kotlin-compiler-embeddable-2.0.20-Beta1.jar deleted file mode 100644 index 05e92a5e6fc9..000000000000 --- a/java/kotlin-extractor/deps/kotlin-compiler-embeddable-2.0.20-Beta1.jar +++ /dev/null @@ -1,3 +0,0 @@ -version https://git-lfs.github.com/spec/v1 -oid sha256:c48f3b04192eba4c9cd47ae70a9b742aecec043592ad9b813d778f8f39b49b2d -size 57093064 diff --git a/java/kotlin-extractor/deps/kotlin-compiler-embeddable-2.0.20-Beta2.jar b/java/kotlin-extractor/deps/kotlin-compiler-embeddable-2.0.20-Beta2.jar new file mode 100644 index 000000000000..6db5b51d04ae --- /dev/null +++ b/java/kotlin-extractor/deps/kotlin-compiler-embeddable-2.0.20-Beta2.jar @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:bd05f9081cd85a73d804a1b355356ad433c8bba64388ef51d76e09fdbc4098b4 +size 58218956 diff --git a/java/kotlin-extractor/deps/kotlin-stdlib-2.0.20-Beta1.jar b/java/kotlin-extractor/deps/kotlin-stdlib-2.0.20-Beta1.jar deleted file mode 100644 index bf6308a4b9ca..000000000000 --- a/java/kotlin-extractor/deps/kotlin-stdlib-2.0.20-Beta1.jar +++ /dev/null @@ -1,3 +0,0 @@ -version https://git-lfs.github.com/spec/v1 -oid sha256:f9abb8fa51ef4d3092d9e1eb95898c600187804ad3fd726098a964c38e044a92 -size 1731715 diff --git a/java/kotlin-extractor/deps/kotlin-stdlib-2.0.20-Beta2.jar b/java/kotlin-extractor/deps/kotlin-stdlib-2.0.20-Beta2.jar new file mode 100644 index 000000000000..d4b4b56d460a --- /dev/null +++ b/java/kotlin-extractor/deps/kotlin-stdlib-2.0.20-Beta2.jar @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:ac59c5888b44b7f392628df7f1adba5d987f022071cfdec8826115a25069cd88 +size 1746790 From 06cc74f3aa38eac0d86e63ac3857ea210cd868ba Mon Sep 17 00:00:00 2001 From: Ian Lynagh Date: Thu, 11 Jul 2024 15:34:37 +0100 Subject: [PATCH 5/6] Kotlin: Switch from 2.0.20-Beta1 to -Beta2 --- MODULE.bazel | 6 +++--- java/kotlin-extractor/versions.bzl | 2 +- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/MODULE.bazel b/MODULE.bazel index 39f221d8fef4..decb3d6b4e1d 100644 --- a/MODULE.bazel +++ b/MODULE.bazel @@ -112,7 +112,7 @@ use_repo( "kotlin-compiler-1.9.0-Beta", "kotlin-compiler-1.9.20-Beta", "kotlin-compiler-2.0.0-RC1", - "kotlin-compiler-2.0.20-Beta1", + "kotlin-compiler-2.0.20-Beta2", "kotlin-compiler-embeddable-1.5.0", "kotlin-compiler-embeddable-1.5.10", "kotlin-compiler-embeddable-1.5.20", @@ -125,7 +125,7 @@ use_repo( "kotlin-compiler-embeddable-1.9.0-Beta", "kotlin-compiler-embeddable-1.9.20-Beta", "kotlin-compiler-embeddable-2.0.0-RC1", - "kotlin-compiler-embeddable-2.0.20-Beta1", + "kotlin-compiler-embeddable-2.0.20-Beta2", "kotlin-stdlib-1.5.0", "kotlin-stdlib-1.5.10", "kotlin-stdlib-1.5.20", @@ -138,7 +138,7 @@ use_repo( "kotlin-stdlib-1.9.0-Beta", "kotlin-stdlib-1.9.20-Beta", "kotlin-stdlib-2.0.0-RC1", - "kotlin-stdlib-2.0.20-Beta1", + "kotlin-stdlib-2.0.20-Beta2", ) go_sdk = use_extension("@rules_go//go:extensions.bzl", "go_sdk") diff --git a/java/kotlin-extractor/versions.bzl b/java/kotlin-extractor/versions.bzl index ee20c7bbf60f..e124d6e150a7 100644 --- a/java/kotlin-extractor/versions.bzl +++ b/java/kotlin-extractor/versions.bzl @@ -12,7 +12,7 @@ VERSIONS = [ "1.9.0-Beta", "1.9.20-Beta", "2.0.0-RC1", - "2.0.20-Beta1", + "2.0.20-Beta2", ] def _version_to_tuple(v): From 91dd99d7a637de1f897c86ee2f40a3ca99900f02 Mon Sep 17 00:00:00 2001 From: Ian Lynagh Date: Thu, 11 Jul 2024 16:06:11 +0100 Subject: [PATCH 6/6] Kotlin: Fixes for 2.0.20-Beta2 --- java/kotlin-extractor/src/main/kotlin/KotlinUsesExtractor.kt | 2 ++ .../kotlin/utils/versions/v_2_0_20-Beta2/getKotlinType.kt | 5 +++++ 2 files changed, 7 insertions(+) create mode 100644 java/kotlin-extractor/src/main/kotlin/utils/versions/v_2_0_20-Beta2/getKotlinType.kt diff --git a/java/kotlin-extractor/src/main/kotlin/KotlinUsesExtractor.kt b/java/kotlin-extractor/src/main/kotlin/KotlinUsesExtractor.kt index 10df392f8b12..3be94d65690f 100644 --- a/java/kotlin-extractor/src/main/kotlin/KotlinUsesExtractor.kt +++ b/java/kotlin-extractor/src/main/kotlin/KotlinUsesExtractor.kt @@ -1511,6 +1511,8 @@ open class KotlinUsesExtractor( } } } + is IrDynamicType -> {} + is IrErrorType -> {} } return t } diff --git a/java/kotlin-extractor/src/main/kotlin/utils/versions/v_2_0_20-Beta2/getKotlinType.kt b/java/kotlin-extractor/src/main/kotlin/utils/versions/v_2_0_20-Beta2/getKotlinType.kt new file mode 100644 index 000000000000..37fb2a700410 --- /dev/null +++ b/java/kotlin-extractor/src/main/kotlin/utils/versions/v_2_0_20-Beta2/getKotlinType.kt @@ -0,0 +1,5 @@ +package com.github.codeql.utils.versions + +import org.jetbrains.kotlin.ir.types.IrSimpleType + +fun getKotlinType(s: IrSimpleType) = s.originalKotlinType