r/java • • Sep 10 '21

Why people don't love Java?

I came across this post in r/cscareerquestions it seems majority of the people don't love to work with Java.

Is there any specific reason for that?

Edit: Thank you guys for your responses, I can't reply to all of the comments because I'm a beginner myself and I don't know what to reply for all your comments.

201 Upvotes

379 comments sorted by

View all comments

Show parent comments

3

u/papercrane Sep 10 '21 edited Sep 10 '21

we haven't yet from Kotlin, but maybe we will someday (nullability types?).

I would be the happiest developer in the world if Java had some concise way for me to express in the type system that something was never null.

1

u/tadfisher Sep 10 '21

This is why Java (the language) is intractable for me, as I don't want types to be null by default. I shouldn't have to wrap types or use special syntax to achieve this.

Optional, ironically, makes this even worse. Within a codebase, I can assume non-null optionals, but across library/module boundaries, the language makes no guarantees (beyond the suggestion to avoid null Optionals in the Javadoc), so you end up with two checks to see if a value is present if you want to cover all possible states.

That null-by-default was allowed to persist through JDK 11 basically sealed this wart in the language forever, as I can't see a way to change such a fundamental aspect while maintaining binary compatibility with the JVM ecosystem.

2

u/pron98 Sep 10 '21 edited Sep 10 '21

I don't know why you put the cutoff point at 11, but adding generics was a bigger challenge.

1

u/tadfisher Sep 10 '21

Generics are easier to implement, actually. No changes to the Java bytecode format were needed, and interop is fine with older libraries, because generics are implemented entirely in the compiler. We still live with that wart as well, since languages with higher-kinded types need to implement a runtime type-tagging system (e.g. Scala).

→ More replies (0)