Life Beyond Java 8
New versions of Java are coming out every 6 months now. What has changed, should we upgrade, and if so, how?
(Updated 3 Dec, 2020)
Abstract
Wasn’t Java 8 a fantastic update to the language? Lambdas and streams were a huge change and have helped to improve Java developers’ productivity and introduce some functional ideas to the language. Then came Java 9… and although the module system is really interesting for certain types of applications, the lack of exciting language features and uncertainty around how painful it might be to migrate to Java 9 left many applications taking a wait-and-see approach, happy with Java 8.
But now Java has a new version every six months, and suddenly Java 15 is here. We’re all still on Java 8, wondering whether we should move to a later version, which one to choose, and how painful it might be to upgrade.
In this session we’ll look at:
- Why upgrade from Java 8, including language features from Java 9-15
- What sorts of issues might we run into if we do choose to upgrade
- How the support and license changes that came in with Java 11 might impact us.
Videos
There are a few versions of this.
Other versions:
- June 2020, J-Spring Digital, updated with a summary of Java 15 upcoming features
- May 2020, Silicon Brighton online, face-paced 30 min version
- June 2019, GOTO Amsterdam, most comprehensive coverage of the license and support changes
- May 2019, from DevoxxUK
- March 2019, QCon London, which contains a transcript
Related video:
- Modern Java with IntelliJ IDEA - 30 min video
Slides
Resources
More Information
- Upgrading from Java 8 to Java 12
- Beyond Java 8
- Reasons to move to Java 11 from Microsoft, of all people!
- A Picture of Java in 2020
Updates, Licenses and Support
- Update and FAQ on the Java SE Release Cadence
- Java Champions: Java Is Still Free - long and very detailed document explaining the changes in licenses and support
- Oracle: Oracle JDK Releases for Java 11 and Later - what are the changes to the license; why there are two Oracle JDK builds; is an OpenJDK build the same as an Oracle JDK build.
- JetBrains: Using Java 11 In Production: Important Things To Know
- Red Hat: The future of Java and OpenJDK updates without Oracle support - “…our policy of always “upstream first” implies that OpenJDK 8 will continue to be updated for critical bugs and security fixes until then. Something similar will happen for JDK 11.”
- Azul: Updated Choices For Java Updates - Azul’s summary of options
- IBM: Supporting the Java Community
Where to get your JDK from
- Time to look beyond Oracle’s JDK - a good explanation of what different JDKs are provided and how they differ.
- AdoptOpenJDK
- Download prebuilt OpenJDK binaries - “AdoptOpenJDK provides prebuilt OpenJDK binaries from a fully open source set of build scripts and infrastructure.”
- AdoptOpenJDK Support
- Unofficial list of JDK distributions
- For more options see the Binary Distribution Summary section of the Java Is Still Free document.
Migrating from Java 8
- Upgrading from Java 8 to Java 12
- My video course on Moving to Java 9 is available on Safari or can be purchased via InformIT. This has details about the features from Java 9 that are most interesting to Java developers, and a guide on how to migrate to Java 9. Of course, this is still valid even when migrating to Java 11, although there may be one or two additional gotchas now.
- I wrote something for Oracle’s Java Magazine on Migrating from Java 8 to Java 9
- And I wrote a related piece for InfoQ on Painlessly Migrating to Java Jigsaw Modules - a Case Study
- Java SE Oracle JDK 9 Migration Guide - Oracle’s guide
- All You Need To Know For Migrating To Java 11 - an in depth guide
- From Java 8 to Java 11 - some pointers
- Migrate Maven Projects to Java 11 - specific help for Maven. Includes some Java 9 Magic Incantations in the POM file that you might need.
- Migrating Spring Boot Applications to Java 11 - a case study
- It’s time! Migrating to Java 11 - a case study
Features
Java 15
- All JDK 15 JEPs
- JEP 378: Text Blocks (Standard)
- JEP 375: Pattern Matching for instanceof (Second Preview)
- JEP 384: Records (Second Preview)
- JEP 360: Sealed Types (Preview)
- JEP 371: Hidden Classes
- JEP 377: ZGC: A Scalable Low-Latency Garbage Collector (Production)
Java 14
- All JDK 14 JEPs
- Java 14 and IntelliJ IDEA - (blog post with video) covers Records, Pattern matching for instanceof, and covers the updates to text blocks and switch expressions
- JEP 358: Helpful NullPointerExceptions
- JEP 361: Switch Expressions (Standard)
- JEP 368: Text Blocks (Second Preview)
- JEP 359: Records (Preview)
- JEP 305: Pattern Matching for instanceof (Preview)
- JEP 364: ZGC on macOS (Experimental) and JEP 365: ZGC on Windows (Experimental)
Java 13
- All JDK 13 JEPs
- Java 13 and IntelliJ IDEA - (blog post with video) covers Text Blocks, and mentions the changes to Switch Expressions since Java 12.
- JEP 351: ZGC: Uncommit Unused Memory (Experimental)
Java 12
- All JDK 12 JEPs - includes several related to Garbage Collection
- Java 12 and IntelliJ IDEA - how IntelliJ IDEA can help you with the new switch expression syntax (available in IntelliJ IDEA 2019.1 and later)
Java 11
- Introduction to the Java HTTP Client
- Java 11 HTTP/2 API Tutorial
- Reactive HTTP/2 Requests And Responses In Java 11
- Scripting Java 11, Shebang And All
- Eleven Hidden Gems In Java 11 - for me, it’s the tiny API changes that make my life as a developer easier
- Java 11 String API Additions
- Java’s new Z Garbage Collector (ZGC) is very exciting - “ZGC’s design targets a future where these kinds of capacities are common: multi-terabyte heaps with low (<10ms) pause times and impact on overall application performance (<15% on throughput).”
- Java 11 and IntelliJ IDEA
- Predicate::not
Java 10
- Java 10: Local-variable type inference
- Webinar: IntelliJ IDEA and Java 10 - video and follow up blog post discussing the best places to use
var
- Collecting to immutable collections from a Stream operation
Java 9
- Real World Java 9 - a presentation I was giving in 2017 about Java 9 features
- JEP 261: The Java Platform Module System
- Modules: Quick Start Tutorial
- Convenience Factory Methods for Collections
- jlink Reference Documentation
- Java 9 jlink Explained in 5 Minutes
- Java 9’s other new enhancements, Part 2: Milling Project Coin
- Reactive Programming with JDK 9 Flow API
- JEP 238: Multi-Release JAR Files
- Creating Multi-Release JAR Files in IntelliJ IDEA
- JEP 259: Stack-Walking API
- Deep Dive into the Stack-Walking API
- JEP 102: Process API
- JShell User’s Guide
- More methods on Optional
- Java 9 and IntelliJ IDEA
Java Future
Java 16
- All JDK 16 JEPs
- Pattern Matching for instanceof (standard)
- Records (standard)
- Sealed Classes (Second Preview)
Further into the future
- JEP 302: Lambda Leftovers (including underscore for param)
- Project Amber - “The goal of Project Amber is to explore and incubate smaller, productivity-oriented Java language features”
- Valhalla - Includes Value Types
- Loom - Fibers, Continuations and Tail-Calls for the JVM
- Proposed New Project: Leyden
Performance
- Java 11: JEP 331: Low-Overhead Heap Profiling
- How much faster is Java 11? - a case study that benchmarks both G1 GC and Parallel GC
- OpenJDK Startup From 8 Through 11
- Performance After Eight (video)
- Improving G1 out-of-the-box performance
Garbage Collectors
- Java 9: JEP 248: G1 the Default Garbage Collector
- Java 10: JEP 307: Parallel Full GC for G1
- Java 10: Improvements to Garbage Collection explained in 5 minutes
- Java 11: FYI: Changes to Garbage Collection in JDK11
- Java 11: JEP 318: Epsilon: A No-Op Garbage Collector (Experimental)
- Java 11: JEP 333: ZGC: A Scalable Low-Latency Garbage Collector (Experimental), see also ZGC Wiki
- Java 12: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental), see also Shenandoah GC Wiki
- Java 12: More Updates to G1
- Java 13: JEP 351: ZGC: Uncommit Unused Memory
- Java 14: JEP 364: ZGC on macOS (Experimental) and JEP 365: ZGC on Windows (Experimental)
- Java 14: JEP 363: Remove the Concurrent Mark Sweep (CMS) Garbage Collector
- Java 15: JEP 377: ZGC: A Scalable Low-Latency Garbage Collector (Production)
- Java 15: JEP 379: Shenandoah: A Low-Pause-Time Garbage Collector (Production)
- New Java Garbage Collectors
String Performance
- Java 9: JEP 254: Compact Strings
- Compact Strings in Java 9
- Java 9: JEP 280: Indify String Concatenation
- Evolution of Strings in Java to Compact Strings and Indify String Concatenation