小编kec*_*ccs的帖子

Accessing static inner class defined in Java, through derived class

I've got some classes defined in java, similar to the code below. I'm trying to access SomeValue through a derived java class, which is allowed in java, but not in kotlin.

Is there a way to access the field through the derived class?

// java file
// -------------------------------------------------

class MyBaseClass {
    public static final class MyInnerClass
    {
        public static int SomeValue = 42;
    }
}

final class MyDerivedClass extends MyBaseClass {
}

// kotlin file
// -------------------------------------------------

val baseAccess = …
Run Code Online (Sandbox Code Playgroud)

java interop kotlin

6
推荐指数
1
解决办法
114
查看次数

标签 统计

interop ×1

java ×1

kotlin ×1