mirror of
https://github.com/jlengrand/kotlin.git
synced 2026-03-10 08:31:29 +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
35 lines
642 B
Kotlin
Vendored
35 lines
642 B
Kotlin
Vendored
// See KT-8269 java.lang.IllegalAccessError on accessing protected inner class declared in Kotlin super class
|
|
// TARGET_BACKEND: JVM
|
|
// FILE: Test.kt
|
|
|
|
package com.company
|
|
|
|
import other.JavaClass
|
|
|
|
open class Test {
|
|
protected class ProtectedClass
|
|
}
|
|
|
|
fun box(): String {
|
|
JavaClass.test()
|
|
return "OK"
|
|
}
|
|
|
|
// FILE: other/JavaClass.java
|
|
|
|
package other;
|
|
|
|
import com.company.Test;
|
|
|
|
public class JavaClass {
|
|
static class JavaTest extends Test {
|
|
public static boolean foo(Object obj) {
|
|
return obj instanceof ProtectedClass;
|
|
}
|
|
}
|
|
|
|
public static void test() {
|
|
JavaTest.foo(new Object());
|
|
}
|
|
}
|