mirror of
https://github.com/github/codeql.git
synced 2025-12-16 16:53:25 +01:00
Fix handling of X/jvm-default intermediate modes such as 'compatibility', the new default as of 2.2.0
This commit is contained in:
@@ -1608,7 +1608,7 @@ open class KotlinFileExtractor(
|
||||
cls.origin != IrDeclarationOrigin.IR_EXTERNAL_JAVA_DECLARATION_STUB
|
||||
|
||||
private fun needsInterfaceForwarder(f: IrFunction) =
|
||||
// jvmDefaultModeEnabledIsEnabled means that -Xjvm-default=all or all-compatibility was
|
||||
// jvmDefaultModeIsNoCompatibility means that -Xjvm-default=all or =no-compatibility was
|
||||
// used, in which case real Java default interfaces are used, and we don't need to do
|
||||
// anything.
|
||||
// Otherwise, for a Kotlin-defined method inheriting a Kotlin-defined default, we need to
|
||||
@@ -1618,7 +1618,7 @@ open class KotlinFileExtractor(
|
||||
// (NB. kotlinc's actual implementation strategy is different -- it makes an inner class
|
||||
// called InterfaceWithDefault$DefaultImpls and stores the default methods
|
||||
// there to allow default method usage in Java < 8, but this is hopefully niche.
|
||||
!jvmDefaultModeEnabledIsEnabled(getJvmDefaultMode(pluginContext.languageVersionSettings)) &&
|
||||
!jvmDefaultModeIsNoCompatibility(getJvmDefaultMode(pluginContext.languageVersionSettings)) &&
|
||||
f.parentClassOrNull.let {
|
||||
it != null &&
|
||||
it.origin != IrDeclarationOrigin.IR_EXTERNAL_JAVA_DECLARATION_STUB &&
|
||||
|
||||
@@ -1,7 +0,0 @@
|
||||
package com.github.codeql.utils.versions
|
||||
|
||||
import org.jetbrains.kotlin.config.JvmDefaultMode
|
||||
|
||||
fun jvmDefaultModeEnabledIsEnabled(jdm: JvmDefaultMode): Boolean {
|
||||
return jdm.forAllMethodsWithBody
|
||||
}
|
||||
@@ -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
|
||||
}
|
||||
@@ -1,7 +0,0 @@
|
||||
package com.github.codeql.utils.versions
|
||||
|
||||
import org.jetbrains.kotlin.config.JvmDefaultMode
|
||||
|
||||
fun jvmDefaultModeEnabledIsEnabled(jdm: JvmDefaultMode): Boolean {
|
||||
return jdm.isEnabled
|
||||
}
|
||||
@@ -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
|
||||
}
|
||||
@@ -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
|
||||
}
|
||||
Reference in New Issue
Block a user