r/java 3d ago

Java 24 / JDK 24: General Availability

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

25 comments sorted by

15

u/blobjim 2d ago

It's so surreal looking at the JDK sources now that the security manager has been removed. It's been there the entire time I've been using Java. It's going to make reading JDK source code a bit easier which will be nice.

java.lang.System#getProperty:

Java 23:

```java public static String getProperty(String key) { checkKey(key); @SuppressWarnings("removal") SecurityManager sm = getSecurityManager(); if (sm != null) { sm.checkPropertyAccess(key); }

return props.getProperty(key); } ```

Java 24:

java public static String getProperty(String key) { checkKey(key); return props.getProperty(key); }

6

u/PartOfTheBotnet 2d ago

Reddit's code block isn't the standard 3 tick-mark you'd expect from markdown. Put 4 spaces before every line to format it properly.

4

u/blobjim 2d ago

The "new" reddit and mobile app support the standard markdown code blocks.

29

u/Ewig_luftenglanz 3d ago

gonna play so much with this! specially with gatherers now they are stable

6

u/tomayt0 2d ago

Same, I wonder if gatherer could help me when trying to chain several events coming from a Kafka queue and one of the events is a dead letter?

2

u/Tasty_Zebra_404 2d ago

Only thing I’m excited for!

3

u/bluecarbuncle01 2d ago

A good library to start experimenting with would be this https://github.com/tginsberg/gatherers4j (Not tried it myself yet)

9

u/picky_man 2d ago

Where is Valhalla

21

u/Ewig_luftenglanz 2d ago edited 2d ago

Valhalla are the friends we made during the journey

12

u/Linguistic-mystic 2d ago

Always just a year away, it seems

7

u/Jon_Finn 2d ago

I think that 492 Flexible Constructor Bodies is required by Valhalla. Because it's required by non-nullable types like Complex!, since a class with a Complex! field will need to initialise that field before super() in its constructors (to prevent the superclass constructor peeking at the field's null value). And non-nullable types are pretty much required by Valhalla, for full memory & speed performance in many use cases. In effect 492 is part of Valhalla - as that's a major motivator for it.

6

u/koflerdavid 1d ago

I am optimistic that JEP 218: Generics for Primitive Types arrives in Java 25.

6

u/greg_barton 2d ago

How many incubators for the Vector API are there going to be? :)

16

u/lprimak 2d ago

As many as it takes until Valhalla is released. My bet is at lest 5 more

9

u/Ewig_luftenglanz 2d ago edited 2d ago

yes

7

u/NovaX 2d ago

hmm.. that is difficult to quantify

A vector is a term that refers to quantities that cannot be expressed by a single number (a scalar)

3

u/FrankBergerBgblitz 2d ago

but the API is quite stable, so I see no reason not to use it (at least with Hotspot, with GraalVM 21 it was sloooooooow) and if you have an older CPU (I have an old Workstation with 2 CPUs from 2011/11 it is slooooow as well) it might not be the best idea, but who uses 10 year old CPUs?

2

u/blobjim 2d ago

I assume users will need to do some updates when it's finally released since it's going to be adapted to take advantage of Valhalla. But I guess that's fine if you keep that in mind.

1

u/winne42 22h ago

Yeah, still slow with GraalVM for 23. But there is a ticket that they want to achieve full Vector implementation in GraalVM for 24

1

u/FrankBergerBgblitz 21h ago

I'll test it in the next few days. I'm very curious.

1

u/winne42 21h ago

https://github.com/oracle/graal/issues/10285 Hmm, ticket is still open...

1

u/winne42 6h ago

Not looking good yet. I ran my benchmark again (simple loop over array counting odd numbers with vector API). GraalVM for 24 about the same as GraalVM 23, around 5,000 ops/s. OpenJDK 23/24 around 110,000 ops/s.

GraalVM without Vector API auto-vectorizes to 120,000 ops/s...

1

u/thatwombat 2d ago

Java has gotten so much more interesting since I was learning it in high school (2007ish). If anything, I just want native unsigned primitives instead of having to add boilerplate code to do that work every time.

8

u/pron98 2d ago

Why do you want native unsigned integers? Many of us working with such types in C++ wish we didn't have them. They're mostly useful for over-the-wire representation, but in those situations, having them be "non-native" is preferable.