Manual on Java 11: Java experts share their best & worst experiences with Java 11
New Java release, new series! This time, we invited eight Java experts to share their best and worst experiences with Java 11, the hacks they discovered so far, their tips & tricks and more. By the time we’re done with all the parts of this series, it should look like a manual on Java 11.
Java 10 marked the beginning of a new era in the Java ecosystem but the latest release proves there are still some milestones to smash; Java 11 the first LTS release in Oracle’s new six-month cycle.
You can download Java 11 here.
Java 11 delivers 17 enhancements, including
- JEP 321 – HTTP Client (Standard), which standardizes the incubated HTTP Client API introduced in JDK 9 [via JEP 110], and updated in JDK 10.
- JEP 332 – Transport Layer Security (TLS) 1.3 is a major overhaul of the TLS protocol and provides significant security and performance improvements over previous versions.
- JEP 328 – Java Flight Recorder (JFR) provides a high-performance flight recording engine and low-overhead data collection framework for troubleshooting mission-critical Java applications.
- JEP 333 – Project ZGC can handle heaps ranging from relatively small to very large in size.
- JEP 330 – Launch Single-File Source-Code Programs simplifies the “on-ramp” or new Java users by enhancing the java launcher to run a program supplied as a single file of Java source code, including usage from within a script and/or related techniques.
Before Java 11 was released, we talked to eight Java influencers about the migration to the latest version and whether it’s a “worthy” migration milestone even if it doesn’t have “killer feature to drive adoption,” as Martin Thompson opined in the interview series. If you haven’t migrated yet, we thought you’d like to know the pros and cons of this new version.
We invited eight Java experts to share their best & worst experiences with Java 11. Since this series is meant to be a manual on Java 11, our interviewees will also talk about their first impression of Java 11, the tips and tricks, the cleverest hacks and inevitably, if they really care about Java 11 -more than they cared about Java 8, at least.
Our interviewees will share the following:
First impression of the new release
Tips & trips for “navigating” JDK 11
Cleverest hack discovered so far
How much they care about JDK 11
8 answers: What are your best & worst experiences with Java 11?
Meet the experts
+ using HTTP Client to work with non-blocking asynchronous code
+ using annotations with local variables for lambda parameters
+ the really quick turnaround integration of TLS 1.3
+ the new support for ChaCha20 and Poly1305 cryptographic algorithms
+ better startup performance than Java 9 and 10
+ String API enhancements (repeat, isBlank, strip, lines) are pretty cool
+ obsolete features are thrown overboard
+ smaller impact when upgrading
+ using the launch single-file source-code programs
+ the small change to the Predicate interface that adds the not() static method
– launching single source code programs without compilation is confusing
– has very little for programmers
– possible inconveniences for those users depending on the deprecated bits in this release
– JAXB has been removed from the JDK in JDK 11. It causes jOOQ users some extra trouble to configure when setting up jOOQ for the first time
– startup is still comparable to Java 8
Mala Gupta: Using HTTP Client to work with non-blocking asynchronous code and using annotations with local variables for lambda parameters were one of the best experience using JDK11. Experimenting with different combination of configuration values with Epsilon, a no-op GC, was super exciting. It was also challenging to replicate the values.
New Java learners (in one of my workshop), were confused with launching single source code programs without compilation. The launch didn’t work if they compiled the code by mistake or moved to multiple source code files.
Josh Long: This release has very little for me as a programmer – that is, very little has changed for me in my day to day experience writing code. Sure, being able to prefix lambda parameters with `var` just like I can already redundantly prefix them with their type is kind of nice. But, I’ve not yet needed it. I think the biggest change, as a programmer, is the new standardized reactive HTTP library. But, of course, there are already good reactive HTTP libraries in the ecosystem so this shouldn’t be seen as the main reason to upgrade.
I also like that this is an LTS release, to remove the last roadblocks for those customers hesitant to move beyond Java 8.
Those are nice features, to be sure, but not candy – nothing that’ll make my code markedly easier to read and nothing that fills a gap I can’t otherwise fill. Java 11 has a few nice goodies from the security perspective. I think the really quick turnaround integration of TLS 1.3 is amazing. TLS 1.3 was finalized in March of 2018!
The new support for ChaCha20 and Poly1305 cryptographic algorithms is a welcome addition. Good job, Java team!
Lukas Eder: After the initial trouble adding JAXB as an optional dependency for JDK 9 & 10 support, things have gotten even hairier now that JAXB has been removed from the JDK in JDK 11. While it isn’t too difficult to get dependencies right, it does cause our jOOQ users some extra trouble to configure when setting up jOOQ for the first time.
Luckily (for jOOQ), we’re not the only library that causes these problems to their users, so it doesn’t look like it’s our fault. I’m still working on the correct Maven dependency declaration for jOOQ that works on all of JDK 6 – 11.
Don’t get me wrong though. I really think JAXB shouldn’t be part of the JDK and its removal is a good thing (just like CORBA’s removal).
Best experience – Better startup performance than Java 9 and 10
Worst experience – Startup is still comparable to Java 8
Marcus Biel: First port of call is certainly the OpenJDK project page, where the 17 JEPs of the Java 11 release are listed. At first glance, Java 11 seems to offer mainly changes “under the hood” and no real developer features. However, this isn’t the case.
The String API enhancements (repeat, isBlank, strip, lines) for example, I think are pretty cool. For me, it’s often the little things that make our lives as developers easier. Up until now, we’ve had to access an external library like commons-lang for such simple things like “isBlank” – great that we can save that in the future!
Last, but not least, I think it’s always good when obsolete features are thrown overboard – like the Java EE and CORBA modules or Java Web Start.
I think it’s always good when obsolete features are thrown overboard.
Trisha Gee: The best thing is that with the 6-month release cadence, each release is small. This means:
a) much easier to see what’s in it and
b) smaller impact when upgrading.
Simon Ritter: I don’t have a worst experience, using JDK 11 has been very positive so far. Admittedly, I don’t use any of the modules removed from the core libraries (the java.se.ee aggregator module and its constituents), so my applications have just worked without any changes.
The best experience for me would be using the launch single-file source-code programs (JEP 330). The shebang support finally makes it really easy to write a simple application and not have to go through several steps to get it to execute. I also really like the small change to the Predicate interface that adds the not() static method. This aids code readability in a number of situations.
Tal Weiss: I think one of the best new features is the new standardized HTTP Client API, that’s been incubating since JDK 9. It’s undergone many changes in its implementation since JDK 9, through JDK 10, and it’s finally been standardized in JDK 11. My experience with the new API is great. It feels well written and efficient, and it’s good to finally have a standard HTTP client API in the runtime.
Now that we’ve revealed the pros and cons of Java 11, let’s focus on the other important facets of the new release. In the next parts, we will talk about the experts’ first impression of Java 11, the tips and tricks, the cleverest hacks and inevitably, if they really care about Java 11 -more than they cared about Java 8, at least.