diff --git a/java/kotlin-extractor/kotlin_plugin_versions.py b/java/kotlin-extractor/kotlin_plugin_versions.py index d385eb9e6137..9dd7b766c7f6 100755 --- a/java/kotlin-extractor/kotlin_plugin_versions.py +++ b/java/kotlin-extractor/kotlin_plugin_versions.py @@ -46,7 +46,7 @@ def version_string_to_version(version): # Version number used by CI. ci_version = '1.9.0' -many_versions = [ '1.5.0', '1.5.10', '1.5.20', '1.5.30', '1.6.0', '1.6.20', '1.7.0', '1.7.20', '1.8.0', '1.9.0-Beta', '1.9.20-Beta', '2.0.0-Beta4', '2.0.255-SNAPSHOT' ] +many_versions = [ '1.5.0', '1.5.10', '1.5.20', '1.5.30', '1.6.0', '1.6.20', '1.7.0', '1.7.20', '1.8.0', '1.9.0-Beta', '1.9.20-Beta', '2.0.0-RC1' ] many_versions_versions = [version_string_to_version(v) for v in many_versions] many_versions_versions_asc = sorted(many_versions_versions, key = lambda v: v.toTupleWithTag()) diff --git a/java/kotlin-extractor/src/main/kotlin/utils/versions/v_2_0_0-Beta4/parents.kt b/java/kotlin-extractor/src/main/kotlin/utils/versions/v_1_5_0/FirMetadataSourceFirFile.kt similarity index 100% rename from java/kotlin-extractor/src/main/kotlin/utils/versions/v_2_0_0-Beta4/parents.kt rename to java/kotlin-extractor/src/main/kotlin/utils/versions/v_1_5_0/FirMetadataSourceFirFile.kt diff --git a/java/kotlin-extractor/src/main/kotlin/utils/versions/v_1_9_0-Beta/CommentExtractorLighterAST.kt b/java/kotlin-extractor/src/main/kotlin/utils/versions/v_1_9_0-Beta/CommentExtractorLighterAST.kt index dd83b0fc4525..ecaa5e232873 100644 --- a/java/kotlin-extractor/src/main/kotlin/utils/versions/v_1_9_0-Beta/CommentExtractorLighterAST.kt +++ b/java/kotlin-extractor/src/main/kotlin/utils/versions/v_1_9_0-Beta/CommentExtractorLighterAST.kt @@ -1,6 +1,7 @@ package com.github.codeql.comments import com.github.codeql.* +import com.github.codeql.utils.versions.* import com.intellij.lang.LighterASTNode import com.intellij.util.diff.FlyweightCapableTreeStructure import org.jetbrains.kotlin.fir.backend.FirMetadataSource @@ -26,7 +27,7 @@ class CommentExtractorLighterAST( // Returns true if it extracted the comments; false otherwise. fun extract(): Boolean { val sourceElement = - (file.metadata as? FirMetadataSource.File)?.files?.elementAtOrNull(0)?.source + (file.metadata as? FirMetadataSource.File)?.firFile?.source val treeStructure = sourceElement?.treeStructure if (treeStructure == null) { return false diff --git a/java/kotlin-extractor/src/main/kotlin/utils/versions/v_1_9_0-Beta/FirMetadataSourceFirFile.kt b/java/kotlin-extractor/src/main/kotlin/utils/versions/v_1_9_0-Beta/FirMetadataSourceFirFile.kt new file mode 100644 index 000000000000..53fefb30817b --- /dev/null +++ b/java/kotlin-extractor/src/main/kotlin/utils/versions/v_1_9_0-Beta/FirMetadataSourceFirFile.kt @@ -0,0 +1,7 @@ +package com.github.codeql.utils.versions + +import org.jetbrains.kotlin.fir.backend.FirMetadataSource +import org.jetbrains.kotlin.fir.declarations.FirFile + +val FirMetadataSource.File.firFile: FirFile? + get() = this.files.elementAtOrNull(0) diff --git a/java/kotlin-extractor/src/main/kotlin/utils/versions/v_1_9_0-Beta/LinesOfCodeLighterAST.kt b/java/kotlin-extractor/src/main/kotlin/utils/versions/v_1_9_0-Beta/LinesOfCodeLighterAST.kt index 1c2ec1ed6fae..82357d9dfbd6 100644 --- a/java/kotlin-extractor/src/main/kotlin/utils/versions/v_1_9_0-Beta/LinesOfCodeLighterAST.kt +++ b/java/kotlin-extractor/src/main/kotlin/utils/versions/v_1_9_0-Beta/LinesOfCodeLighterAST.kt @@ -1,5 +1,6 @@ package com.github.codeql +import com.github.codeql.utils.versions.* import com.intellij.lang.LighterASTNode import com.intellij.util.diff.FlyweightCapableTreeStructure import org.jetbrains.kotlin.KtSourceElement @@ -14,7 +15,7 @@ class LinesOfCodeLighterAST(val logger: FileLogger, val tw: FileTrapWriter, val fun linesOfCodeInFile(id: Label): Boolean { val sourceElement = - (file.metadata as? FirMetadataSource.File)?.files?.elementAtOrNull(0)?.source + (file.metadata as? FirMetadataSource.File)?.firFile?.source if (sourceElement == null) { return false } diff --git a/java/kotlin-extractor/src/main/kotlin/utils/versions/v_2_0_0-RC1/FirMetadataSourceFirFile.kt b/java/kotlin-extractor/src/main/kotlin/utils/versions/v_2_0_0-RC1/FirMetadataSourceFirFile.kt new file mode 100644 index 000000000000..dc47af858b26 --- /dev/null +++ b/java/kotlin-extractor/src/main/kotlin/utils/versions/v_2_0_0-RC1/FirMetadataSourceFirFile.kt @@ -0,0 +1,7 @@ +package com.github.codeql.utils.versions + +import org.jetbrains.kotlin.fir.backend.FirMetadataSource +import org.jetbrains.kotlin.fir.declarations.FirFile + +val FirMetadataSource.File.firFile: FirFile? + get() = this.fir diff --git a/java/kotlin-extractor/src/main/kotlin/utils/versions/v_2_0_0-Beta4/IrSymbolInternals.kt b/java/kotlin-extractor/src/main/kotlin/utils/versions/v_2_0_0-RC1/IrSymbolInternals.kt similarity index 100% rename from java/kotlin-extractor/src/main/kotlin/utils/versions/v_2_0_0-Beta4/IrSymbolInternals.kt rename to java/kotlin-extractor/src/main/kotlin/utils/versions/v_2_0_0-RC1/IrSymbolInternals.kt diff --git a/java/kotlin-extractor/src/main/kotlin/utils/versions/v_2_0_0-Beta4/JavaBinarySourceElement.kt b/java/kotlin-extractor/src/main/kotlin/utils/versions/v_2_0_0-RC1/JavaBinarySourceElement.kt similarity index 100% rename from java/kotlin-extractor/src/main/kotlin/utils/versions/v_2_0_0-Beta4/JavaBinarySourceElement.kt rename to java/kotlin-extractor/src/main/kotlin/utils/versions/v_2_0_0-RC1/JavaBinarySourceElement.kt diff --git a/java/kotlin-extractor/src/main/kotlin/utils/versions/v_2_0_0-Beta4/JvmDefaultModeEnabled.kt b/java/kotlin-extractor/src/main/kotlin/utils/versions/v_2_0_0-RC1/JvmDefaultModeEnabled.kt similarity index 100% rename from java/kotlin-extractor/src/main/kotlin/utils/versions/v_2_0_0-Beta4/JvmDefaultModeEnabled.kt rename to java/kotlin-extractor/src/main/kotlin/utils/versions/v_2_0_0-RC1/JvmDefaultModeEnabled.kt diff --git a/java/kotlin-extractor/src/main/kotlin/utils/versions/v_2_0_0-Beta4/Psi2Ir.kt b/java/kotlin-extractor/src/main/kotlin/utils/versions/v_2_0_0-RC1/Psi2Ir.kt similarity index 100% rename from java/kotlin-extractor/src/main/kotlin/utils/versions/v_2_0_0-Beta4/Psi2Ir.kt rename to java/kotlin-extractor/src/main/kotlin/utils/versions/v_2_0_0-RC1/Psi2Ir.kt diff --git a/java/kotlin-extractor/src/main/kotlin/utils/versions/v_2_0_0-RC1/parents.kt b/java/kotlin-extractor/src/main/kotlin/utils/versions/v_2_0_0-RC1/parents.kt new file mode 100644 index 000000000000..9c103006099f --- /dev/null +++ b/java/kotlin-extractor/src/main/kotlin/utils/versions/v_2_0_0-RC1/parents.kt @@ -0,0 +1 @@ +// Nothing to do 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 345a871375aa..3cb70963c893 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 1.9.30.", + "markdownMessage": "The Kotlin version installed (`999.999.999`) is too recent for this version of CodeQL. Install a version lower than 2.0.10.", "severity": "error", "source": { "extractorName": "java",