2 ms·
I don't agree that it's a pain, it's a relief, actually. Though Kotlin's solution is half-baked. Java library is full of Type!, so Kotlin doesn't really help th
by vbezhenar 10y ago
I don't agree that it's a pain, it's a relief, actually. Though Kotlin's solution is half-baked. Java library is full of Type!, so Kotlin doesn't really help there, even when there are clear contracts which types are nullable or not. They tried to implement external annotations, but for some reason ditched that idea, and I think, that it should be done. Of course there will be places with Type!, but for majority of cases, even static bytecode analysis should be able to annotate majority of types as either nullable or not. So even if Kotlin is better than plain Java in that regard (it checks for not-null at Java-Kotlin boundaries and detects NPE earlier), it still can be improved.
- rbygrave 10y ago> Java-Kotlin boundaries ... For me so far this boils down to annotating Java API methods that return null with @Nullable. If Java API never returns null collections then this is not too bad in practice.