mirror of
https://github.com/github/codeql.git
synced 2025-12-17 01:03:14 +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
|
cls.origin != IrDeclarationOrigin.IR_EXTERNAL_JAVA_DECLARATION_STUB
|
||||||
|
|
||||||
private fun needsInterfaceForwarder(f: IrFunction) =
|
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
|
// used, in which case real Java default interfaces are used, and we don't need to do
|
||||||
// anything.
|
// anything.
|
||||||
// Otherwise, for a Kotlin-defined method inheriting a Kotlin-defined default, we need to
|
// 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
|
// (NB. kotlinc's actual implementation strategy is different -- it makes an inner class
|
||||||
// called InterfaceWithDefault$DefaultImpls and stores the default methods
|
// called InterfaceWithDefault$DefaultImpls and stores the default methods
|
||||||
// there to allow default method usage in Java < 8, but this is hopefully niche.
|
// 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 {
|
f.parentClassOrNull.let {
|
||||||
it != null &&
|
it != null &&
|
||||||
it.origin != IrDeclarationOrigin.IR_EXTERNAL_JAVA_DECLARATION_STUB &&
|
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