Files
kotlin-fork/compiler/testData/diagnostics/tests/j+k/deprecations/doNotMarkWriteIfGetterDeprecated.fir.kt
T
Denis.Zharkov 0694ee50a3 K1: Report deprecation on synthetic properties for NOT_CONSIDERED JDK members
Currently, for other synthetic properties, deprecation from the original
method is already being propagated to the relevant new synthetic
property accessor.

But what we need is also reporting warnings on synthetic properties
accessors call-sites if original methods are considered deprecated
as a result of deprecation propagation.

KT-60659 Fixed
^KT-60769 Fixed
2023-08-03 13:31:07 +00:00

51 lines
985 B
Kotlin
Vendored

// LANGUAGE: -StopPropagatingDeprecationThroughOverrides
// FILE: JavaClass.java
public class JavaClass {
@Deprecated
public String getFoo() { return ""; }
public void setFoo(String x) {}
}
// FILE: main.kt
open class KotlinClass : JavaClass() {
@Deprecated("")
override fun getFoo(): String {
return super.<!DEPRECATION!>getFoo<!>()
}
override fun setFoo(x: String?) {
super.setFoo(x)
}
}
class KotlinSubClass : KotlinClass() {
override fun <!OVERRIDE_DEPRECATION!>getFoo<!>(): String {
return super.<!DEPRECATION!>getFoo<!>()
}
override fun setFoo(x: String?) {
super.setFoo(x)
}
}
fun main(j: JavaClass, k: KotlinClass, ks: KotlinSubClass) {
j.<!DEPRECATION!>getFoo<!>()
j.setFoo("")
j.<!DEPRECATION!>foo<!>
j.foo = ""
k.<!DEPRECATION!>getFoo<!>()
k.setFoo("")
k.<!DEPRECATION!>foo<!>
k.foo = ""
ks.getFoo()
ks.setFoo("")
ks.foo
ks.foo = ""
}