mirror of
https://github.com/jlengrand/kotlin.git
synced 2026-05-09 00:21:47 +00:00
References to protected members from crossinline lambdas in the same package do not need accessors.
20 lines
285 B
Kotlin
Vendored
20 lines
285 B
Kotlin
Vendored
// FILE: protectedPack/J.java
|
|
|
|
package protectedPack;
|
|
|
|
public class J {
|
|
protected String foo = "OK";
|
|
}
|
|
|
|
// FILE: 1.kt
|
|
|
|
package protectedPack
|
|
|
|
inline fun foo(crossinline bar: () -> String) = object {
|
|
fun baz() = bar()
|
|
}.baz()
|
|
|
|
fun box(): String {
|
|
return foo { J().foo!! }
|
|
}
|