Skip to content

Commit 11b5e2c

Browse files
Kotlin: drop 1.x language support and move tests to 2.0
Kotlin 2.4.0 removes -language-version 1.9, so tests and support bounds move to 2.0.\n\nExpected output updates include pre-existing K2 differences in mixed Java/Kotlin scenarios, tracked in github/codeql-kotlin-team#196. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
1 parent 3da195f commit 11b5e2c

14 files changed

Lines changed: 79 additions & 16 deletions

File tree

docs/codeql/reusables/supported-versions-compilers.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@
2121
Java,"Java 7 to 26 [6]_","javac (OpenJDK and Oracle JDK),
2222

2323
Eclipse compiler for Java (ECJ) [7]_",``.java``
24-
Kotlin,"Kotlin 1.8.0 to 2.3.2\ *x*","kotlinc",``.kt``
24+
Kotlin,"Kotlin 1.8.0 to 2.4.\ *x*","kotlinc",``.kt``
2525
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`` [8]_"
2626
Python [9]_,"2.7, 3.5, 3.6, 3.7, 3.8, 3.9, 3.10, 3.11, 3.12, 3.13",Not applicable,``.py``
2727
Ruby [10]_,"up to 3.3",Not applicable,"``.rb``, ``.erb``, ``.gemspec``, ``Gemfile``"

java/kotlin-extractor/versions.bzl

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,8 @@ def version_less(lhs, rhs):
2323

2424
def get_language_version(version):
2525
major, minor, _ = _version_to_tuple(version)
26+
if major == 1:
27+
return "2.0"
2628
return "%s.%s" % (major, minor)
2729

2830
def _basename(path):
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
[VALUE_NOT_IN_TYPE] predicate callableBinding(@caller callerid, @callable callee): Value 44417 of field callee is not in type @callable. Appears in tuple (-16777158,44417)
2+
Relevant element: callee=44417
3+
Full ID for 44417: @"callable;(0).f((55))(55)". The ID may expand to @"callable;{@"class;Test"}.f({@"type;int"}){@"type;int"}"

java/ql/integration-tests/kotlin/all-platforms/enhanced-nullability/test.expected

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,9 +2,9 @@ exprs
22
| Test.java:5:19:5:25 | Integer | Integer |
33
| Test.java:5:38:5:44 | Integer | Integer |
44
| Test.java:5:58:5:58 | p | Integer |
5-
| user.kt:2:7:2:7 | x | int |
5+
| user.kt:2:3:2:16 | x | int |
66
| user.kt:2:11:2:11 | t | Test |
7-
| user.kt:2:11:2:16 | f(...) | Integer |
7+
| user.kt:2:11:2:16 | <Call to unknown method> | int |
88
| user.kt:2:13:2:16 | <implicit not null> | int |
99
| user.kt:2:13:2:16 | int | int |
1010
| user.kt:2:15:2:15 | 5 | int |
Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,2 @@
1-
| user.kt:3:14:3:22 | getF(...) | lib/lib/TestKt.class:0:0:0:0 | getF |
2-
| user.kt:3:26:3:28 | getF(...) | lib/lib/TestKt.class:0:0:0:0 | getF |
1+
| user.kt:3:14:3:22 | getF(...) | file:///!unknown-binary-location/lib/TestKt.class:0:0:0:0 | getF |
2+
| user.kt:3:26:3:28 | getF(...) | file:///!unknown-binary-location/lib/TestKt.class:0:0:0:0 | getF |

java/ql/integration-tests/kotlin/all-platforms/extractor_information_kotlin1/ExtractorInformation.expected

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,4 +9,4 @@
99
| Percentage of calls with call target | 100 |
1010
| Total number of lines | 3 |
1111
| Total number of lines with extension kt | 3 |
12-
| Uses Kotlin 2: false | 1 |
12+
| Uses Kotlin 2: true | 1 |
Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,2 @@
1-
| AKt.class:0:0:0:0 | AKt | true |
21
| B.kt:0:0:0:0 | BKt | true |
32
| C.kt:1:1:3:1 | C | false |
Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +0,0 @@
1-
| equals | Test |
2-
| hashCode | Test |
3-
| toString | Test |
4-
| toString | java.lang.CharSequence |
Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
[VALUE_NOT_IN_TYPE] predicate callableBinding(@caller callerid, @callable callee): Value 43828 of field callee is not in type @callable. Appears in tuple (-16776213,43828)
2+
Relevant element: callee=43828
3+
Full ID for 43828: @"callable;(0).takesComparable((35),(35))(36)". The ID may expand to @"callable;{@"class;JavaDefns"}.takesComparable({@"class;java.lang.Comparable;{@"wildcard;super{@"class;java.lang.CharSequence"}"}"},{@"class;java.lang.Comparable;{@"wildcard;super{@"class;java.lang.CharSequence"}"}"}){@"type;void"}"
4+
[VALUE_NOT_IN_TYPE] predicate callableBinding(@caller callerid, @callable callee): Value 43832 of field callee is not in type @callable. Appears in tuple (-16776208,43832)
5+
Relevant element: callee=43832
6+
Full ID for 43832: @"callable;(0).takesArrayOfComparable((54),(54))(36)". The ID may expand to @"callable;{@"class;JavaDefns"}.takesArrayOfComparable({@"array;1;{@"class;java.lang.Comparable;{@"wildcard;super(19)"}"}"},{@"array;1;{@"class;java.lang.Comparable;{@"wildcard;super(19)"}"}"}){@"type;void"}"
7+
[VALUE_NOT_IN_TYPE] predicate callableBinding(@caller callerid, @callable callee): Value 43837 of field callee is not in type @callable. Appears in tuple (-16776201,43837)
8+
Relevant element: callee=43837
9+
Full ID for 43837: @"callable;(0).<init>((35),(35))(36)". The ID may expand to @"callable;{@"class;JavaDefns"}.<init>({@"class;java.lang.Comparable;{@"wildcard;super{@"class;java.lang.CharSequence"}"}"},{@"class;java.lang.Comparable;{@"wildcard;super{@"class;java.lang.CharSequence"}"}"}){@"type;void"}"

java/ql/integration-tests/kotlin/all-platforms/kotlin_java_lowering_wildcards/test.expected

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -8,16 +8,16 @@
88
| JavaDefns | takesComparable | invar | Comparable<CharSequence> |
99
| JavaDefns | takesNestedComparable | innerContravar | Comparable<Comparable<? super CharSequence>> |
1010
| JavaDefns | takesNestedComparable | outerContravar | Comparable<? super Comparable<CharSequence>> |
11-
| JavaDefns2 | JavaDefns2 | p0 | Comparable<CharSequence> |
11+
| JavaDefns2 | JavaDefns2 | p0 | Comparable<? super CharSequence> |
1212
| JavaDefns2 | JavaDefns2 | p1 | Comparable<? super CharSequence> |
1313
| JavaDefns2 | returnsInvariant | return | Comparable<CharSequence> |
1414
| JavaDefns2 | returnsWildcard | return | Comparable<? super CharSequence> |
15-
| JavaDefns2 | takesArrayOfComparable | p0 | Comparable<CharSequence>[] |
15+
| JavaDefns2 | takesArrayOfComparable | p0 | Comparable<? super CharSequence>[] |
1616
| JavaDefns2 | takesArrayOfComparable | p1 | Comparable<? super CharSequence>[] |
17-
| JavaDefns2 | takesComparable | p0 | Comparable<CharSequence> |
17+
| JavaDefns2 | takesComparable | p0 | Comparable<? super CharSequence> |
1818
| JavaDefns2 | takesComparable | p1 | Comparable<? super CharSequence> |
19-
| JavaDefns2 | takesNestedComparable | p0 | Comparable<Comparable<? super CharSequence>> |
20-
| JavaDefns2 | takesNestedComparable | p1 | Comparable<? super Comparable<CharSequence>> |
19+
| JavaDefns2 | takesNestedComparable | p0 | Comparable<? super Comparable<? super CharSequence>> |
20+
| JavaDefns2 | takesNestedComparable | p1 | Comparable<? super Comparable<? super CharSequence>> |
2121
| KotlinDefns | returnsContravar | return | Comparable<CharSequence> |
2222
| KotlinDefns | returnsContravarForced | return | Comparable<? super CharSequence> |
2323
| KotlinDefns | returnsCovar | return | List<CharSequence> |

0 commit comments

Comments
 (0)