r/java • • Jul 30 '21

What is the future of Java?

I'm not asking like is java going to die or will Java be relevant in future. I'm just curious to know about the future of java. What are the upcoming things coming in java that can change the future of it.

173 Upvotes

123 comments sorted by

View all comments

18

u/[deleted] Jul 30 '21

[removed] — view removed comment

2

u/ArmoredPancake Jul 30 '21

How so? They're completely different things. Kotlin is just a different language at this point. With things like Jetpack Compose, Multiplatform it's unreachable for Java.

-10

u/pjmlp Jul 30 '21

Java was born to be multiplatform. Kotlin is an Android language that is all.

11

u/CraftyAdventurer Jul 30 '21

Kotlin is a JVM language, so anywhere Java can run, Kotlin can also run. Meaning, it's just as much multiplatform as Java is. But even more than that, there are projects like Kotlin/JS which compiles Kotlin into JavaScript, and Kotlin/Native which runs Kotlin as a native image completely without the JVM.

It's not an Android language, it's just used a lot for Android because Android was stuck on Java 6 or 7 when Kotlin came out, so naturally a lot of developers went for it to get new features. People used Kotlin on Android long before Google declared it officially supported.

-1

u/pjmlp Jul 30 '21

Kotlin/JS doesn't hold a candle to TypeScript, and it is yet another platform that JetBrains doesn't control its direction, JavaScript does.

Kotlin/Native is being redesigned as its memory model was a failure, thanks to the decision of being incompatible with JVM one.

It is an Android language, it is the only platform where it is #KotlinFirst instead of a guest language that needs to adapt itself to the whims of platform owners.

2

u/CraftyAdventurer Jul 30 '21

Kotlin/JS doesn't hold a candle to TypeScript, and it is yet another platform that JetBrains doesn't control its direction, JavaScript does.

Kotlin/Native is being redesigned as its memory model was a failure, thanks to the decision of being incompatible with JVM one.

These statements are true, but "Java was born to be multiplatform. Kotlin is an Android language " is still false.

Java is multiplatform only because of the JVM which needs to exist on the target platform in order to run a Java program. Kotlin runs on that same JVM. Wherever you can put Java code, you can put Kotlin instead and it will run just fine. So on the JVM, Kotlin is exactly as much multiplatform as Java is. Those two projects, despite their issues, make it even more multiplatform because they allow Kotlin to run even outside the JVM, in places Java can't (altough there probably are some java-to-javascript compiler projects and Graavm is in a way similar to Kotlin/Native)

2

u/pjmlp Jul 30 '21

Java features are designed alongside JVM features, Kotlin must use what is there.

JavaScript features are designed alongside browser VM features, Kotlin must use what is there.

LLVM features are designed for AOT languages, Kotlin must use what is there.

Kotlin is #KotlinFirst on Android thanks to JetBrains/Google's deal, influences Android Runtime design, and the there are the Android's team dirty moves like not updating Java on Android, ergo Kotlin is Android language.

2

u/Pika3323 Jul 30 '21

Kotlin is #KotlinFirst on Android thanks to JetBrains/Google's deal, influences Android Runtime design, and the there are the Android's team dirty moves like not updating Java on Android, ergo Kotlin is Android language.

That logic doesn't track.

If Kotlin is an "Android language" because ART doesn't support new Java features, then how do you explain the proposed value classes in Kotlin given the notable lack of value class support in ART?

I mean, have you been reading what you've written in this comment section? It's bordering on delusional. Kotlin is still primarily a JVM language, and ART not being updated doesn't hold any bearing over whether or not that's true.

1

u/pjmlp Jul 31 '21

Value classes in Kotlin are not the same as what JVM is bringing to Java, regarding memory layout semantics.

3

u/Pika3323 Jul 31 '21

I don't know what you've read, but Kotlin's value classes are very clearly being influenced by Valhalla more than they are by ART.

You might be thinking of the @JvmInline annotation, which is not only different, but actually completely invalidates your point.

So, with that said, please give an example of where ART has influenced Kotlin over the JVM.

→ More replies (0)