Skip to content

Commit fecad02

Browse files
committed
Fix handling of X/jvm-default intermediate modes such as 'compatibility', the new default as of 2.2.0
1 parent 3001d0b commit fecad02

File tree

6 files changed

+23
-16
lines changed

6 files changed

+23
-16
lines changed

java/kotlin-extractor/src/main/kotlin/KotlinFileExtractor.kt

+2-2
Original file line numberDiff line numberDiff line change
@@ -1608,7 +1608,7 @@ open class KotlinFileExtractor(
16081608
cls.origin != IrDeclarationOrigin.IR_EXTERNAL_JAVA_DECLARATION_STUB
16091609

16101610
private fun needsInterfaceForwarder(f: IrFunction) =
1611-
// jvmDefaultModeEnabledIsEnabled means that -Xjvm-default=all or all-compatibility was
1611+
// jvmDefaultModeIsNoCompatibility means that -Xjvm-default=all or =no-compatibility was
16121612
// used, in which case real Java default interfaces are used, and we don't need to do
16131613
// anything.
16141614
// Otherwise, for a Kotlin-defined method inheriting a Kotlin-defined default, we need to
@@ -1618,7 +1618,7 @@ open class KotlinFileExtractor(
16181618
// (NB. kotlinc's actual implementation strategy is different -- it makes an inner class
16191619
// called InterfaceWithDefault$DefaultImpls and stores the default methods
16201620
// there to allow default method usage in Java < 8, but this is hopefully niche.
1621-
!jvmDefaultModeEnabledIsEnabled(getJvmDefaultMode(pluginContext.languageVersionSettings)) &&
1621+
!jvmDefaultModeIsNoCompatibility(getJvmDefaultMode(pluginContext.languageVersionSettings)) &&
16221622
f.parentClassOrNull.let {
16231623
it != null &&
16241624
it.origin != IrDeclarationOrigin.IR_EXTERNAL_JAVA_DECLARATION_STUB &&

java/kotlin-extractor/src/main/kotlin/utils/versions/v_1_5_0/JvmDefaultModeEnabled.kt

-7
This file was deleted.
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
package com.github.codeql.utils.versions
2+
3+
import org.jetbrains.kotlin.config.JvmDefaultMode
4+
5+
fun jvmDefaultModeIsNoCompatibility(jdm: JvmDefaultMode): Boolean {
6+
return jdm == JvmDefaultMode.ALL_INCOMPATIBLE
7+
}

java/kotlin-extractor/src/main/kotlin/utils/versions/v_2_0_0-RC1/JvmDefaultModeEnabled.kt

-7
This file was deleted.
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
package com.github.codeql.utils.versions
2+
3+
import org.jetbrains.kotlin.config.JvmDefaultMode
4+
5+
fun jvmDefaultModeIsNoCompatibility(jdm: JvmDefaultMode): Boolean {
6+
return jdm == JvmDefaultMode.ALL
7+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
package com.github.codeql.utils.versions
2+
3+
import org.jetbrains.kotlin.config.JvmDefaultMode
4+
5+
fun jvmDefaultModeIsNoCompatibility(jdm: JvmDefaultMode): Boolean {
6+
return jdm == JvmDefaultMode.NO_COMPATIBILITY
7+
}

0 commit comments

Comments
 (0)