I've got a few very specific use cases where I'm going to be so glad to have sealed classes[0]. Oddly not mentioned in the release notes, but they're like a final class, except you can say "These classes are allowed to be subclasses of this class".
Why is that useful? Because now you can do a switch statement that matches on type:
int getCenter(Shape shape) {
return switch (shape) {
case Circle c -> ... c.center() ...
case Rectangle r -> ... r.length() ...
case Square s -> ... s.side() ...
};
}
As long as Shape is sealed, the compiler can be confident that these are all the possible subclasses of Shape.Nice to see ZGC marked as production-ready. With Shenandoah, ZGC, and G1 the options for garbage collection in Java are so much better than they were just a couple of years ago. Even better, the need to do a bunch of brittle tuning and tweaking has mostly gone away.
Java still makes the GC work harder than other languages. In some of my testing, idiomatic "microservice" Java code makes ~10x as much garbage per request as equivalent idiomatic Go code. Some of that is the language, and some is just that libraries and frameworks are super allocation-heavy. If the ecosystem can tighten that up, then these great GCs will have even more impact.
I haven't been this excited about Java since JDK 1.2.
Especially Project Loom. Virtual threads will be a game changer. A return to original Java's rallying cry of programmer productivity.
There's always been steady progress, sure. But it seems like Oracle is much less risk adverse. Or maybe the governance changed. Or maybe Sun, IBM, other had been holding back a lot of progress. I'd love to know the backstories. To better inform future efforts.
Regardless, Java today is amazing and rapidly getting better.
/me nervously glances at all the production infrastructure I manage that's still on JDK 7 or 8.
I've just recently been able to upgrade some things to JDK 11.
> Removal of Nashorn JavaScript Engine
anybody know why a javascript engine was ever included in core java in the first place? seems... niche. and yet core java never included a simple web server (officially).
For some context--I had to look it up for myself
Release GA Date Premier Support Until
11 (LTS) September 2018 September 2023
12 (non‑LTS) March 2019 September 2019
13 (non‑LTS) September 2019 March 2020
14 (non‑LTS) March 2020 September 2020
15 (non‑LTS) September 2020 March 2021
Ref https://www.oracle.com/java/technologies/java-se-support-roa...It's pretty hard to believe that I've been writing Java now for over two decades (not continuously mind you, but I'm not currently in a gap either) and with no signs of slowing down.
I've been writing Java for longer than I've been driving, and way longer than drinking actual java. Geez. There's a certain fluency I have with this language that I don't have with any other language, not even Python/PHP/JavaScript/C#, all languages that I have 1k+ hours experience in.
Also check out Tribuo - Machine Learning library in Java announced today during the keynote : https://tribuo.org
When is the next LTS release? I'm stuck on 11 until then.
Anyone has any idea about the current state of JavaFX?
Does this include JRE? I've noticed that the OpenJDK Docker Hub images and variants have a hard time releasing the latest JRE.
I worked with Java in the past so glad NodeJS arrived and Golang.. productivity is the key.
It feels like there's a new JDK every five minutes these days
I'm so happy that we finally have multiline text blocks in Java:
It's one more step closer to scala/kotlin/etc.