Null-safety and Java reflection

Here are my observations about the way you communicate:

  • You seem to think that you are entitled to the community taking your (current) issue seriously, even though the fault lies with you: You need to understand how Java and Kotlin work, and how they intteroperate, and you need to deisgn your code so it works properly.
  • Kotlin does not provide the features you want from a language. But you are not forced to use Kotlin, so it is your decision to use Kotlin that is the problem here. Not Kotlin.
  • You claim that Kotlin was badly designed, not considering the enormous amount of thought, community particpation and work that went into this design.
  • You complain about the people and the community who want to genuinely help you understand why it work the way it does, because it does not work the way you want it to.

I don’t think my remark was out of place. It was not my genuine feeling, but it was stated in a nice way.

Where does it say that Kotlin fixes NPEs? Kotlin has better handling of nullability, but I don’t believe there was ever a statement about Kotlin fixing NPEs.

Should a language protect developers against themselves, even if they perfom unsupported actions that violate the language rules and the compiler cannot possibly know about?

Yes, the NPE with the elvis operator can be fixed by the compiler adding checks for null every time a non-nullable variable is accessed. But I know that this will lead to lots of people complaining that Kotlin uselessly checks for null.

A language has rules, you should learn them to correctly and effectively use the language. If you don’t like the language rules, you can suggest an improvement. But if the language does not evolve into what you want, you don’t start making claims that is is bad, the community is bad, etc.

Since Spring is just using Java reflection

This is incorrect. As of version 5.0, Spring Framework leverage Kotlin reflection and even provides a full null-safe API, see Redirecting....

Thanks, for the link.
Unfortunately:
“Generic type arguments, varargs and array elements nullability are not supported yet”

Indeed, and we are working with JetBrains to support these use cases as well.