From 497d48bd638ea26663cdfbafdfceb25c7def5dbd Mon Sep 17 00:00:00 2001 From: Ian Lynagh Date: Fri, 22 Sep 2023 17:43:57 +0100 Subject: [PATCH] Kotlin: Claim to support Kotlin 2 We don't fully support it yet, but if we don't claim to support it then Kotlin fails early. --- .../kotlin/KotlinExtractorComponentRegistrar.kt | 4 ++-- .../versions/v_1_4_32/Kotlin2ComponentRegistrar.kt | 12 ++++++++++++ .../v_1_9_0-Beta/Kotlin2ComponentRegistrar.kt | 13 +++++++++++++ 3 files changed, 27 insertions(+), 2 deletions(-) create mode 100644 java/kotlin-extractor/src/main/kotlin/utils/versions/v_1_4_32/Kotlin2ComponentRegistrar.kt create mode 100644 java/kotlin-extractor/src/main/kotlin/utils/versions/v_1_9_0-Beta/Kotlin2ComponentRegistrar.kt diff --git a/java/kotlin-extractor/src/main/kotlin/KotlinExtractorComponentRegistrar.kt b/java/kotlin-extractor/src/main/kotlin/KotlinExtractorComponentRegistrar.kt index f2f22390eb3..8fa8eef621e 100644 --- a/java/kotlin-extractor/src/main/kotlin/KotlinExtractorComponentRegistrar.kt +++ b/java/kotlin-extractor/src/main/kotlin/KotlinExtractorComponentRegistrar.kt @@ -8,9 +8,9 @@ import org.jetbrains.kotlin.compiler.plugin.ExperimentalCompilerApi import com.intellij.mock.MockProject import org.jetbrains.kotlin.compiler.plugin.ComponentRegistrar import org.jetbrains.kotlin.config.CompilerConfiguration +import com.github.codeql.Kotlin2ComponentRegistrar -@OptIn(ExperimentalCompilerApi::class) -class KotlinExtractorComponentRegistrar : ComponentRegistrar { +class KotlinExtractorComponentRegistrar : Kotlin2ComponentRegistrar() { override fun registerProjectComponents( project: MockProject, configuration: CompilerConfiguration diff --git a/java/kotlin-extractor/src/main/kotlin/utils/versions/v_1_4_32/Kotlin2ComponentRegistrar.kt b/java/kotlin-extractor/src/main/kotlin/utils/versions/v_1_4_32/Kotlin2ComponentRegistrar.kt new file mode 100644 index 00000000000..0e16ec01d5c --- /dev/null +++ b/java/kotlin-extractor/src/main/kotlin/utils/versions/v_1_4_32/Kotlin2ComponentRegistrar.kt @@ -0,0 +1,12 @@ +// For ComponentRegistrar +@file:Suppress("DEPRECATION") + +package com.github.codeql + +import org.jetbrains.kotlin.compiler.plugin.ExperimentalCompilerApi +import org.jetbrains.kotlin.compiler.plugin.ComponentRegistrar + +@OptIn(ExperimentalCompilerApi::class) +abstract class Kotlin2ComponentRegistrar : ComponentRegistrar { + /* Nothing to do; supportsK2 doesn't exist yet. */ +} diff --git a/java/kotlin-extractor/src/main/kotlin/utils/versions/v_1_9_0-Beta/Kotlin2ComponentRegistrar.kt b/java/kotlin-extractor/src/main/kotlin/utils/versions/v_1_9_0-Beta/Kotlin2ComponentRegistrar.kt new file mode 100644 index 00000000000..eddb6b53fb6 --- /dev/null +++ b/java/kotlin-extractor/src/main/kotlin/utils/versions/v_1_9_0-Beta/Kotlin2ComponentRegistrar.kt @@ -0,0 +1,13 @@ +// For ComponentRegistrar +@file:Suppress("DEPRECATION") + +package com.github.codeql + +import org.jetbrains.kotlin.compiler.plugin.ExperimentalCompilerApi +import org.jetbrains.kotlin.compiler.plugin.ComponentRegistrar + +@OptIn(ExperimentalCompilerApi::class) +abstract class Kotlin2ComponentRegistrar : ComponentRegistrar { + override val supportsK2: Boolean + get() = true +}