Kotlin: Update integration tests from -language-version 1.9 to 2.0

Kotlin 2.4.0 no longer supports -language-version 1.9. Update all
integration tests that explicitly pass this flag to use 2.0 instead.
Also update the extractor_information_kotlin1 expected output since
-language-version 2.0 causes the extractor to report 'Uses Kotlin 2: true'.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
This commit is contained in:
Anders Fugmann
2026-06-08 16:22:38 +02:00
parent c11d82737a
commit f3037d68ca
8 changed files with 13 additions and 10 deletions

View File

@@ -106,7 +106,10 @@ kt_javac_options(
"%s/%s" % (v, target)
for _, target in _resources
] + (
["%s/%s" % (v, _compiler_plugin_registrar_service[1])] if not version_less(v, "2.4.0") else []
["%s/%s" % (
v,
_compiler_plugin_registrar_service[1],
)] if not version_less(v, "2.4.0") else []
),
cmd = "\n".join([
"echo %s-%s > $(RULEDIR)/%s/com/github/codeql/extractor.name" % (_extractor_name_prefix, v, v),

View File

@@ -6,6 +6,6 @@ def test(codeql, java_full):
codeql.database.create(
command=[
f"javac {java_srcs} -d build",
"kotlinc -language-version 1.9 user.kt -cp build",
"kotlinc -language-version 2.0 user.kt -cp build",
]
)

View File

@@ -2,5 +2,5 @@ import commands
def test(codeql, java_full):
commands.run("kotlinc -language-version 1.9 test.kt -d lib")
codeql.database.create(command="kotlinc -language-version 1.9 user.kt -cp lib")
commands.run("kotlinc -language-version 2.0 test.kt -d lib")
codeql.database.create(command="kotlinc -language-version 2.0 user.kt -cp lib")

View File

@@ -9,4 +9,4 @@
| Percentage of calls with call target | 100 |
| Total number of lines | 3 |
| Total number of lines with extension kt | 3 |
| Uses Kotlin 2: false | 1 |
| Uses Kotlin 2: true | 1 |

View File

@@ -1,2 +1,2 @@
def test(codeql, java_full):
codeql.database.create(command="kotlinc -J-Xmx2G -language-version 1.9 SomeClass.kt")
codeql.database.create(command="kotlinc -J-Xmx2G -language-version 2.0 SomeClass.kt")

View File

@@ -2,5 +2,5 @@ import commands
def test(codeql, java_full):
commands.run("kotlinc -language-version 1.9 A.kt")
codeql.database.create(command="kotlinc -cp . -language-version 1.9 B.kt C.kt")
commands.run("kotlinc -language-version 2.0 A.kt")
codeql.database.create(command="kotlinc -cp . -language-version 2.0 B.kt C.kt")

View File

@@ -3,4 +3,4 @@ import commands
def test(codeql, java_full):
commands.run(["javac", "Test.java", "-d", "bin"])
codeql.database.create(command="kotlinc -language-version 1.9 user.kt -cp bin")
codeql.database.create(command="kotlinc -language-version 2.0 user.kt -cp bin")

View File

@@ -8,6 +8,6 @@ def test(codeql, java_full):
command=[
"kotlinc kotlindefns.kt",
"javac JavaUser.java JavaDefns.java -cp .",
"kotlinc -language-version 1.9 -cp . kotlinuser.kt",
"kotlinc -language-version 2.0 -cp . kotlinuser.kt",
]
)