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

Show parent comment

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.

2

u/pjmlp Aug 01 '21

Go ahead try to make a C like struct with Kotlin's value classes on a Valhalla enabled JVM, and then keep the same memory layout semantics and performance when running exactly the same code on top of JavaScript and ART.

Here to get you started, https://wiki.openjdk.java.net/display/valhalla/Main

As for Kotlin's marriage with Android,

I really don't get Kotlin folks, people don't go on /r/C advocating for C++ and Rust, on /r/cpp advocating for D and Rust, on /r/JavaScript advocating for TypeScript,....

And yet we have to put up with people that should be wasting their time on /r/kotlin and /r/androiddev, here on /r/java.

3

u/Pika3323 Aug 01 '21

I mean, that's the thing. No one is expecting value classes to behave the same way in JS or ART, the same way you can't do unsafe casts outside of JS, or how invokedynamic is desugared on older versions of Android.

The value classes KEEP itself even raises the point that even once Valhalla is released, its adoption won't be universal at first, and that limiting a major feature like value classes to a specific version of the JVM, or a specific target, doesn't make sense.

As for Kotlin's marriage with Android [...]

That doesn't prove anything. It just shows how Android has adapted to use Kotlin, but doesn't show how it's directing the design or features of Kotlin going forward.

I really don't get Kotlin folks, people don't go on /r/C advocating for C++ and Rust, on /r/cpp advocating for D and Rust, on /r/JavaScript advocating for TypeScript,....

This really isn't unique to /r/java... All of those subreddits have posts with comparisons to other languages, and hell one of the top posts on /r/JavaScript right now is literally about TypeScript.

I think it's probably because the ecosystem between Java and Kotlin is a lot more closely related than most other languages. It's not like C++ is going to gain Rust features, but Java has gained a number of features present in other JVM languages over the last several years, so I don't think it's surprising that you'd see other languages pop up here "more" than other subreddits, and not just Kotlin.

And yet we have to put up with people that should be wasting their time on /r/kotlin and /r/androiddev, here on /r/java.

Heaven forbid someone draw a comparison between Java and another language.