I wanted to try something new with delegated properties in my Kotlin code. What I found in docs is that for custom delegated properties I need to create a class with obligatory methods - getValue and optionally setValue, which are part of interfaces mentioned in the docs:
You can create delegates as anonymous objects without creating new classes using the interfaces
ReadOnlyPropertyandReadWritePropertyfrom the Kotlin standard library
I started digging through Kotlin's built-in delegate functions. I looked into implementation of lazy function which looks like following:
public actual fun <T> lazy(initializer: () -> T): Lazy<T> = SynchronizedLazyImpl(initializer)
And here's where my question stands: Why does it actually works? Lazy interface has only value property and some method determining its initialisation of the value. SynchronizedLazyImpl doesn't have much more than this. None of them have getValue or setValue methods, so why Kotlin doesn't complain and compiles successfully?