"Convert try / finally to .use { } call intention introduced" #KT-12100 Fixed

This commit is contained in:
Mikhail Glukhikh
2016-11-22 19:14:56 +03:00
parent 1f1403d31d
commit 59b2608354
16 changed files with 254 additions and 0 deletions
@@ -0,0 +1,6 @@
fun main(args: Array<String>) {
val writer = File("hello-world.txt").bufferedReader()
writer.use { writer ->
// do stuff with writer
}
}
@@ -0,0 +1,9 @@
fun main(args: Array<String>) {
val writer = File("hello-world.txt").bufferedReader()
try {
// do stuff with writer
}
finally {
writer.close()
}
}
@@ -0,0 +1,5 @@
<html>
<body>
This intention converts a try-finally block with resource.close() in finally into the resource.use() call
</body>
</html>