|
|
|
|
|
by markcerqueira
3073 days ago
|
|
> They could have gone hardcore and said any non-primitive, unanotated platform type is nullable but that would have made interop really ugly. Instead you just get a crash if it is null which is worse in my opinion. > And all of the null checks would have muddied up code and added (admittedly minimal) runtime costs. This already happens automatically for parameters to a Kotlin function; check out the Kotlin Intrinsics checks. |
|
Only in the same instances you would in Java-to-Java. So the ergonomics aren't improved or reduced. And really, this only helps on returns anyways. Marking every Java param nullable gets you nothing if the implementer didn't handle it well.
> This already happens automatically for parameters to a Kotlin function; check out the Kotlin Intrinsics checks.
Yup, and I don't like it. So even public Kotlin-to-Kotlin calls suffer. Haven't checked in a while, but I would like an option to use annotations only and skip those top-of-method checks.