diff --git a/compiler/frontend.java/src/org/jetbrains/kotlin/resolve/jvm/checkers/AdditionalBuiltInsMembersChecker.kt b/compiler/frontend.java/src/org/jetbrains/kotlin/resolve/jvm/checkers/AdditionalBuiltInsMembersChecker.kt index b704d3f45b96e..df0e36afd30f1 100644 --- a/compiler/frontend.java/src/org/jetbrains/kotlin/resolve/jvm/checkers/AdditionalBuiltInsMembersChecker.kt +++ b/compiler/frontend.java/src/org/jetbrains/kotlin/resolve/jvm/checkers/AdditionalBuiltInsMembersChecker.kt @@ -56,7 +56,8 @@ object AdditionalBuiltInsMemberOverrideDeclarationChecker : DeclarationChecker { val resultingDescriptor = descriptor as? CallableMemberDescriptor ?: return val overrideKeyword = declaration.modifierList?.getModifier(KtTokens.OVERRIDE_KEYWORD) ?: return - if (resultingDescriptor.original.overriddenDescriptors.all { it.isAdditionalBuiltInMember() }) { + val overriddenDescriptors = resultingDescriptor.original.overriddenDescriptors + if (overriddenDescriptors.isNotEmpty() && overriddenDescriptors.all { it.isAdditionalBuiltInMember() }) { diagnosticHolder.report(Errors.UNSUPPORTED_FEATURE.on(overrideKeyword, LanguageFeature.AdditionalBuiltInsMembers)) } } diff --git a/compiler/testData/diagnostics/testsWithJava8/targetedBuiltIns/unsupportedFeature.kt b/compiler/testData/diagnostics/testsWithJava8/targetedBuiltIns/unsupportedFeature.kt index a692134b7228e..e280dead2ee46 100644 --- a/compiler/testData/diagnostics/testsWithJava8/targetedBuiltIns/unsupportedFeature.kt +++ b/compiler/testData/diagnostics/testsWithJava8/targetedBuiltIns/unsupportedFeature.kt @@ -29,3 +29,14 @@ fun foo(x: List, y: Throwable) { // Falls back to extension in stdlib y.printStackTrace() } + +interface X { + fun foo(): Int = 1 + val hidden: Boolean +} + +class Y : X { + // There should not be UNSUPPORTED_FEATURE diagnostic + override fun foo() = 1 + override var hidden: Boolean = true +}