Closeable Owner Not Closeable (ARCH8082)
Dieser Inhalt ist noch nicht in deiner Sprache verfügbar.
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.
Incorrect
Section titled “Incorrect”class Uploader { private val client = OkHttpClient() }Correct
Section titled “Correct”class Uploader : Closeable { private val client = OkHttpClient() override fun close() = client.dispatcher.executorService.shutdown()}Implement Closeable / AutoCloseable and release the owned resources in close().