JEP 401 Value Objects Preview Merged to OpenJDK Master

JEP 401: Value Objects (Preview) merged to OpenJDK master

JEP 401 Value Objects Preview Merged to OpenJDK Master

I am pleased to announce the integration of the first preview for JEP 401, Value Objects, into the OpenJDK master branch. This significant update also includes JEP 539, Strict Field Initialization, which is essential for the new feature. The implementation spans the Java language, JVM, and standard library, involving over two thousand commits. Reviewers are encouraged to direct feedback to specific sub-review pull requests to manage the scale of this change effectively.

Comments and review for a change this large will not scale well in a single pull request.
  1. timmg

    I feel lonely in that: I mostly love Java as a language.

    The lack of value types is the biggest impediment to certain types of performance. I am really looking forward to this evolution of the language.

  2. mormegil

    I think it is important to understand what this does and does not cover. This is “only the first part of Valhalla”. See e.g. a good summary at https://www.jvm-weekly.com/p/project-valhalla-explained-how-...

  3. exabrial

    Modern Java friggen rocks. I honestly cannot understand why you would use anything but the OG these days!

  4. ludovicianul

    I'm always amazed by how much thinking and work the Java leads put in rolling out changes that move the language forward, but make it backward compatible as much as possible.

  5. kuhsaft

    Previous HN discussion on project Valhalla: https://news.ycombinator.com/item?id=48595511

  6. ivanjermakov

    > Generic types such as List<T> and Comparable<T> can be instantiated with value classes as the type arguments.

    > JEP 218, Generics over Primitive Types (with revisions), will allow generic classes and methods to specialize field, array, and local variable layouts when parameterized by value class types.

    Ok now this is cool! JVM needs more ways to use compile time known value sizes for better memory allocation and optimizations.

  7. swiftcoder

    It's really nice to see movement here finally. Lack of value types has been one of the biggest performance pitfalls in Java for decades at this point

  8. sheept

    It's pretty interesting that while both languages still receive new features, Java seems to stay ahead of JavaScript:

    - Java has long had a modern replacement for Date, while JavaScript's recently standardized Temporal API still isn't supported in Safari.

    - Java has switch expressions, while JavaScript, despite its Scheme influence, does not.

    - And now Java is getting value objects, while JavaScript's equivalent tuples & records proposal has been withdrawn.[0]

    JavaScript was not developed as a fork of Java, but much of its basic syntax still resembles Java, so I think it's fair to compare them.

    [0]: https://github.com/tc39/proposal-record-tuple

More from this day

2026-07-31