Files
kotlin-fork/compiler/testData/diagnostics/testsWithStdLib/annotations/jvmDefault/javaOverride.fir.kt
T
Dmitriy Novozhilov c80cfb0fdb [FIR] Replace single supertype scope with list of scopes of supertypes in use site scopes
This big refactoring is needed to cleanup building of overrides
  mappings and prevent creating redundant intersection overrides in
  cases when there is no need in them:

```kotlin
interface A {
    fun foo()
}

interface B {
    fun foo()
}

interface C : A, B {
    override fun foo()
}
```

Before this refactoring there was next override tree:
C.foo
  intersection override (A.foo, B.foo)
    A.foo
    B.foo

Also this commit fixes special mapping of overrides in jvm scopes
  for declarations which have kotlin builtins in supertypes with
  special java mapping rules (collections, for example)
2022-01-19 15:24:43 +03:00

73 lines
1.5 KiB
Kotlin
Vendored

// !JVM_DEFAULT_MODE: enable
// !JVM_TARGET: 1.8
// FILE: JavaInterface.java
public interface JavaInterface {
default void test() {}
default void testForNonDefault() {}
void testAbstract();
}
// FILE: 1.kt
interface KotlinInterface : JavaInterface {
@<!DEPRECATION!>JvmDefault<!>
override fun test() {}
<!NON_JVM_DEFAULT_OVERRIDES_JAVA_DEFAULT!>override fun testForNonDefault()<!> {}
override fun testAbstract() {}
}
interface KotlinInterface2 : JavaInterface, KotlinInterface {
@<!DEPRECATION!>JvmDefault<!>
override fun test() {}
<!NON_JVM_DEFAULT_OVERRIDES_JAVA_DEFAULT!>override fun testForNonDefault()<!> {}
override fun testAbstract() {}
}
interface KotlinInterfaceForIndirect : JavaInterface {
}
interface KotlinInterfaceIndirectInheritance : KotlinInterfaceForIndirect {
@<!DEPRECATION!>JvmDefault<!>
override fun test() {}
<!NON_JVM_DEFAULT_OVERRIDES_JAVA_DEFAULT!>override fun testForNonDefault()<!> {}
override fun testAbstract() {}
}
open class KotlinClass : JavaInterface {
override fun test() {}
override fun testForNonDefault() {}
override fun testAbstract() {}
}
interface KotlinInterfaceX {
fun test() {}
fun testForNonDefault() {}
fun testAbstract() {}
}
interface KotlinInterfaceManySuper: JavaInterface, KotlinInterfaceX {
@<!DEPRECATION!>JvmDefault<!>
override fun test() {}
<!NON_JVM_DEFAULT_OVERRIDES_JAVA_DEFAULT!>override fun testForNonDefault()<!> {}
override fun testAbstract() {}
}