Accessing a Kotlin Class Object from Java

I have a Kotlin class that has a class object, for example.

public class Foo { public class object { public val SomeValue : Int = 0 } } 

If I use this class from Java, how do I access SomeValue inside the class object? If it were a Java class with a static property, I would just use Foo.SomeValue - but I can't do it here.

IntellIJ shows that I can access Foo.object.$instance , but $instance does not have getSomeValue or anything like that. If I try to use $ instance.SomeValue anyway when I create an error message, I will say:

SomeValue has private access to Foo.object

I am using Kotlin 0.5.1.

+6
source share
1 answer

The "missing" getSomeValue () is a bug in the IDE. If you use it, it compiles in order. I created a problem: http://youtrack.jetbrains.com/issue/KT-3337

+4
source

All Articles