Glad to know extension methods on interfaces can a...
# announcements
m
Glad to know extension methods on interfaces can act as a replacement for some of the Lombok annotations my team is used to using. For example, here's the Kotlin version of `@Slf4j`:
Copy code
interface Slf4k {
    companion object {
        val logInstances = mutableMapOf<Class<*>, Logger>()
    }
}

inline val <reified T : Slf4k> T.LOG: Logger
    get() = Slf4k.logInstances.getOrPut(T::class.java) {
        LoggerFactory.getLogger(T::class.java)
    }
👍 1