In Kotlin, suppose, I have class:
class MyKotlinClass {
lateinit var field: String
}
According to docs:
Late-Initialized properties are also exposed as fields. The visibility of the field will be the same as the visibility of lateinit property setter.
I can use in java code either myKotlinClass.field
or myKotlinClass.getField()
. I want to disable field access and remain only access through getter and setter.
How can I achieve this and remain lateinit modifier?