https://kotlinlang.org logo
#coroutines
Title
# coroutines
d

David Glasser

09/05/2019, 6:52 PM
In a test, I have:
Copy code
cache.getIfPresentAsync("x").let { deferred ->
				assertNotNull(deferred)
				assertTrue(deferred.isCompleted)
				assertEquals(42, deferred.await())
			}
IntelliJ is giving me an inspection "Deferred result is never used" on the word assertNotNull. Is there actually anything wrong with my code? It looks like the inspection goes away if I delete the assertNotNull line and change the assertTrue to
deferred!!.isCompleted
, but I'm wondering if I'm missing something
j

jw

09/05/2019, 6:59 PM
Just a false-positive because
assertNotNull
returns the non-null value. You can file a bug about it if you want.
d

David Glasser

09/05/2019, 7:13 PM
Does that get filed in the kotlinx.coroutines github, the kotlin Jira, or some intellij jira?
j

jw

09/05/2019, 7:16 PM
i suspect the inspection comes from the kotlin plugin so kotl.in/issue would be a good place to start it
3 Views