In stdlib / kotlin.io we find
inline fun <T : Closeable?, R> T.use(block: (T) -> R): R (source)
However, it is implemented on Closeable, and not on the AutoCloseable superinterface. When working with some frameworks using AutoCloseable, this can be a little painful.
Why doesn't Kotlin support โuseโ with AutoCloseble?
source share