Lombok. Add it to your Java project. Add @Data to the class.

Yup Java is a still a language that works at the end of the day.

The idea here being that the language itself (Kotlin) provides help for a lot of these issues out of the box. Keep in mind this is just two of many areas Kotlin is good at.

Like you said most NPEs ARE design time errors. Which is great when the language provides support to enforce that out of the box (Kotlin.) The tools you mentioned are external (support library and Lombok.) If you're the sole engineer on a project (you know what the class was suppose to do, you designed it) you probably won’t run into these issues as much then.

Try working with 40+ engineers and the lines blur a bit. People forget to annotate things or maybe they are new to Java or Android or both. Kotlin being opt-in for nullability helps a ton here during onboarding.

It was never that Java can’t do it, it’s that Kotlin makes it easier.

At the end of the day, no one is taking Java away but showing a new language that has helpful additions. It won’t work for everyone, just like some engineers prefer Vim or Emacs. Neither are wrong, it's up to you to use what makes you the most effective.

One clap, two clap, three clap, forty?

By clapping more or less, you can signal to us which stories really stand out.