Test for obsolete KT-5445: Bad access to protected data in getfield
#KT-5445 Obsolete
This commit is contained in:
@@ -0,0 +1,16 @@
|
||||
package test2
|
||||
|
||||
import test.A
|
||||
|
||||
public fun box(): String {
|
||||
return B().test(B())
|
||||
}
|
||||
|
||||
public class B : A() {
|
||||
public fun test(other:Any): String {
|
||||
if (other is B && other.s == 2) {
|
||||
return "OK"
|
||||
}
|
||||
return "fail"
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,5 @@
|
||||
package test
|
||||
|
||||
open class A {
|
||||
@JvmField protected val s = 2;
|
||||
}
|
||||
@@ -0,0 +1,13 @@
|
||||
package test2
|
||||
|
||||
import test.A
|
||||
|
||||
class C : A() {
|
||||
fun a(): String {
|
||||
return this.s
|
||||
}
|
||||
}
|
||||
|
||||
public fun box(): String {
|
||||
return C().a()
|
||||
}
|
||||
@@ -0,0 +1,5 @@
|
||||
package test
|
||||
|
||||
open class A {
|
||||
@JvmField protected val s = "OK";
|
||||
}
|
||||
Reference in New Issue
Block a user