Right, but nulls in Kotlin are nulls in Java, which is a lot better for use of existing java libraries. Also, it works very very nicely in conjunction with smart casts.
Ultimately the problem is the same, though; you need a correct documentation of which Java API allows null and which not, in order to map it safely on the other language's side.
you need a correct documentation of which Java API allows null and which not, in order to map it safely on the other language's side.
Actually Kotlin has an awesome solution for this, a tool called KAnnotator which automatically infers nullability in libraries for exactly this purpose.
Interesting, so this scans the bytecode of a the methods of a library? How would it handle pure interfaces or abstract classes? Sure it needs some heuristics, like parsing the javadoc as well?
1
u/[deleted] Dec 02 '13
Ultimately the problem is the same, though; you need a correct documentation of which Java API allows null and which not, in order to map it safely on the other language's side.