Java is catching up

Some features that I presented in previous “Kotlin pitches” are already in Java or are coming soon.

Already in Java:

  • local type inference
  • jshell (REPL) better than Kotlins buggy REPL

Coming soon:

  • raw strings
  • more powerful switch, similar to Kotlins when
  • pattern matching even better than what when in Kotlin allows
  • records (data classes)
  • continuations and fibers (similar to coroutines)
  • smart casts

See talk by Marc Reinhold.

There is a lot more to like in Kotlin that will not so soon (or never) be found in Java, but at least the sales pitch will become harder in the future. Personally I think Oracle should just adopt Kotlin, join the Kotlin Foundation, and deprecate Java as a language :wink:

1 Like

Glad to see Java is planning on adding some of the features from Kotlin. Interop with Java and new JVM features will improve Kotlin and the other JVM languages.

Kotlin will especially benefit since it’s built to be completely interoperable with Java.

Every language needs this. Using a switch statement in C# after getting familiar with when is tragic. In C[++] I get it; they’re mirroring low-level jump gate logic. But you can’t even fall-through in C#, so all you really have is an excessively awkward code block. Oh, but this is a Kotlin board so I should stop there.

I’m looking forwart to their destruction patterns.
Kotlin would be more verbose and more difficult to read than Java (unless kotlin would add them too :slight_smile:

Glad to see Java is planning on adding some of the features from a ton of other languages, which Kotlin copied.

Java evolves with its time ant with its style, I don’t see any relevant Kotlin’s contribution on it.

If Java developers are happy with it (and Java is widely used), I don’t find any valid reason to deprecate the language.
Moreover if Java stops to evolve for a Oracle’s imposition (and this can be a good news for many Java developers), I don’t consider this a “Kotlin success story”.

1 Like