3 ms·
Null should be valid. Kotlin solved Java's problem by making it a compiler error if a value that can be null isn't checked and shown to be null or the actual v
by Larrikin 3y ago
Null should be valid.
Kotlin solved Java's problem by making it a compiler error if a value that can be null isn't checked and shown to be null or the actual value, eliminating an entire class of exceptions.
- equalsione 3y agoI’m not familiar enough with kotlin to comment fully but from your description the checker framework [0] appears to do the same thing in Java. I confess I’m not fond of checker framework. I find the error messages can be obtuse but it is very effective. 0 - https://checkerframework.org/ https://checkerframework.org/
- a57721 3y agoKotlin supports nullability on the level of the type system, it is similar to TypeScript in this respect. The problem with nullability annotations in Java is that they are not enforced, and there is no commonly adopted standard. There are like ten competing libraries with similar annotations. There was JSR 305 ("Annotations for Software Defect Detection"), but it has been dormant. When you import a third party library, you never know what kind of nullability annotations it uses and if it uses them at all.