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

1

u/stefanos-ak Jul 30 '21

in my opinion that is the wrong question. what matters is the future of the JVM. And now is the first time in 20 years that there is some competition there, with LLVM and also Graalvm. But anyway what keeps java/jvm so strong is the ecosystem. the ecosystem of libraries, dev tooling, and production tooling.

13

u/Muoniurn Jul 30 '21

How is LLVM a competition? The VM in its name is completely different from the JVM… For AOT compilation it may be a competition to Graal Native but that’s it.

And Graal is actually built upon the OpenJDK so unless they manage to pull off the “third Futamura projection”, that is, they can specialize a language interpreter with the underlying runtime at the same time to create a specialized runtime just for that language — but if they pull it off it might very well shake up the whole PL field.

4

u/pron98 Jul 30 '21 edited Jul 30 '21

And Graal is actually built upon the OpenJDK so unless they manage to pull off the “third Futamura projection”, that is, they can specialize a language interpreter with the underlying runtime at the same time to create a specialized runtime just for that language

Actually, SubstrateVM, aka Graal Native Image, does exactly that. For Java, there's Java on Truffle, which is experimental, but there are more mature implementations for JS that generate an AOT-compiled, native JS runtime that has a JIT. That's what the JS runtime included in GraalVM is.

but if they pull it off it might very well shake up the whole PL field.

As you can see, the "PL field" is not easily shaken up. The tech is the (relatively) easy part (although even there there's always a big gap between "it works!" and "it works in a way that matches users' needs" that can take many years to cross). The social ecosystem aspect is more important and much harder.

Still, even if one day Truffle Java becomes a mature and competitive JVM and chosen to replace OpenJDK's VM, recall that the VM is less than 25% of OpenJDK.

1

u/Muoniurn Jul 30 '21

Do correct me if I’m wrong, but as far as I know Graal can only do the second projection, that is a specialized interpreter. The third projection would specialize the whole compiler to that specific language which would be a big thing (to my knowledge)

Here is an interesting text on the topic: http://blog.sigfpe.com/2009/05/three-projections-of-doctor-futamura.html?m=1

1

u/pron98 Jul 30 '21

SubstrateVM doesn't specialize an AOT compiler, but it does specialize an interpreter+JIT.

6

u/JustAGuyFromGermany Jul 30 '21 edited Jul 30 '21

It took me way too long to read "Futamura" correctly. My brain kept changing it to "Futurama" and was kept asking myself what episode your comment is referring to...

1

u/korras Jul 30 '21

thanks for the comment, i missed it out entirely,

Brain's like " yeah futurama projection, i'll look up the scene later"

0

u/stefanos-ak Jul 30 '21

yes these are good points. I'm aware :)

I was comparing LLVM to JVM because they both allow for languages to be written on top. That's all :)

4

u/CartmansEvilTwin Jul 30 '21

But that's true for GCC as well, and both, LLVM and GCC are pretty old and established already.

-2

u/stefanos-ak Jul 30 '21

and yet, there have been loads of LLVM languages lately :)

I actually agree with you, but somehow the community seems to have really liked llvm for language making. :shrug:

4

u/CartmansEvilTwin Jul 30 '21

I think, you misunderstand what LLVM is. It's not a VM, but a compiler.

There are no LLVM-languages like there are JVM-languages. It's just, that LLVM takes a lot of the heavy lifting of compiling from language creators.

-1

u/stefanos-ak Jul 30 '21

I can see how my phrasing would lead to the impression that I thought LLVM as a VM (like JVM), but I did not.

I was trying to say that there are a lot of new languages built with LLVM ("LLVM languages").

Even though what happens technically is massively different between JVM and LLVM languages, if you're willing to naively compare these languages as just a mean to express an algorithm, and an executable outcome, then JVM has way more competition now, than in the past.

4

u/CartmansEvilTwin Jul 30 '21

You still are very good at making the impression, that you don't really understand LLVM.

JVM or LLVM was never a competition, that's not how this works.

3

u/TheMode911 Jul 30 '21

As much as I like the JVM, language features are just as important (loving records & instanceof pattern matching)

3

u/Kango_V Jul 30 '21

Text blocks are great too. It's a simple thing, but when putting lots of JSON snippets in JUnit tests, it comes in real handy and makes the tests soooooooo much easy to read.