Calling a class object member from Java:
public class Engine private() {
class object {
public fun getInstance(): Engine = Engine()
}
}
Option 1: class object is an object, so you can access its members as instance methods through a static constant:
// Java
Engine.OBJECT$.getInstance()
Option 2: use [platformStatic]
annotation:
public class Engine private() {
class object {
[platformStatic]
public fun getInstance(): Engine = Engine()
}
}
Then, this method becomes static (the previous option still works):
// Java
Engine.getInstance()
More details: http://kotlinlang.org/docs/reference/java-interop.html