Remove part of your sentence, and I think you've answered your own question.
> How do you know it's "the problem"? [...] because this is a Java interop call.
If you're making platform calls, you know you have to deal with nulls (or at least, you should, in my opinion). So you declare returns nullable and avoid passing nulls unless that's documented to be okay.
Kotlin's Elvis operator makes this really easy:
val a: String? = null
val b: String = a ?: "alternative"
> How do you know it's "the problem"? [...] because this is a Java interop call.
If you're making platform calls, you know you have to deal with nulls (or at least, you should, in my opinion). So you declare returns nullable and avoid passing nulls unless that's documented to be okay.
Kotlin's Elvis operator makes this really easy:
val a: String? = null val b: String = a ?: "alternative"