Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Kotlin: Add 2.0.0-RC1 support (and remove 2.0.0-Beta4) #16177

Merged
merged 4 commits into from
Apr 11, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion java/kotlin-extractor/kotlin_plugin_versions.py
Original file line number Diff line number Diff line change
Expand Up @@ -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())
Expand Down
Original file line number Diff line number Diff line change
@@ -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
Expand All @@ -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
Expand Down
Original file line number Diff line number Diff line change
@@ -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)
Original file line number Diff line number Diff line change
@@ -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
Expand All @@ -14,7 +15,7 @@ class LinesOfCodeLighterAST(val logger: FileLogger, val tw: FileTrapWriter, val

fun linesOfCodeInFile(id: Label<DbFile>): Boolean {
val sourceElement =
(file.metadata as? FirMetadataSource.File)?.files?.elementAtOrNull(0)?.source
(file.metadata as? FirMetadataSource.File)?.firFile?.source
if (sourceElement == null) {
return false
}
Expand Down
Original file line number Diff line number Diff line change
@@ -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
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
// Nothing to do
Original file line number Diff line number Diff line change
@@ -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",
Expand Down
Loading