Ir al contenido

Closeable Owner Not Closeable (ARCH8082)

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

Key kotlin.performance.closeable-owner-not-closeable · Severity warning · Category performance

Flags a class holding Closeable / AutoCloseable properties (streams, clients, connections) that does not itself implement Closeable - nobody can release what it owns.

class Uploader { private val client = OkHttpClient() }
class Uploader : Closeable {
private val client = OkHttpClient()
override fun close() = client.dispatcher.executorService.shutdown()
}

Implement Closeable / AutoCloseable and release the owned resources in close().