Apart from legacy projects written in Kotlin, after Java 21/23, what's the argument for using Kotlin anymore, especially that it's a proprietary language?
In what sense is Kotlin a proprietary language? It's Apache 2.0 licensed AFAIK. And there are many projects that use Kotlin which are not legacy projects.
I love java and kotlin. The gap has certainly swayed way more in Java's favor over the last 5 years, but there are still a ton of great features that kotlin does first and if that gives java a target to run toward in a lagging way more legacy compatible rock solid way, isn't this just a win for both camps? Just consider kotlin (JVM) to be java-beta with slightly different flourishes, and you wouldn't be too far from the truth. Kotlin is also very big in pushing their other initiatives that aren't entirely directed at JVM at least for now, like cross compilation native targets, compile time serialization primitives, totally structured concurrency, etc
Aside from the often cited nullability issue, here is an (incomplete) list of important things that Kotlin still does better than Java:
- First class, fully functional closures.
- Non-abstract classes and methods are final by default.
- Named parameters.
- Easy to write iterators via sequence { ... }
- First class support for unsigned types.
Honestly, lack of the ability to write free-floating functions in Java.
Recent Java features like records, pattern matching, sum types via sealed interfaces have certainly made it a much more ergonomic and modern language.
But having to wrap everything in "class" feels ludicrous to me.
The other ones are lack of explicit null types (meant to be addressed by JEP "Null-Restricted and Nullable Types") and inability to write anonymous types for functions.