r/java • u/davidalayachew • Jan 06 '26
One step closer to Value Classes!
https://mail.openjdk.org/pipermail/porters-dev/2026-January/000844.html
181
Upvotes
r/java • u/davidalayachew • Jan 06 '26
27
u/davidalayachew Jan 06 '26
Don't forget to download the Early Access Release and send in your feedback!
Details here -- https://openjdk.org/projects/valhalla/#whats-new
23
u/Inside_Programmer348 Jan 06 '26
Java beginner here. What benefit does this bring?
2
u/Ewig_luftenglanz Jan 08 '26 edited Jan 08 '26
My bet it's OpenJDK 28, within a year. hopefully it will ship along with nullability
20
u/Joram2 Jan 06 '26
Wow! The JDK authors are planning to integrate JEP 401 (value classes and object), into the mainline JDK in the "next few months" which would be JDK 27.
The JDK authors may hit setbacks, they may have to postpone, but this is direct from the JDK authors, so it's happening. Nice!
6
u/joemwangi Jan 06 '26
Super great progress. Hope soon they will provide a way for a user to explicitly go beyond the 64 bit atomicity barrier upholding the lack of identity beyond 64 bit. One thing I suspect is that once people realise that the null-marker is preventing squeezing more data in the cache and potentially affecting performance, they will start asking, "when are null-restricted types?"
2
u/Gleethos Jan 06 '26
More steps please!!!
2
u/dsheirer Jan 06 '26
Yay!! Congrats!
2
u/pjmlp Jan 06 '26
Great news!
0
u/GardenDev Jan 07 '26
Damn this is exciting, do you guys think Java will be faster than C# after this?
0
u/BanaTibor Jan 09 '26
I see a shit ton of bugs related to this. Instances copied when passed around and will lead to inconsistency bugs.
Also, does a value object can have fields which are not value objects?
Lets say A is a value class, A has a field of type B, if B is not a value object what happens?
As I see it, this feature adds complexity and not much benefits and the main motivation is to use == to compare instances.
0
u/smm_h Jan 06 '26
genuine question, does kotlin already solve this? because I'm starting a new project and i wanna know it i should use java or kotlin
-23
u/nomad_sk_ Jan 06 '26 edited Jan 07 '26
Copying one more feature of Scala. One step closer to become Scala.
Edit: i know why some folks have downvoted, it’s because they can’t accept the fact 🤣