Live data from Hacker News

Java 20 / JDK 20: General Availability

mail.openjdk.org

161–170 of 356 posts

Re: Java 20 / JDK 20: General Availability

#161

Why not just use C# instead? It was purposefully designed to address and correct the many mistakes of Java, and much more importantly, it's not owned by Oracle.

Designing something with an intent is very different than succeeding in it.

Also, absolutely objectively Microsoft has orders of magnitude more control over C# than Oracle has over Java. Both Java, the language and the JVM has a specification, implemented completely independently by several companies, and the reference implementation is used as a business critical infrastructure of almost all Fortune 500 companies, many of which could single handedly continue to support and develop the platform. Meanwhile C# doesn’t have an open-source debugger..

Re: Java 20 / JDK 20: General Availability

#162
post #149

And here I am still on Java 8 :/

My codebase at work is written in Java 8, I honestly don't see what other benefits upgrading the language would bring. There's already so much business code written in the old Java 8 style (which works), don't go trying to change how the code is written now. To me Java 8 is simple and boring like Go, with some imperfections like the lack of a native map data type. I'd still upgrade for the new VM's better performance…

We migrated our codebase because multi line string literals somewhere in jdk14 made writing large SQL queries in java code so much easier.

Re: Java 20 / JDK 20: General Availability

#163
Really excited to see how virtual threads are taken up by developers, and if they affect the larger programming language community. They just really seem like "the best of both worlds" to me: the high scalability/low resource usage of async/await, with the ease-of-use experience of threads (e.g. not having to worry about "function coloring").

Re: Java 20 / JDK 20: General Availability

#164
post #75

Earlier quoted context omitted.

The same applies to Clojure CLR, right?

I haven't looked into CLR in a long time, but it feels like it has a fraction of JVM's adoption and community size. Microsoft also seems to be prioritizing Typescript and Node internally with its recent moves.

At the risk of starting a flame war, the CLI and the coreCLR are fare superior VM and platform from a technical stand point. A lot of the features schedule for jave 21 / project Valhalla are just basically catching up to modern VM design. Of course there is more to the choice of a platform than just the technical differences.

Re: Java 20 / JDK 20: General Availability

#165

This is exciting, can't wait for the LTS release next year... that said, I don't much care for the "case SomeType t when ..." pattern matching syntax, I don't see the benefit of introducing a new keyword over using "if"... or even just "&&". To pinch the example used in[1]: case Tuner t && guitar.isInTune() -> ...; and case Tuner t if guitar.isInTune() -> ...; both seem as clear as case Tuner t when guitar.isInTune()…

they want it to be as ugly as cpp

Maybe so, but please don't post unsubstantive and/or flamebait comments to Hacker News. We're trying for something different here: https://news.ycombinator.com/newsguidelines.html.

Re: Java 20 / JDK 20: General Availability

#166
post #149

And here I am still on Java 8 :/

My codebase at work is written in Java 8, I honestly don't see what other benefits upgrading the language would bring. There's already so much business code written in the old Java 8 style (which works), don't go trying to change how the code is written now. To me Java 8 is simple and boring like Go, with some imperfections like the lack of a native map data type. I'd still upgrade for the new VM's better performance…

I unfortunately encounter this mindset so much in Java programmers, and the similar "we don't need no feature X" even if the feature has proven themselves for a long time in a large amount of languages. I'm hesitant to bring it up, but I see a lot of Blub Paradox [1] among Java programmers. Heck, a lot of places disallow `var`, while over here in Kotlin-Python-Rust-C#-Typescript-Go-etc-land that's been the default since forever.

Taking this comment in good faith, the following language features from 9+ are incredibly useful for everyday programmers, you should give them a serious try before dismissing them:

- `var` local type inference

- record classes

- text blocks

- switch expressions

- sealed classes and interfaces

[1] http://paulgraham.com/avg.html

Re: Java 20 / JDK 20: General Availability

#168

Earlier quoted context omitted.

I work on Dart which is also adding pattern matching [1]. When we designed the syntax for guards, we also considered exactly these three choices before ultimately landing on "when" too. Our main reasoning was: "&&" is intuitive but it means that you can have a pattern that is immediately followed by an infix operator. That can be problematic if you ever want to make "&&" a valid pattern infix operator. And, in our ca…

Gotta say I'd've taken the if with parentheses myself. Feels like it's reusing something familiar even if they are extraneous at times.

That was my initial pitch too. But after months, almost no one seemed to have warmed up to it. When we changed it to "when", just about everyone seemed to like it better.

Syntax design is weird. Sometimes the only way to tell if I did it right is when no one says anything. People complained when I used "if". No one did after I switched it to "when".

Re: Java 20 / JDK 20: General Availability

#169

Earlier quoted context omitted.

If you've ever done any assembly programming or worked with other old or low level languages, you may have encountered an environment where you can write simple operator expressions, but you can't compose them. So this is OK: a = b + c d = e - f g = a * d But the compiler doesn't allow: g = (b + c) * (e - f) You have expressions that produce, but they don't compose. You can't produce a value from a more complex, nest…

Is Dart's pattern matching influencing the JS proposal as well? Or are both sort of separate without much influence from either side?

I have read the JS proposal many times, so it's an influence on Dart. I suspect Dart hasn't had much influence on JS because our proposal is newer.

Re: Java 20 / JDK 20: General Availability

#170
post #135

Earlier quoted context omitted.

There's very little reason not to upgrade from Java 8 at this point. Everything should be a drop-in replacement and there are significant performance benefits (garbage collection is leagues better) to doing so. The bigger problem is that a lot of places are stuck on Oracle JDK - 8u252 is the last free version so a lot of places just decided they'd never upgrade, nor do they want to look at whether Temurin or Coretto…

Almost. The Java module system (introduced in Java 9 and enforced in Java 11) still plagues companies and/or slow-to-update libraries. Particularly companies that have written a lot of their own in-house libraries and such. Custom libraries have, unfortunately over the years, picked up the bad habits (by forking/following public libraries) relying on reflection and packages that shouldn't be directly used (sun.* pack…

In the latest LTS those all can still be enabled, so while it is a serious problem when they are finally removed, for now it's not really a good reason to block an upgrade.
Post reply on HN