Ir al contenido

Closeable Not Closed (ARCH8080)

Esta página aún no está disponible en tu idioma.

Key kotlin.performance.disposable-not-disposed · Severity error · Category performance

Flags Closeable resources (streams, readers, connections) created without use { } or a try/finally close.

val reader = File(path).bufferedReader()
return reader.readLine()
return File(path).bufferedReader().use { it.readLine() }

Wrap the resource in use { } so it closes on every path.