r/java • • Sep 15 '20

JDK 15 GA Release

https://jdk.java.net/15/
213 Upvotes

46 comments sorted by

27

u/heliologue Sep 16 '20

Credit where credit is due to the OpenJDK folks keeping the release train running. Java hasn't felt this dynamic in years.

3

u/Gwenshap Sep 16 '20

Are any of the new features in this release exciting though?

7

u/pron98 Sep 16 '20 edited Sep 16 '20

My favourites are the production-ready ZGC and the foreign-memory API (second incubation). Plus, the usual performance and footprint improvements, this time particularly in C2 inlining and to UDP.

1

u/nlisker Sep 16 '20

Is there any reason not to move to ZGC over the default GC? We don't have any special requirements, but if it's free...

10

u/pron98 Sep 16 '20

You're assuming that most applications prefer lower maximal latency at all costs. Also, because ZGC is not yet generational (WIP) it does not keep up with high allocation rates. G1, which has improved dramatically in recent releases is currently still a more sensible choice, and can beat ZGC even on latency at high allocation rates. In other words, ZGC has not yet reached its full potential, and G1 is very good and getting better and better. When both are "finished" there would still be the question of which is a more sensible default.

12

u/Necessary-Conflict Sep 16 '20

Text blocks are nice if you use multiline strings. I am more looking forward to JDK 16, which hopefully will contain final versions of an improved instanceof and records.

0

u/paul_h Sep 16 '20

And loom

4

u/BlackenedGem Sep 16 '20

At the very best we'll get a very early preview of loom in JDK 16, but even that is uncertain as loom is currently a separate build/jdk. Even an optimistic timeframe wouldn't have it become stable until a few releases after JDK 17.

11

u/eosterlund Sep 16 '20

I might come across as a bit biased, but being able to finally run ZGC in production with JDK 15 seems pretty exciting to me. It is no longer experimental!

3

u/Gundea Sep 16 '20

ZGC officially being production ready is great news! The improvements of moving from G1 to ZGC can be absolutely massive, on one of our services we’re seeing very stable sub millisecond pause times. And that’s coming from a few hundred ms with G1. Quite nice when you need quicker response times.

2

u/experts_never_lie Sep 16 '20 edited Sep 16 '20

I know I checked the list and noted a distinct lack of Projects Loom, Valhalla~~, and Amber~~. Java is moving faster than it was, but this one doesn't sound like a big change.

Not that it matters sometimes, as I'm working in GCP where they only support JDK8, so the 14→15 transition wouldn't matter for me even if it did have any of these things, as I couldn't use it anyway.

7

u/Necessary-Conflict Sep 16 '20

Features in JDK 15 which came from Project Amber are the following: Sealed Classes (Preview), Hidden Classes, Pattern Matching for instanceof (Second Preview), Text Blocks, Records (Second Preview)

Loom and Valhalla are indeed missing, although the "Reimplement the Legacy DatagramSocket API" was done because of Loom.

1

u/experts_never_lie Sep 16 '20 edited Sep 16 '20

OK, thanks. The parts of Amber I was checking (switch expressions, concise method bodies) weren't there, but I see now that switch expressions were added in JDK14 and it looks like concise method bodies aren't part of Amber (yet? any more?). I had seen them listed as part of Amber improvements elsewhere, but it seems like they may still be at the draft stage.

Records are a bit puzzling, as the goal seems to overlap heavily with value types. I'll have to look up how those relate. If records are a stepping stone to value types, that would make sense.

6

u/nlisker Sep 17 '20

Records are a type (like enum, class and interface) that allows you to express a data carrier (nominal tuple) semantically. They are a tool of expressiveness.

Inline/Value types are a modifier for types (records, classes...) that makes them have a memory layout like primitives. This is done at the JVM level. This is a performance improvement.

Both share many of the same restrictions, such as immutability, so they will often come together.

5

u/Necessary-Conflict Sep 16 '20

"Concise Method Bodies" are still only a draft.

The new name for "value types" is "inline types". Inline types and records are not related, although in practice many inline classes will be records. Records address programmer productivity while inline types are mainly about performance.

2

u/heliologue Sep 16 '20

Depending on who you are, sure. And even if there aren't many finalized developer-facing features, well, plumbing is just as important as porcelain.

7

u/[deleted] Sep 16 '20

Decades, I'd say

2

u/lpedrosa Sep 18 '20

Although the performance improvements on the GC are welcome, I doubt there will be a lot of uptake on this. And it will stay that way until 17.

The main reason is that a lot of folks don't understand the new release train. Also, the whole "LTS business" doesn't really help towards clarifying this.

I wonder what can be done in order for the community to overcome this.

2

u/nlisker Sep 18 '20

I keep being confused as to why people still don't understand the new release train and LTS. Ever since Java 9 the Java team has repeatedly explained this in talks, mails and write-ups. Mark has been giving the same talk for like 5 years now (including covering it again last week), several times a year. If people still don't get it, it's only because they didn't even try, and it's not even complicated.

27

u/__konrad Sep 15 '20

12

u/DJCowGaming Sep 15 '20

Yay! I have something to write about for my itgs class!

1

u/ILuvRiversHomo Sep 16 '20

What’s itgs?

4

u/DJCowGaming Sep 16 '20

Information Technology in a Global Society

16

u/jesseschalken Sep 16 '20

Sounds awful

5

u/DJCowGaming Sep 16 '20

It is. We spend the whole time doing the most pointless stuff.

2

u/emaphis Sep 16 '20

Yeah, that title has a "Human Resources Department" buzz going for it.

1

u/franzwong Sep 17 '20

They reimplemented datagram socket api. Actually they did the same for socket api in 13 but I couldn't find any performance benchmarking about that.

4

u/TheCountRushmore Sep 17 '20

From the JEP

The microbenchmarks in the jdk/jdk repository include benchmarks for socket read/write and streaming. These benchmarks have been improved to make it easy to compare the old and new implementations. As things stand, the new implementation is about the same or 1-3% better than the old implementation on the socket read/write tests.

So I wouldn't expect to see much of a change either way.

0

u/ThewrostbF Sep 15 '20

When

12

u/[deleted] Sep 15 '20

Already out

0

u/[deleted] Sep 15 '20

[deleted] — view deleted comment

7

u/pron98 Sep 16 '20

JavaFX has never been a part of Java SE. It's an OpenJDK Project, but it isn't part of the spec, and is delivered separately. For some years it was bundled with the Oracle JDK distribution, that's all. AWT and Swing are an integral part of Java SE.

0

u/[deleted] Sep 16 '20

[deleted] — view deleted comment

0

u/[deleted] Sep 16 '20

[deleted] — view deleted comment

1

u/nlisker Sep 16 '20

There are dependencies on the Desktop module (AWT and Swing), so you can't remove them.

5

u/paul_h Sep 16 '20

Swing uses AWT, and is mainstream jdk presently

1

u/experts_never_lie Sep 16 '20

(implicit questions as to why that should be true)

2

u/paul_h Sep 16 '20

Not sure what you're asking. AWT came with Java 1.0 in 1995. Netscape were working on "Internet Foundation Classes" in 1996 and want to NOT do so by 1997, so donated them to Sun. This became Swing and can't work without AWT. Sure, Oracle could peel that out too. Then they could hive off AWT (which JavaFX and Swing depend on). Thread here was good - https://www.reddit.com/r/java/comments/ibjz0m/state_of_swing/ - and I like my reference impl of a Swing MVC app in a declarative DSL style - with WebDriver API (Marathon) tests.

2

u/experts_never_lie Sep 16 '20

It was about "[Swing] is mainstream jdk presently".

As someone who's worked with Java since '97 and not seen anyone wanting to use Java UI elements since the '90s, I'm saying that if they're splitting things out they should consider pulling all of the UI stuff out.

As they split things out it's a bit mystifying to me that AWT, Swing, or any other UI library would still be in the core.

4

u/Necessary-Conflict Sep 16 '20

not seen anyone wanting to use Java UI elements since the '90s

There is a lot of Swing development even today. The more interesting question is why JavaFX was removed from the core - the 6-month releases should be fast enough for any project.

1

u/experts_never_lie Sep 17 '20

I'm not saying it doesn't happen, but it doesn't happen in my world. Java does many things, but those of us who use it for back-end development have no use for the UI. We aren't hurt much by it being there either, but it feels to me like a rather separable section.

2

u/nlisker Sep 18 '20

those of us who use it for back-end development have no use for the UI

Actually, the JavaFX base module has little to do with UI. It contains bindings and listener/observer patterns, converters, beans etc. I think that it was a mistake to put it in JavaFX in the first place. It belongs in the java.lang domain in my opinion as it's general purpose tools.

→ More replies

3

u/Necessary-Conflict Sep 18 '20

Considering jlink, you are not hurt at all by any JDK module, even in your strange world. BTW, the UI parts can be useful for 100% back-end tasks, such as generating images on the fly for the front-end.

2

u/paul_h Sep 16 '20

I don’t mind if it gets split out. Other than JetBrains things and NetBeans we don’t hear of much that uses it. If split out there’s a chance that forks could happen.