-
Notifications
You must be signed in to change notification settings - Fork 1.7k
Add support for Kotlin 2.2.0; drop Kotlin 1.5.x #19402
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
Merged
smowton
merged 18 commits into
github:main
from
smowton:smowton/admin/kotlin-2.2.0-support
May 13, 2025
Merged
Changes from all commits
Commits
Show all changes
18 commits
Select commit
Hold shift + click to select a range
08aad90
Add 2.2.0-Beta1 deps
smowton abea647
Bazel: update `rules_kotlin` to 2.1.3
163a403
Add Kotlin 2.2.0-Beta1; drop Kotlin 1.5
smowton 24feb51
Fix Gradle config
smowton a36fc30
Fix build for Kotlin 2.2.0
smowton 4cb1e78
Update Kotlin doc table
smowton 2ad5e20
Change note
smowton 3f23212
Update test expectation
smowton 0d21fa5
Change default version
smowton 29d369f
Don't try to decode a class from a .java file
smowton 34e0a7b
Bump Kotlin version to keep integration test working
smowton 1afe67a
Accept Kotlin 2.1.20 test changes
smowton 0d34837
Bump unit tests to use latest stable Kotlin
smowton fc1fd26
Fix plugin test to work with Kotlin 2.1.20
smowton 2722249
Update test expectation
smowton a2836f5
Adjust integration test expectations
smowton 3001d0b
Bazel: remove `2.0.0` `rules_kotlin` patching
fecad02
Fix handling of X/jvm-default intermediate modes such as 'compatibili…
smowton File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Git LFS file not shown
3 changes: 3 additions & 0 deletions
3
java/kotlin-extractor/deps/kotlin-compiler-embeddable-2.2.0-Beta1.jar
Git LFS file not shown
Git LFS file not shown
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -27,7 +27,7 @@ | |
import io | ||
import os | ||
|
||
DEFAULT_VERSION = "2.0.0" | ||
DEFAULT_VERSION = "2.1.20" | ||
|
||
|
||
def options(): | ||
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
4 changes: 2 additions & 2 deletions
4
java/kotlin-extractor/src/main/kotlin/utils/IrVisitorLookup.kt
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
3 changes: 3 additions & 0 deletions
3
java/kotlin-extractor/src/main/kotlin/utils/versions/v_1_5_0/IrLazyFunction.kt
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
package com.github.codeql.utils.versions | ||
|
||
typealias IrLazyFunction = org.jetbrains.kotlin.ir.declarations.lazy.IrLazyFunction |
4 changes: 4 additions & 0 deletions
4
java/kotlin-extractor/src/main/kotlin/utils/versions/v_1_5_0/IrVisitor.kt
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
package com.github.codeql.utils.versions | ||
|
||
abstract class IrVisitor<R, D> : org.jetbrains.kotlin.ir.visitors.IrElementVisitor<R, D> | ||
abstract class IrVisitorVoid : org.jetbrains.kotlin.ir.visitors.IrElementVisitorVoid |
7 changes: 0 additions & 7 deletions
7
java/kotlin-extractor/src/main/kotlin/utils/versions/v_1_5_0/JvmDefaultModeEnabled.kt
This file was deleted.
Oops, something went wrong.
7 changes: 7 additions & 0 deletions
7
...otlin-extractor/src/main/kotlin/utils/versions/v_1_5_0/JvmDefaultModeIsNoCompatibility.kt
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
package com.github.codeql.utils.versions | ||
|
||
import org.jetbrains.kotlin.config.JvmDefaultMode | ||
|
||
fun jvmDefaultModeIsNoCompatibility(jdm: JvmDefaultMode): Boolean { | ||
return jdm == JvmDefaultMode.ALL_INCOMPATIBLE | ||
} |
7 changes: 7 additions & 0 deletions
7
java/kotlin-extractor/src/main/kotlin/utils/versions/v_1_5_0/getJvmDefaultMode.kt
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
package com.github.codeql.utils.versions | ||
|
||
import org.jetbrains.kotlin.config.JvmAnalysisFlags | ||
import org.jetbrains.kotlin.config.LanguageVersionSettings | ||
|
||
fun getJvmDefaultMode(lvs: LanguageVersionSettings) = | ||
lvs.getFlag(JvmAnalysisFlags.jvmDefaultMode) |
6 changes: 6 additions & 0 deletions
6
java/kotlin-extractor/src/main/kotlin/utils/versions/v_1_5_0/isDispatchReceiver.kt
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
package com.github.codeql.utils.versions | ||
|
||
import org.jetbrains.kotlin.ir.declarations.IrFunction | ||
import org.jetbrains.kotlin.ir.declarations.IrValueParameter | ||
|
||
fun isDispatchReceiver(p: IrValueParameter) = p.index == -1 && p != (p.parent as? IrFunction)?.extensionReceiverParameter |
5 changes: 5 additions & 0 deletions
5
...tlin-extractor/src/main/kotlin/utils/versions/v_1_5_0/parameterIndexExcludingReceivers.kt
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
package com.github.codeql.utils.versions | ||
|
||
import org.jetbrains.kotlin.ir.declarations.IrValueParameter | ||
|
||
fun parameterIndexExcludingReceivers(vp: IrValueParameter) = vp.index |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
7 changes: 0 additions & 7 deletions
7
java/kotlin-extractor/src/main/kotlin/utils/versions/v_2_0_0-RC1/JvmDefaultModeEnabled.kt
This file was deleted.
Oops, something went wrong.
7 changes: 7 additions & 0 deletions
7
...n-extractor/src/main/kotlin/utils/versions/v_2_0_0-RC1/JvmDefaultModeIsNoCompatibility.kt
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
package com.github.codeql.utils.versions | ||
|
||
import org.jetbrains.kotlin.config.JvmDefaultMode | ||
|
||
fun jvmDefaultModeIsNoCompatibility(jdm: JvmDefaultMode): Boolean { | ||
return jdm == JvmDefaultMode.ALL | ||
} |
3 changes: 3 additions & 0 deletions
3
java/kotlin-extractor/src/main/kotlin/utils/versions/v_2_2_0-Beta1/IrLazyFunction.kt
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
package com.github.codeql.utils.versions | ||
|
||
typealias IrLazyFunction = org.jetbrains.kotlin.psi2ir.lazy.IrLazyFunction |
4 changes: 4 additions & 0 deletions
4
java/kotlin-extractor/src/main/kotlin/utils/versions/v_2_2_0-Beta1/IrVisitor.kt
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
package com.github.codeql.utils.versions | ||
|
||
typealias IrVisitor<R, D> = org.jetbrains.kotlin.ir.visitors.IrVisitor<R, D> | ||
typealias IrVisitorVoid = org.jetbrains.kotlin.ir.visitors.IrVisitorVoid |
7 changes: 7 additions & 0 deletions
7
...extractor/src/main/kotlin/utils/versions/v_2_2_0-Beta1/JvmDefaultModeIsNoCompatibility.kt
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
package com.github.codeql.utils.versions | ||
|
||
import org.jetbrains.kotlin.config.JvmDefaultMode | ||
|
||
fun jvmDefaultModeIsNoCompatibility(jdm: JvmDefaultMode): Boolean { | ||
return jdm == JvmDefaultMode.NO_COMPATIBILITY | ||
} |
7 changes: 7 additions & 0 deletions
7
...n/utils/versions/v_2_2_0-Beta1/createImplicitParameterDeclarationWithWrappedDescriptor.kt
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
package com.github.codeql.utils.versions | ||
|
||
import org.jetbrains.kotlin.ir.declarations.IrClass | ||
import org.jetbrains.kotlin.ir.util.createThisReceiverParameter | ||
|
||
fun IrClass.createImplicitParameterDeclarationWithWrappedDescriptor() = | ||
this.createThisReceiverParameter() |
7 changes: 7 additions & 0 deletions
7
java/kotlin-extractor/src/main/kotlin/utils/versions/v_2_2_0-Beta1/getJvmDefaultMode.kt
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
package com.github.codeql.utils.versions | ||
|
||
import org.jetbrains.kotlin.config.LanguageVersionSettings | ||
import org.jetbrains.kotlin.config.jvmDefaultMode | ||
|
||
fun getJvmDefaultMode(lvs: LanguageVersionSettings) = | ||
lvs.jvmDefaultMode |
6 changes: 6 additions & 0 deletions
6
java/kotlin-extractor/src/main/kotlin/utils/versions/v_2_2_0-Beta1/isDispatchReceiver.kt
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
package com.github.codeql.utils.versions | ||
|
||
import org.jetbrains.kotlin.ir.declarations.IrValueParameter | ||
import org.jetbrains.kotlin.ir.declarations.IrParameterKind | ||
|
||
fun isDispatchReceiver(p: IrValueParameter) = p.kind == IrParameterKind.DispatchReceiver |
10 changes: 10 additions & 0 deletions
10
...xtractor/src/main/kotlin/utils/versions/v_2_2_0-Beta1/parameterIndexExcludingReceivers.kt
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
package com.github.codeql.utils.versions | ||
|
||
import org.jetbrains.kotlin.ir.declarations.IrFunction | ||
import org.jetbrains.kotlin.ir.declarations.IrValueParameter | ||
|
||
fun parameterIndexExcludingReceivers(vp: IrValueParameter): Int { | ||
val offset = | ||
(vp.parent as? IrFunction)?.let { (if (it.extensionReceiverParameter != null) 1 else 0) + (if (it.dispatchReceiverParameter != null) 1 else 0) } ?: 0 | ||
return vp.indexInParameters - offset | ||
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
2 changes: 1 addition & 1 deletion
2
...ration-tests/kotlin/all-platforms/diagnostics/kotlin-version-too-new/diagnostics.expected
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
6 changes: 3 additions & 3 deletions
6
java/ql/integration-tests/kotlin/all-platforms/private_property_accessors/test.expected
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We can move the necessary bits from v_1_5* into
v_1_6_0
, and delete the rest, now we have dropped 1.5 support, but that can be done in a follow-up PR.