50ea67ba13
@platformName is now supported for final non-overriding class member functions (including property accessors). Front-end provides diagnostics for inapplicable annotation cases. Code generation updated: - ignore kotlin.platform.platformName annotation for Java class methods; - bridges generation generates proper JVM declarations in case of methods renamed with @platformName. @platformName-related tests added. #KT-5524 Fixed
55 lines
1.1 KiB
Kotlin
Vendored
55 lines
1.1 KiB
Kotlin
Vendored
// !DIAGNOSTICS: -UNUSED_PARAMETER
|
|
import kotlin.platform.*
|
|
|
|
<!CONFLICTING_JVM_DECLARATIONS!>@platformName("bar")
|
|
fun foo(a: Any)<!> {}
|
|
|
|
<!CONFLICTING_JVM_DECLARATIONS!>fun bar(a: Any)<!> {}
|
|
|
|
class C {
|
|
<!CONFLICTING_JVM_DECLARATIONS!>@platformName("foo1")
|
|
fun foo(list: List<Int>)<!> {}
|
|
|
|
<!CONFLICTING_JVM_DECLARATIONS!>@platformName("foo1")
|
|
fun foo(list: List<String>)<!> {}
|
|
}
|
|
|
|
// Conflicts in inheritance.
|
|
|
|
// A1 -> B1 with accidental override
|
|
|
|
open class A1 {
|
|
<!INAPPLICABLE_PLATFORM_NAME!>@platformName("bar")<!>
|
|
open fun foo() {}
|
|
}
|
|
|
|
class B1 : A1() {
|
|
<!ACCIDENTAL_OVERRIDE!>fun bar()<!> {}
|
|
}
|
|
|
|
// A2 -> B2 with intended override and conflicting JVM declarations
|
|
|
|
open class A2 {
|
|
<!INAPPLICABLE_PLATFORM_NAME!>@platformName("bar")<!>
|
|
open fun foo() {}
|
|
}
|
|
|
|
class <!CONFLICTING_JVM_DECLARATIONS!>B2<!> : A2() {
|
|
override fun foo() {}
|
|
|
|
<!CONFLICTING_JVM_DECLARATIONS!>fun bar()<!> {}
|
|
}
|
|
|
|
// A3 -> B3 -> C3 with accidental override
|
|
|
|
open class A3 {
|
|
<!INAPPLICABLE_PLATFORM_NAME!>@platformName("bar")<!>
|
|
open fun foo() {}
|
|
}
|
|
|
|
open class B3: A3() {
|
|
}
|
|
|
|
class C3: B3() {
|
|
<!ACCIDENTAL_OVERRIDE!>fun bar()<!> {}
|
|
} |