112e54b35a
non-accessible in the current context, it is a compiler error. Otherwise we might generate a CHECKCAST instruction that causes IAE at run-time. Here we are somewhat less permissive then Java (see inaccessibleType.kt in diagnostics tests).
44 lines
1.5 KiB
Kotlin
Vendored
44 lines
1.5 KiB
Kotlin
Vendored
//FILE: a/MyJavaClass.java
|
|
package a;
|
|
|
|
class MyJavaClass {
|
|
static int staticMethod() {
|
|
return 1;
|
|
}
|
|
|
|
static class NestedClass {
|
|
static int staticMethodOfNested() {
|
|
return 1;
|
|
}
|
|
}
|
|
}
|
|
|
|
//FILE:a.kt
|
|
package a
|
|
|
|
val <!EXPOSED_PROPERTY_TYPE!>mc<!> = MyJavaClass()
|
|
val x = MyJavaClass.staticMethod()
|
|
val y = MyJavaClass.NestedClass.staticMethodOfNested()
|
|
val <!EXPOSED_PROPERTY_TYPE!>z<!> = MyJavaClass.NestedClass()
|
|
|
|
//FILE: b.kt
|
|
package b
|
|
|
|
import a.<!INVISIBLE_REFERENCE!>MyJavaClass<!>
|
|
|
|
val <!EXPOSED_PROPERTY_TYPE!>mc1<!> = <!INACCESSIBLE_TYPE!><!INVISIBLE_MEMBER!>MyJavaClass<!>()<!>
|
|
|
|
val x = <!INVISIBLE_REFERENCE!>MyJavaClass<!>.<!INVISIBLE_MEMBER!>staticMethod<!>()
|
|
val y = <!INVISIBLE_REFERENCE!>MyJavaClass<!>.<!INVISIBLE_REFERENCE!>NestedClass<!>.<!INVISIBLE_MEMBER!>staticMethodOfNested<!>()
|
|
val <!EXPOSED_PROPERTY_TYPE!>z<!> = <!INACCESSIBLE_TYPE!><!INVISIBLE_REFERENCE!>MyJavaClass<!>.<!INVISIBLE_MEMBER!>NestedClass<!>()<!>
|
|
|
|
//FILE: c.kt
|
|
package a.c
|
|
|
|
import a.<!INVISIBLE_REFERENCE!>MyJavaClass<!>
|
|
|
|
val <!EXPOSED_PROPERTY_TYPE!>mc1<!> = <!INACCESSIBLE_TYPE!><!INVISIBLE_MEMBER!>MyJavaClass<!>()<!>
|
|
|
|
val x = <!INVISIBLE_REFERENCE!>MyJavaClass<!>.<!INVISIBLE_MEMBER!>staticMethod<!>()
|
|
val y = <!INVISIBLE_REFERENCE!>MyJavaClass<!>.<!INVISIBLE_REFERENCE!>NestedClass<!>.<!INVISIBLE_MEMBER!>staticMethodOfNested<!>()
|
|
val <!EXPOSED_PROPERTY_TYPE!>z<!> = <!INACCESSIBLE_TYPE!><!INVISIBLE_REFERENCE!>MyJavaClass<!>.<!INVISIBLE_MEMBER!>NestedClass<!>()<!> |