3 ms·
The problem isn't with `foo`, it's with how Kotlin's Java interop treats `just`. Because Java doesn't have a language-level concept of non-nullability, Kotlin'
by pdpi 9y ago
The problem isn't with `foo`, it's with how Kotlin's Java interop treats `just`.
Because Java doesn't have a language-level concept of non-nullability, Kotlin's interpretation of the type signature for `just` must accept nulls (sure enough, non-nullability is enforced at run time inside RxJava). Kotlin trains you to expect nullability to be a compile-time constraint, and has borderline frictionless with Java. Put the two together, and it's very easy to walk into a runtime-error trap.
- stewbrew 9y agoI understand that. I still think the example isn't well chosen. Whatever.