I'm trying Kotlin and want to implement a lazy extension property for Activity:
/**
* Activity module
*/
val Activity.activityModule: ActivityModule by lazy {
ActivityModule(this)
}
The compiler errors with:
'this' is not defined in this context
How can I qualify this as Activity this? I have read a guide but can't get it. this@Activity
says the reference is unresolved.
The lazy
delegate in Kotlin doesn't have reference to a property member class.
I see two solutions: