Live data from Hacker News

Java 20 / JDK 20: General Availability

mail.openjdk.org

171–180 of 356 posts

Re: Java 20 / JDK 20: General Availability

#171
post #149

Earlier quoted context omitted.

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…

Big reason is security patches. But if the services are running in a VPN and don’t interact with outside world, it’s fine

My understanding is that jdk8 has support from Oracle until 2030.

Re: Java 20 / JDK 20: General Availability

#172
post #91
post #78

Earlier quoted context omitted.

IMO you're neglecting the thousands of improvements in the HotSpot runtime.

You can't use any of these thousands of improvements if your software is broken because it depended on something which was removed, or changed in incompatible ways. It can take a lot of work and time until it all works fine, even more when the breakage happened deep within a third-party library, and as far as I could see, there was a lot of these breakages early on the Java 9/10/11 cycle. IMO, it's worth it to make y…

There were some subtractions for a bunch of stuff that wasn't getting much love to begin with. They removed their JS interpreter which was based on rhino which continued being a side library the entire time that java added it to the Java runtime. The only personal break that had no remediation was a minor helper class in JMX that affected me. Pretty much anything that was removed has some library addition that can add back what was cut. Basically Java 6-8 added a bunch of library support things that were probably better maintained as a third party library to begin with. The module system usually means adding some security policy exclusions for popular libraries, but in general I get a very well performing JVM that feels like it optimizes the code significantly better than in previous generations.

Re: Java 20 / JDK 20: General Availability

#173

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").

I'm personally not so sure. We already had something like that before (M:N threads), and the world moved away from it, towards letting the kernel manage everything (1:1 threads). So I'd expect instead that operating system kernels gain whatever features are missing for scaling to a higher number of threads, and everything once again goes back to each programming language thread corresponding to one kernel thread.

Re: Java 20 / JDK 20: General Availability

#174
What are some good primers to understand the prominent new Java features? Not just in 20, but since, say, 8. Asking as someone who would like to be cursorily familiar with Java, but does not use it day to day. I'm very familiar with things like auto type inference, pattern matching, multi-line strings and structured concurrency from other languages, so I'm not looking for an introduction to Java. I'm looking for something like "Modern Java for the experienced Rust/Python/C++ programmer". Thanks!

Re: Java 20 / JDK 20: General Availability

#175
post #147
post #79

Earlier quoted context omitted.

How would it break existing code?

Because it is an expression that introduces a new keyword. You could say “return match…” It’s not easy to introduce without breakage. Not saying it cannot be done. But PHP didn’t manage to for example. It also isn’t real pattern matching but that’s a different issue.

Oh, so you were referring to the specific syntax in the current proposal, rather than pattern matching in general?

Java and C# show how the syntax can be done in a fully backwards-compatible manner. It looks like it's just not the JS way by choice - apparently every new keyword that was added since ES5 is an actual keyword reserved in all contexts, not context-dependent?

Re: Java 20 / JDK 20: General Availability

#177
post #174

What are some good primers to understand the prominent new Java features? Not just in 20, but since, say, 8. Asking as someone who would like to be cursorily familiar with Java, but does not use it day to day. I'm very familiar with things like auto type inference, pattern matching, multi-line strings and structured concurrency from other languages, so I'm not looking for an introduction to Java. I'm looking for some…

Boring answer... but Chat GPT? I asked it what was new in Java 8 and it enumerated a number of features. I could proceed to ask it about more details for each, and then continue Java version by version and I think it would be quite exhaustive.

The other day I did something similar for cell biology. As a layman I wanted to learn more about DNA, mRNA, tRNA, translation, transcription, mitosis, miosis, etc. I think I learned it much better by querying Chat GPT than say reading Wikipedia. Something about the interaction, to ask for more details on what was not clear that helped me understand it.

Re: Java 20 / JDK 20: General Availability

#178

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.

Isn’t openjdk disconnected from Oracle?

Not only that, oracle’s jdk is actually a distribution of openjdk.

Re: Java 20 / JDK 20: General Availability

#179
post #174

What are some good primers to understand the prominent new Java features? Not just in 20, but since, say, 8. Asking as someone who would like to be cursorily familiar with Java, but does not use it day to day. I'm very familiar with things like auto type inference, pattern matching, multi-line strings and structured concurrency from other languages, so I'm not looking for an introduction to Java. I'm looking for some…

You might find just browsing the JEPs will get you a long way. https://openjdk.org/jeps/0

Re: Java 20 / JDK 20: General Availability

#180
post #150

Earlier quoted context omitted.

What’ the hype with pattern matching? What does it solve?

It makes it very easy to deal with nested data structures. Imagine creating a nested map/struct literal, and then extract the values out using a very similar syntax on a single line. It's one of those things that when you get used to, you wonder why other languages don't implement it.

I think this answers the question very well, thank you. I found this [1] documentation from Ruby explain what it solves pretty good aswell.

[1] https://docs.ruby-lang.org/en/3.0/syntax/pattern_matching_rd...

Post reply on HN