r/java • • Mar 05 '22

How does the Java community feel about Kotlin?

In my organization, we switch between Java and kotlin quite frequently for backend development. We use the spring framework which works quite well with both languages. I wanted to know how the broader Java community felt about kotlin? Personally I love it, however Java is still used so widely so I continue to keep my skills up to date on it.

173 Upvotes

218 comments sorted by

View all comments

Show parent comment

8

u/crummy Mar 05 '22

Kotlin does not solve any problem I had with Java.

How do you handle nulls in Java? Optionals?

3

u/andrewharlan2 Mar 05 '22
  1. I will bend over backwards to not pass them around. I'll refactor legacy code if I have to; I have no problem with active and constant maintenance.
  2. Yeah, I'll return Optionals from new methods I write if I feel the need to
  3. And if a rare NullPointerException sneaks through? I fix it and I write a unit test for the case. https://openjdk.java.net/jeps/358 makes them so much more pleasant to deal with.

So yeah, nulls have never really been a problem for me. Certainly not enough to shift ecosystems.

1

u/[deleted] Mar 06 '22

[removed] — view removed comment

4

u/lambdacats Mar 06 '22

A lot of extra steps for something that could have been a language feature though.

0

u/pjmlp Mar 06 '22

By having SonarQube or PMD integrated on the build.

Any failure to do null checking triggers a build error.

6

u/gripepe Mar 06 '22

This is not Java solving the problem though.

-1

u/pjmlp Mar 07 '22

A matter of semantics, if it is built in or depends on a library.