.use extension checking

118 views
Skip to first unread message

Ruslan Magzyumov

unread,
Nov 29, 2021, 1:29:50 AM11/29/21
to lint-dev
I need to check that use extension is used for Closable interface.

private val file = File("path")
val fileOutputStream = file.outputStream().write(999) //WARNING

private val file = File("path")
val fileOutputStream = file.outputStream().use { //NORMAL
// Some methods
}

I started off by looking for a method that returned type is inherits from Closable (in the example above is outputStream()) . How do I find the method that references on outputStream(), then to find its name?
Reply all
Reply to author
Forward
0 new messages