13 comments

  • timmg 4 hours ago
    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.

    • daviddoran 1 hour ago
      I used to love Java mostly for its batteries-included well designed standard library. Despite the verbosity of the language itself. But over time the language has really evolved a lot and gotten a lot more pleasing to the eye (in my opinion).
      • germandiago 30 minutes ago
        At some point I thought there was no way back compared to C#.

        But nowadays I see the language improved a lot, avoided async/await and added virtual threads, added records, now Valhalla, decent lambdas and tons of quality of life improvements.

        In the meantime C# became a monster of 2000 ways to declare properties init get, set, backed, not backed, stackalloc, structs, etc.

        And I know it is done for performance: but Java is still you have a value type or a reference type. That simple. And now, on top of it Valhalla.

        I think Java stayed overall more stable and simple.

        C# is still pretty good, but it is just more complicated.

    • merlindru 2 hours ago
      java the language is amazing

      the problem with it is entirely cultural. why is `IStatusChangeEntityCreationManagerFactory` everywhere?

      and why are the frameworks so huge and all encompassing? i think batteries included rails-style frameworks are great, but when i wrote Java, it didn't feel like rails at all

      none of these are language problems

      • cryptos 2 hours ago
        I know and like Java for almost 30 years now. It is amazing how carefully the language is beeing refined. For the cultural aspect, yes, that is sadly true, but I have the feeling that the culture changes. More and more developers realize that there is a better way now (e. g. records instead of dumb classes full of getters and setters). Maybe the main problem is bloated frameworks and their stickyness. The Helidon framework, for example, is a breath of fresh air compared to Spring. Go developers complaining about huge Java frameworks and boilplate could be happy with it.
        • spockz 1 hour ago
          IMHO, the main reason why Spring is huge is because it has grown organically to encompass many of the business cases/issues that one may encounter in both depth and breadth. So the http framework supports almost everything you may ever need and there is integration with every database, middleware, infra like kubernetes. (One can debate about the quality of all the lesser used modules but the main modules are pretty okay.)

          On the other hand I have used Quarkus which was great until it wasn’t because a certain http feature wasn’t supported or we needed integration with an unsupported database. In enterprise that is enough reason to just choose for the batteries included option and lift along on improvements of the main framework.

        • germandiago 26 minutes ago
          I was not aware of Helidon. Looks nice at first sight!
        • mands 2 hours ago
          +1 for Helidon (https://helidon.io/) - such a great framework, especially the SE variant. Powerful, modern, fast, modularised, and easy to understand.

          I'm back on Spring for work reasons but use it for all my side-projects.

    • DarkNova6 1 hour ago
      What I love the most is the sheer amount of thought and philosophy put into Valhalla. It transcends the binary understanding of object vs value and actually defines 4 distinct buckets:

      1: Classical Object

      2: Object without identity

      3: Atomic Value

      4: Classical Value (Tearable)

      Each bucket has clearly defined performance characteristics and semantic constraints. So depending on the nature of your data, you can always get some benefit from values even if you couldn't go all the way. This is a work of art.

    • MrBuddyCasino 3 hours ago
      Today it is a great language with a runtime that is unequaled. For heavy duty business backend server load, it is the standard choice, and rightfully so.

      Do I love Spring? No. Do I prefer Typescript for my little side projects? Yes.

      • DarkNova6 1 hour ago
        Fortunately, there are plenty of mature alternatives to Spring these days.
        • MrBuddyCasino 1 hour ago
          Agreed but apparently BigCorp hasn’t gotten the news yet.
    • Flowdalic 1 hour ago
      [dead]
  • mormegil 2 hours ago
    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-...
  • sheept 4 hours ago
    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

    • ivolimmen 2 hours ago
      I personally would never compare the two. Someone said: java to JavaScript is like car to carpet. And I completely agree with that.
      • germandiago 20 minutes ago
        Reminds me of one of C++'s talks from Andrei Alexandrescu:

        "std::allocator is to allocation what std::vector is to vexation".

        There was another transparency inside:

        "std::allocator is to allocation what alligator is to allegation".

      • kleiba2 1 hour ago
        > Someone said: java to JavaScript is like car to carpet.

        You mean the sibling who commented five minutes before you?

    • hawk_ 2 hours ago
      Java is to JavaScript what a Car is to Carpet. Very different beasts, though a lot of V8 work was inspired by Hotspot that's just because of common VM patterns not the syntax of the languages.
    • ErenayDev 1 hour ago
      > Java has long had a modern replacement for Date, while JavaScript's recently standardized Temporal API still isn't supported in Safari.

      i think Temporal API added in latest preview version of safari.

      https://webkit.org/blog/18182/release-notes-for-safari-techn...

    • Altern4tiveAcc 32 minutes ago
      The withdrawn of that proposal made me so sad. It would be amazing for JS as language, specially with certain use cases.
    • nalekberov 1 hour ago
      > 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.

      It's absolutely irrelevant to compare these two languages. Calling the former "Javascript" was just a marketing trick.

    • LoganDark 3 hours ago
      I've been annoyed too by the lack of Temporal support in Safari. It's supposedly behind a --useTemporal flag, but I've never been able to get flags to work even when launching the binary directly, and I can't find anything in developer options or feature flags settings either so like. Does it even exist at all??
      • dwaite 3 hours ago
        It is enabled by default in STP, so presumably it will launch alongside the 27 releases.

        Note Temporal was in the Ecmascript 2026 release back in March.

  • ludovicianul 3 hours ago
    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.
    • germandiago 16 minutes ago
      Rhis is the correct way to do it in enterprise environments.

      C++ gets a lotof rage for doing the same thing.

      The last thing you want in an enterprise environment is that your working code breaks and you have to commit more time to things that were working before.

  • weinzierl 5 hours ago
    If I understand this correctly then Integer becomes a value class and every instance of it loses its object identity.

    I do not have a lot of knowledge about the details but from the outset it seems like a rather bold move to me.

    • agilob 5 hours ago
      Java has a mechanism for Integer and Long objects caching using something that already looks like value object, cached objects can be compared using ==. hashCode of Integer already returns int, the boxed int value. Not much of value is lost.
      • swiftcoder 4 hours ago
        Of particular note, all 1-byte Integers are interned, there is a pool of small Integers from -127 <-> 127 which are reused whenever possible.

        I learned this the hard way, when a C++ JNI extension I was working on accidentally overwrote the pooled value for zero, and all hell broke loose...

    • josefx 4 hours ago
      Any project depending on Integer identity had years of warning that this change would come. Also given implicit primitive conversions and object pooling Integer isn't exaclty a prime candidate for object identity to begin with.
    • ivolimmen 2 hours ago
      As far as I understood this (plus future work) will make value classes work more like structs meaning it will save memory and align memory better for things like gRPC, etc.
  • swiftcoder 4 hours ago
    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
  • pregnenolone 2 hours ago
    That's great, even though specialized generics are still missing. I think these improvements will be especially beneficial for Scala, because it is such a powerful language, but abstracting on the JVM comes at a heavy price.
  • parallax_error 3 hours ago
    Really cool, shame that strings can’t be fully indistinguishable like Integer despite their immutability
    • fallingbananna 3 hours ago
      Is there a theoretical reason why they can’t?

      As a layman I would assume nothing is preventing it, other than the large amount of effort it would take to implement.

      • DarkNova6 1 hour ago
        From what I gathered the core problem is flattenability. It is backed by a dynamic array and you would need real templating to remove the indirection.
        • joe_mwangi 51 minutes ago
          They are researching to have immutable arrays. Also multifields (stack allocated arrays as fields in value classes). So, there is a possibility.
      • theanonymousone 3 hours ago
        No theoretical reason; It's backward compatibility/internal technicalities, as they mention in the JEP.
  • germandiago 6 hours ago
    2934 commits OMG... huge work.
    • andrybak 3 hours ago
      The way pull requests and commits work in the OpenJDK repository -- a bot squashes each pull request into one commit: https://github.com/openjdk/jdk/pull/31120#issuecomment-51378...

      The final singular commit is cc278db (8389219: Implement JEP 401: Value Objects (Preview), 2026-07-31) https://github.com/openjdk/jdk/commit/cc278dbb8a1ca0754d5842...

      • fulafel 3 hours ago
        Is there a writeup on why they choose to destroy the history?
        • jerven 3 hours ago
          You can recover the history using their tooling build on top of their bugtracker and GitHub. Specifically they capture the discussions and all small changes over time in their skara tools and are prepared to leave GitHub if needed. They had multi de adres experience and had multiple prior code repos. Still do if i understand as the Oracle team has the sun and bea code repositories pre openjdk preserved.
    • estebank 5 hours ago
      It's a project years in the making.
    • thibaut_barrere 4 hours ago
      Yes, massive respect for that type of perseverance on long term, important changes.
      • germandiago 35 minutes ago
        My favorite feature from Java is the same as my favorite feature from C++: pick something 10 years later or more, and it works nearly flawlessly.

        Also, now on the Java side: I think they made a great job avoiding async/await and using virtual threads. Amazing results.

        I also like all the work done around structured concurrency.

    • jurgenburgen 4 hours ago
      Seems like a horrible way to work. Why could this not have landed as a large amount of smaller PRs in a more incremental fashion, maybe Java users could have gotten some value out of it earlier.
      • DarkNova6 4 hours ago
        Out of all factors this certainly isn't it. If anything, more projects could learn from the way Valhalla was handled.

        It started out as a highly invasive, highly disruptive and highly experimental branch that eventually turned into a beautiful specification that put semantics and performance payoff first and syntax seconds.

      • krzyk 4 hours ago
        This is incremental. This change is the smallest possible one that could work. There are more coming in later.
  • HexDecOctBin 4 hours ago
    What's the latest status? Is it still limited to 63-bits of data plus 1 bit for nullability?
    • DarkNova6 4 hours ago
      Unless CPU instructions become widespread that allow to process 128 bits in one step, then yes. Java will have the same limitations as any other language. Other languages simply don't make this explicit.
      • spacechild1 3 hours ago
        IIUC value objects can have any size, it's just that 'reference flattening' requires the object to fit into a machine word. But this is only due to how Java represents object references and its atomicity guarantees.

        Naturally, a language that properly supports value semantics does not have any of these limitations.

        • DarkNova6 1 hour ago
          Java has the mantra of "Integrity by default" which means you can tear into non-integral value type with a flag.

          This is the strength of Valhalla. Instead of a binary object/value choice you have different levels of semantic guarantees that will give you better performance characteristics, depending on what your type will be able to give up.

          You can have tearability for a complex/quaternion number without problem. But if you have something such as a Range-type class, that gets more problematic because cross-field constraints can be violated.

      • Smaug123 4 hours ago
        I don’t understand this comment - the .NET CLR supports arbitrarily large value types. Are you referring to something like “atomic flattening of those types” instead? Because the CLR doesn’t guarantee that, and therefore supports flattening.
        • pwagland 3 hours ago
          That is exact problem.

          Basically JEP401 guarantees that just adding "value" to the class won't change behaviour, which also means that you are not allowed to see object tearing, which requires atomic operations on the field.

          Relaxing that would break safe publication rules, at least for Java.

        • DarkNova6 2 hours ago
          You can opt out of atomicity and make your type tearable, achiving the same performance as on any other platform.

          This is the correct default as the vast majority of developers using value types will not be aware of tearability, being taught that "value types are safe for parallel programming" without knowing nuances.

          • germandiago 10 minutes ago
            What is terability in this context? Not a Java expert but 20 years coding and did not hear of this.
      • jeroenhd 3 hours ago
        We've had MMX for a while now, I don't think we need to wait much longer.

        I don't really see why you would need specific hardware to express a type in a programming language, though.

        • jerven 3 hours ago
          Not for atomic writes, which is the important bit here. When dealing with concurrency the choice to make us will you allow tears when writing i.e. thread A writes aa and thread B writes bb. Will you allow the option of seeing ab or ba or only aa/bb. This is the thing that costs performance. Plus do you allow null which makes it harder too.
          • muvlon 18 minutes ago
            That being said, x86_64 has supported 128-bit atomic writes via cmpxchg16b for over a decade. Modern 64-bit ARM has several ways to do them as well.

            Probably still not widespread enough for OpenJDK to unconditionally assume it's supported, but I think we're getting there. (Is there "caniuse" for CPU features?)

        • DarkNova6 1 hour ago
          It's about the semantic guarantees because you don't want to introduce a parallel programming bug just because you added a field to a type. Tearability is opt in and if you are serious about performance you will make the correct choice.
        • my-next-account 3 hours ago
          It's mostly a performance question in order to adhere to Java's memory model.
          • DarkNova6 1 hour ago
            You can deliberately opt out of it though and for such a mainstream language such as Java, this just might be the sane choice.
      • HexDecOctBin 1 hour ago
        But if I don't care for object atomicity, can I get struct-like behaviour in Java for arbitrary large types?
  • ligarota 5 hours ago
  • whytevuhuni 5 hours ago
    How much of Valhalla is this? 50% of it? 90% of it?
    • pjmlp 5 hours ago
      50% maybe.

      There are other projects that depend having it in place, SIMD (vectors), reiffed generics, non nullable types.