r/java • • Sep 20 '22

Java 19 / JDK 19: General Availability

https://mail.openjdk.org/pipermail/jdk-dev/2022-September/006933.html
252 Upvotes

64 comments sorted by

View all comments

90

u/Joram2 Sep 20 '22

Congrats Java team!

  • Virtual threads delivered. They are like Goroutines but the Structured Concurrency API really makes it better. Will any of this be out of preview for the next LTS release?

  • Amber is making amazing progress. The exhaustiveness checker still needs improvement, but great job.

  • Panama looks awesome for projects that have to interop outside of the JVM

If Valhalla really delivers in Java 20 or 21 and value/primitive types provide performance improvements, that will be a home run for the Java team.

9

u/TheMode911 Sep 20 '22

Nothing has been delivered yet, everything is in preview.

Hopefully we will get something in JDK 20.

11

u/Joram2 Sep 20 '22

AFAIK, preview features are production ready, but APIs are evolving and not stable. You can use virtual threads in production Java apps now, with Java 19. Major frameworks will want to hold off until the feature is out of preview and is stable. But for small teams, evolving APIs aren't a big deal, virtual threads are ready to use.

3

u/[deleted] Sep 20 '22

You really shouldn’t use preview features in production

6

u/RupertMaddenAbbott Sep 20 '22

This is not true - preview features are not not-intended for production use. Read the JEP: https://openjdk.org/jeps/12

You have to weigh the pros/cons but a blanket ban is not right.

6

u/srdoe Sep 20 '22

It's not a blanket ban, but the JEP does say

These class files are special; they should not be distributed beyond the control of the developer who chose to use preview features.

about files you generate with --enable-preview.

Also putting preview features into production is impractical unless you control the production environment yourself, since your code will now have both a minimum and maximum JDK version of 19.

7

u/RupertMaddenAbbott Sep 20 '22

Completely agree. Preview features are not for (non-toy or non-internal) libraries or for deployments where you are not distributing your own JVM.

I think that leaves quite a substantial number of projects, especially server side applications, where this might be appropriate.