mirror of
https://github.com/jlengrand/kotlin.git
synced 2026-05-09 15:53:37 +00:00
Protected should be translated to public as in Java so that everything would work at runtime. The real visibility is still saved to an InnerClasses attribute #KT-8269 Fixed #KT-9246 Fixed #KT-10143 Fixed
27 lines
397 B
Kotlin
Vendored
27 lines
397 B
Kotlin
Vendored
// See KT-9246 IllegalAccessError when trying to access protected nested class from parent class
|
|
// TARGET_BACKEND: JVM
|
|
// FILE: a.kt
|
|
|
|
package a
|
|
|
|
abstract class A {
|
|
protected class C {
|
|
fun result() = "OK"
|
|
}
|
|
}
|
|
|
|
// FILE: b.kt
|
|
|
|
package b
|
|
|
|
import a.A
|
|
|
|
class B : A() {
|
|
protected val c = A.C()
|
|
val result: String get() = c.result()
|
|
}
|
|
|
|
fun box(): String {
|
|
return B().result
|
|
}
|