This document discusses avoiding a false sense of null safety in Kotlin code. It recommends using "?:" and throwing a custom exception instead of "!!", as this makes the assumption of non-nullability clear, allows logging if it occurs, and permits custom errors and fixes to be shown to users. Determining why a value is nullable in the first place is also suggested if the null situation should not be possible.
14. Why “?: throw” is better than “!!”
‣ Clear WHY it can’t be null
15. Why “?: throw” is better than “!!”
‣ Clear WHY it can’t be null
‣ Can grep logs to see if it happens
16. Why “?: throw” is better than “!!”
‣ Clear WHY it can’t be null
‣ Can grep logs to see if it happens
‣ Can show custom error to the user
17. Why “?: throw” is better than “!!”
‣ Clear WHY it can’t be null
‣ Can grep logs to see if it happens
‣ Can show custom error to the user
‣ Can tell user how to fix the “impossible situation”
18. Next step: Why is it nullable?
(If this situation is not possible)