Java After Eleven

Developer Advocate

Java Team at Oracle

Lots to talk about

The plan for today:

  • start with a Java 11 code base

  • take it all the way to Java 17
    (and beyond)

  • be amazed by how much changes

This talk is:

  • a showcase, not a tutorial

  • not a complete list

  • created with the lavish help
    of the people in Twitch chat

Java 11

  • released 09/2018

  • free support by Oracle ended 01/2019

  • free community support until 10/2024

  • more free and commercial support available

It’s a great release…​

  • first "modern" Java release with LTS

  • solid feature set

  • stable

  • great support

…​but better things are waiting

Java 11 misses out on many recent developments:

  • thrilling new language features

  • some improved APIs

  • a few new JVM features

  • improved performance

Curious?

Let me show you how much
you’re missing out on
if you’re (still?) on Java 11.

Code

Code, code, code, code

Java 12

What we’ve seen:

  • more powerful collections | Collectors::teeing

  • better async error handling | ↴
    CompletableFuture::exceptionallyCompose

Java 12

What we haven’t seen:

  • transforming Strings | ↴
    String.transform(Function<String, R>)

  • social media number format | ↴
    NumberFormat::getCompactNumberInstance

  • easy file comparison | Files::mismatch

  • included JDK CDS archive

Java 13

What we haven’t seen:

  • automatic application CDS archive

Java 14

What we’ve seen:

  • switch expressions | ↴

    boolean bool = switch (ternaryBool) {
    	case TRUE -> true;
    	case FALSE -> false;
    	case FILE_NOT_FOUND -> throw
    			new FileNotFoundException("🤬");
    };
  • helpful NPE messages

Java 14

What we haven’t seen:

  • JFR event streaming

Java 15

What we’ve seen:

  • text blocks | ↴

    var recommendation = """
    		{
    			"title": '$TITLE',
    			"recommendations": $RECS
    		}
    	""";
  • obvious String formatting | String::format

Java 15

What we haven’t seen:

  • hidden classes

Java 16

What we’ve seen:

  • records | record Title(String text)

  • type patterns | o instanceof Article a

  • Stream::toList

Java 16

What we haven’t seen:

  • improvements to Stream and HTTP/2 client

  • Unix domain socket support

  • OS-specific installers | jpackage

Java 17

What we’ve seen:

  • sealed clases | sealed class …​ permits

Java 17

What we haven’t seen:

  • always-strict floating-point semantics

  • enhanced pseudo-random number generators

Java Next

What we’ve seen:

  • pattern matching in switch | ↴

    return switch (post) {
    	case Article article -> article.repository();
    	case Video video -> video.repository();
    	default -> Optional.empty();
    };

Java Next

What we haven’t seen

Java 11 to 16+

  • more expressive code | LOC: 2020 📉 1594

  • faster code | run time: ~ 1.2 s 📉 ~ 1 s

  • better JVM | GCs, packaging, monitoring, etc.

Sure you don’t want to upgrade?

So long…​

37% off with
code fccparlog

bit.ly/the-jms

More

Slides at slides.nipafx.dev
⇜ Get my book!

Follow Nicolai

nipafx.dev
/nipafx

Follow Java

inside.java
/java    //    /openjdk

Image Credits