Files
kotlin-fork/compiler/testData/diagnostics/testsWithStdLib/annotations/jvmDefault/jvmDefaultsWithJava.kt
T
Alexander Udalov 3120a35a88 JvmDefault: remove most tests on @JvmDefault
The tests are removed because JvmDefault is going to be deprecated with
error in KT-54746 and removed later in KT-57696.

Many of the removed tests already had existing counterparts with the new
modes `all` and `all-compatibility`. In this change, I've added such
tests where they were missing, and removed tests which were testing
behavior specific to the JvmDefault annotation, such as some
diagnostics.

 #KT-54746
2023-04-25 14:33:00 +00:00

159 lines
3.1 KiB
Kotlin
Vendored

// FIR_IDENTICAL
// !JVM_DEFAULT_MODE: all
// !JVM_TARGET: 1.8
// FILE: JavaInterface.java
public interface JavaInterface {
default String test() {
return "OK";
}
default String testOverride() {
return "OK";
}
}
// FILE: 1.kt
interface KotlinInterface : JavaInterface {
fun fooo() {
super.test()
object {
fun run () {
super@KotlinInterface.test()
}
}
}
val propertyy: String
get() {
super.test()
object {
fun run () {
super@KotlinInterface.test()
}
}
return ""
}
override fun testOverride(): String {
return "OK";
}
}
interface KotlinInterfaceIndirectInheritance : KotlinInterface {
fun foooo() {
super.test()
object {
fun run () {
super@KotlinInterfaceIndirectInheritance.test()
}
}
}
val propertyyy: String
get() {
super.test()
object {
fun run () {
super@KotlinInterfaceIndirectInheritance.test()
}
}
return ""
}
}
open class KotlinClass : JavaInterface {
fun foo() {
super.test()
super.testOverride()
object {
fun run () {
super@KotlinClass.test()
}
}
}
val property: String
get() {
super.test()
super.testOverride()
object {
fun run () {
super@KotlinClass.test()
}
}
return ""
}
}
class KotlinClassIndirectInheritance : KotlinClass() {
fun foo2() {
super.test()
super.testOverride()
object {
fun run () {
super@KotlinClassIndirectInheritance.test()
}
}
}
val property2: String
get() {
super.test()
super.testOverride()
object {
fun run () {
super@KotlinClassIndirectInheritance.test()
}
}
return ""
}
}
class KotlinClassIndirectInheritance2 : KotlinInterfaceIndirectInheritance {
fun foo() {
super.test()
super.testOverride()
object {
fun run () {
super@KotlinClassIndirectInheritance2.test()
}
}
}
val property: String
get() {
super.test()
super.testOverride()
object {
fun run () {
super@KotlinClassIndirectInheritance2.test()
}
}
return ""
}
}
fun test() {
KotlinClass().foo()
KotlinClass().property
KotlinClassIndirectInheritance2().foo()
KotlinClassIndirectInheritance2().property
KotlinClass().test()
KotlinClass().property
KotlinClass().testOverride()
KotlinClassIndirectInheritance().testOverride()
}