Fix KT-12173 (Kotlin Lint False Positive for "Toast created but not shown" inside SAM adapter).

(cherry picked from commit 4940d3b)
This commit is contained in:
Yan Zhulanow
2016-06-16 18:28:44 +03:00
parent 1720f8b4ff
commit 6e6c9682ec
3 changed files with 64 additions and 5 deletions
+17
View File
@@ -10,6 +10,23 @@ class ToastTest(context: Context) : Activity() {
// Don't warn here
return Toast.makeText(context, "foo", Toast.LENGTH_LONG)
}
private fun insideRunnable(context: Context) {
Runnable {
Toast.makeText(context, "foo", Toast.LENGTH_LONG).show()
}
Runnable {
val toast = Toast.makeText(context, "foo", Toast.LENGTH_LONG)
if (5 > 3) {
toast.show()
}
}
Runnable {
Toast.<warning descr="Toast created but not shown: did you forget to call `show()` ?">makeText(context, "foo", Toast.LENGTH_LONG)</warning>
}
}
private fun showToast(context: Context) {
// Don't warn here