mirror of
https://github.com/jlengrand/kotlin.git
synced 2026-05-08 15:53:19 +00:00
Fix for KT-10590: IllegalAccessError when protected getter of Java base class is accessed from lambda using property access syntax
This commit is contained in:
@@ -0,0 +1,12 @@
|
||||
public class JavaBaseClass {
|
||||
|
||||
private String field = "fail";
|
||||
|
||||
protected String getFoo() {
|
||||
return field;
|
||||
}
|
||||
|
||||
protected void setFoo(String foo) {
|
||||
field = foo;
|
||||
}
|
||||
}
|
||||
27
compiler/testData/codegen/boxWithJava/properties/protectedJavaPropertyInCompanion/kotlin.kt
vendored
Normal file
27
compiler/testData/codegen/boxWithJava/properties/protectedJavaPropertyInCompanion/kotlin.kt
vendored
Normal file
@@ -0,0 +1,27 @@
|
||||
package z
|
||||
|
||||
import JavaBaseClass
|
||||
|
||||
class A {
|
||||
@JvmField var foo = "fail"
|
||||
|
||||
companion object : JavaBaseClass() {
|
||||
@JvmStatic fun test(): String {
|
||||
return runSlowly {
|
||||
foo = "OK"
|
||||
foo
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
fun runSlowly(f: () -> String): String {
|
||||
return f()
|
||||
}
|
||||
|
||||
fun box(): String {
|
||||
val a = A()
|
||||
a.foo = "Kotlin"
|
||||
if (a.foo != "Kotlin") return "fail"
|
||||
|
||||
return A.test()
|
||||
}
|
||||
Reference in New Issue
Block a user