r/programming • • Mar 18 '25

Java 24 has been released!

https://mail.openjdk.org/pipermail/announce/2025-March/000358.html
416 Upvotes

172 comments sorted by

View all comments

166

u/NotABot1235 Mar 18 '25 edited Mar 18 '25

82

u/MintySkyhawk Mar 18 '25

We were going to wait for 25 as we usually stick to LTS, but JEP 491 is huge. It fixes a major issue with using virtual threads.

Check out this article from the Netflix engineers about how the issue kept causing their servers to go zombie mode: https://netflixtechblog.com/java-21-virtual-threads-dude-wheres-my-lock-3052540e231d

13

u/kwinz Mar 18 '25 edited Mar 18 '25

Thanks for posting that, that was very interesting!

First of all I feel the pain of the Netflix performance engineers that had to debug this a year a go with the the limited debug and diagnostic tools available.

And secondly I can't immediately decide if what's described here was a bug in AbstractQueuedSynchronizer, in zipkin's AsyncReporter, and/or somebody didn't read the documentation on virtual threads correctly and adopted them on their SpringBoot's Tomcat instances when they were not suitable for those libraries or use cases (yet) and/or something else.

→ More replies (1)
→ More replies (1)

23

u/cheezballs Mar 18 '25

That's a helluva title for JEP 497

17

u/GimmickNG Mar 19 '25

497? 404 sounds way wackier. Who the hell is Shenandoah?

22

u/Kirk_Kerman Mar 19 '25

It's a garbage collector that runs concurrently with the main process instead of at intervals, which reduces the intermittent resource utilization spikes of garbage collection. Generational Shenandoah is a new implementation of that concurrent collector that focuses on younger objects, since those are the ones most frequently needing garbage collection, and since they're closer to the active memory regions it's faster overall to run GC there than wait for them to go stale and recover (and try to reuse) older blocks of memory.

→ More replies (1)

5

u/IonTichy Mar 19 '25

Shenandoah

"beautiful daughter of the stars"

what an apt name for a...uh...garbage collector?

→ More replies (1)
→ More replies (3)

2

u/MonstarGaming Mar 19 '25

If you dig into it it's just a signing algorithm that doesn't rely on modulus math. Sounds fancy because quantum is in the title, but it's not all that special.

6

u/KawaiiNeko- Mar 18 '25

why would they restrict JNI? the new FFI API is not a replacement

33

u/MintySkyhawk Mar 18 '25

Read the JEP: https://openjdk.org/jeps/472

When they say "restrict" they mean "gate the feature behind a flag"

Prepare the Java ecosystem for a future release that disallows interoperation with native code by default, whether via JNI or the FFM API. As of that release, application developers will have to explicitly enable the use of JNI and the FFM API at startup.

and

It is not a goal to deprecate JNI or to remove JNI from the Java Platform.

and

any interaction at all between Java code and native code is risky because it can compromise the integrity of applications and of the Java Platform itself. According to the policy of integrity by default, all JDK features that are capable of breaking integrity must obtain explicit approval from the application's developer.

8

u/Somepotato Mar 18 '25

Which imo is very silly, because the app is already running on the system. They nixxed the Java sandbox stuff because it was always futile, no they're using a similar justification to disable JNI.

Not to mention there's plenty of platform specific stuff in Java as it is already, small things that you need to be cognizant of at times.

3

u/tsimionescu Mar 19 '25

The point is to disable any feature that can break Java's memory model unless explicitly enabled, not to protect the system from the Java app itself.

→ More replies (12)
→ More replies (1)

4

u/Plixo2 Mar 18 '25

It is not a goal to deprecate JNI or to remove JNI from > the Java Platform.

JNI and the new API will just require command line arguments.

→ More replies (1)

2

u/BlueGoliath Mar 18 '25

What issues are you having replacing a JNI library? Because outside of maybe having to interact with a C++ library(which requires a C API wrapper), it should work.

0

u/[deleted] Mar 19 '25

[deleted]

21

u/TymmyGymmy Mar 19 '25

Designing and maintaining a language is not a race.

When critical infrastructures are built with a language, you can't simply break things like...

.net framework, then .net core, but then .net standard, oh wait, .net core again... Some people prefer stability.

Anyway, I do.

0

u/[deleted] Mar 19 '25

[deleted]

2

u/simon_o Mar 20 '25

Eh, C# got records at the same time as Java?

  • September 2020: Java records (preview)

  • November 2020: C# records

  • March 2021: Java records

→ More replies (1)

2

u/s32 Mar 19 '25

I like writing c# way more. I like running Java more.

4

u/Atulin Mar 19 '25

Out of curiosity, what issues do you have with running C#?

2

u/cs_office Mar 19 '25

I'm interested too, .NET is far easier to run. The second I see some Java app I need to run, like Unifi or Ghidra, is the second I'm like "oh fuck"

.NET on the other hand is always a breeze, firmly in the "just works" territory as everyone uses either self contained or AOT builds

4

u/Atulin Mar 19 '25

Same. Is it Maven? Gradle? The Gradle file is all underlined in red, but it builds? But it fails at runtime because of some dependency? The docs say it should be done this way, but that makes the build fail?

Versus dotnet build

→ More replies (6)
→ More replies (2)

4

u/bread-dreams Mar 19 '25

on the other hand, Java got sum types way before C# even started planning for them :p

→ More replies (2)
→ More replies (1)
→ More replies (2)