I'm trying to access a data class with embedded enum from java
data class MyStatus( val status: Status ) {
enum class Status{ OK, ERROR }
}
Seems that Status is invisible if I use it from Java. Is there any way to achieve this ?
No there's no problem, just do
MyStatus s = new MyStatus(MyStatus.Status.ERROR);
Here's what the compiler generates for your Enum:
public static enum Status {
OK,
ERROR;
}
It's nested in MyStatus.
publicalready sincepublicis the default visibility modifier in Kotlin