“The null-safety compilation failure will occur when attempting to construct the Kotlin class from within Kotlin code. When the Kotlin class is constructed from another language such as Java or Groovy an
IllegalArgumentException will be thrown at runtime. In this sense the Kotlin creators’ argument of avoiding NPEs does not pragmatically hold true as the
NullPointerException has simply been replaced by an
I wrote the above statement the other day as part of a potential new book I am working on. However, I am not quite happy with it and I think it could sound a bit harsh or might not be quite correct either. I believe it can do with community feedback and with some more discusion, which I would be happy to accommodate, include and credit.
Anyone want to throw kudos and bats at this?