diff --git a/compiler/frontend.java/src/org/jetbrains/kotlin/resolve/jvm/checkers/JvmDefaultChecker.kt b/compiler/frontend.java/src/org/jetbrains/kotlin/resolve/jvm/checkers/JvmDefaultChecker.kt index 47e047331bd..0697206dd0b 100644 --- a/compiler/frontend.java/src/org/jetbrains/kotlin/resolve/jvm/checkers/JvmDefaultChecker.kt +++ b/compiler/frontend.java/src/org/jetbrains/kotlin/resolve/jvm/checkers/JvmDefaultChecker.kt @@ -117,7 +117,7 @@ class JvmDefaultChecker(private val jvmTarget: JvmTarget, private val project: P performSpecializationCheck ) ) { - checkPossibleClashMember(inheritedMember, jvmDefaultMode, context, declaration) + checkPossibleClashMember(inheritedMember, actualImplementation, jvmDefaultMode, context, declaration) } } else if (actualImplementation is PropertyDescriptor && inheritedMember is PropertyDescriptor) { val getterImpl = actualImplementation.getter @@ -146,7 +146,7 @@ class JvmDefaultChecker(private val jvmTarget: JvmTarget, private val project: P } } - checkPossibleClashMember(inheritedMember, jvmDefaultMode, context, declaration) + checkPossibleClashMember(inheritedMember, actualImplementation, jvmDefaultMode, context, declaration) } } } @@ -179,6 +179,7 @@ class JvmDefaultChecker(private val jvmTarget: JvmTarget, private val project: P private fun checkPossibleClashMember( inheritedFun: CallableMemberDescriptor, + actualImplementation: CallableMemberDescriptor, jvmDefaultMode: JvmDefaultMode, context: DeclarationCheckerContext, declaration: KtDeclaration @@ -188,7 +189,7 @@ class JvmDefaultChecker(private val jvmTarget: JvmTarget, private val project: P context.trace.report( ErrorsJvm.EXPLICIT_OVERRIDE_REQUIRED_IN_MIXED_MODE.on( declaration, - getDirectMember(inheritedFun), + getDirectMember(actualImplementation), getDirectMember(clashMember), jvmDefaultMode.description ) diff --git a/compiler/testData/compileKotlinAgainstCustomBinaries/jvmDefaultClashWithNoCompatibility/output.txt b/compiler/testData/compileKotlinAgainstCustomBinaries/jvmDefaultClashWithNoCompatibility/output.txt index 2760832f5d6..320ded8e2be 100644 --- a/compiler/testData/compileKotlinAgainstCustomBinaries/jvmDefaultClashWithNoCompatibility/output.txt +++ b/compiler/testData/compileKotlinAgainstCustomBinaries/jvmDefaultClashWithNoCompatibility/output.txt @@ -1,4 +1,4 @@ -compiler/testData/compileKotlinAgainstCustomBinaries/jvmDefaultClashWithNoCompatibility/source.kt:12:7: error: explicit override is required for 'public open fun evaluate(): Any? defined in KotlinUBinaryExpressionWithType' in the '-Xjvm-default=all-compatibility' mode. Otherwise, implicit class override 'public open fun evaluate(): Any? defined in KotlinAbstractUExpression' (compiled in the old -Xjvm-default mode) is not fully overridden and might be incorrectly called at runtime +compiler/testData/compileKotlinAgainstCustomBinaries/jvmDefaultClashWithNoCompatibility/source.kt:12:7: error: explicit override is required for 'public open fun evaluate(): Any? defined in KotlinEvaluatableUElement' in the '-Xjvm-default=all-compatibility' mode. Otherwise, implicit class override 'public open fun evaluate(): Any? defined in KotlinAbstractUExpression' (compiled in the old -Xjvm-default mode) is not fully overridden and might be incorrectly called at runtime class KotlinUBinaryExpressionWithType : KotlinAbstractUExpression(), KotlinEvaluatableUElement {} ^ COMPILATION_ERROR diff --git a/compiler/testData/compileKotlinAgainstCustomBinaries/jvmDefaultClashWithOld/output.txt b/compiler/testData/compileKotlinAgainstCustomBinaries/jvmDefaultClashWithOld/output.txt index cc7ab869e1b..840d20d5208 100644 --- a/compiler/testData/compileKotlinAgainstCustomBinaries/jvmDefaultClashWithOld/output.txt +++ b/compiler/testData/compileKotlinAgainstCustomBinaries/jvmDefaultClashWithOld/output.txt @@ -1,7 +1,7 @@ -compiler/testData/compileKotlinAgainstCustomBinaries/jvmDefaultClashWithOld/source.kt:15:7: error: explicit override is required for 'public open var test: String defined in SubCheckClass' in the '-Xjvm-default=all' mode. Otherwise, implicit class override 'public open var test: String defined in base.CheckClass' (compiled in the old -Xjvm-default mode) is not fully overridden and might be incorrectly called at runtime +compiler/testData/compileKotlinAgainstCustomBinaries/jvmDefaultClashWithOld/source.kt:15:7: error: explicit override is required for 'public open var test: String defined in SubCheck' in the '-Xjvm-default=all' mode. Otherwise, implicit class override 'public open var test: String defined in base.CheckClass' (compiled in the old -Xjvm-default mode) is not fully overridden and might be incorrectly called at runtime class SubCheckClass : CheckClass(), SubCheck ^ -compiler/testData/compileKotlinAgainstCustomBinaries/jvmDefaultClashWithOld/source.kt:15:7: error: explicit override is required for 'public open fun test(): String defined in SubCheckClass' in the '-Xjvm-default=all' mode. Otherwise, implicit class override 'public open fun test(): String defined in base.CheckClass' (compiled in the old -Xjvm-default mode) is not fully overridden and might be incorrectly called at runtime +compiler/testData/compileKotlinAgainstCustomBinaries/jvmDefaultClashWithOld/source.kt:15:7: error: explicit override is required for 'public open fun test(): String defined in SubCheck' in the '-Xjvm-default=all' mode. Otherwise, implicit class override 'public open fun test(): String defined in base.CheckClass' (compiled in the old -Xjvm-default mode) is not fully overridden and might be incorrectly called at runtime class SubCheckClass : CheckClass(), SubCheck ^ COMPILATION_ERROR