State of Java, March 2021

Pavel Polívka - Mar 19 '21 - - Dev Community

As always there is a lot of talks online about Java being a dead language. In my opinion, Java is picking up steam and lately, there is so much existing stuff happening that I am first time in a long time excited about Java.

Java 16 + 17

Java 16 was released in March. Java 16 is not an LTS (long-term support) version so many people will skip on it as they are upgrading only to LTS versions (no shame in doing that).

But there are only a few JEPs targeted to Java 17 (which will be the LTS version, released in September). The biggest one being JEP 356: Enhanced Pseudo-Random Number Generators. So 16 is pretty much a very good preview of what we all be using for the next few years.

Best of 16

There is a lot of changes in Java 16. You can find the final list here.

The main two ones being JEP 395: Records and JEP 394: Pattern Matching for instanceof. There have been long writeups about both of these features.

Records

Pattern Matching

Project Loom

The most existing feature for Java on the horizon is something called Project Loom. It's an attempt to introduce lightweight concurrency to Java. Loom will introduce a new class named Fiber. This class will behave very similar to the Thread class. But the lifecycle of fibers would be managed by Java runtime, not by the kernel. In a world where applications allow million of transactions, sessions, etc... thread for every user is not feasible. Fibers would be.

There is no release date for Project Loom, but there are a few prototypes builds you can play with.
Project Loom page.

Spring Native Beta

Spring native is finally out of the alpha stage in the beta stage. What this allows you to do is using GraalVM to compile your Spring applications into a native image. Making your runtimes smaller, much more faster (almost instant startup).
These can be deployed as standalone executables (no JVM needed) or as container images, containing minimal OS layer. You can run these on serverless with Spring Cloud Function, Kubernetes, etc...

You can find more on Spring Native GitHub pages.

...

If you like what you read you can always follow me on Twitter to get more.

. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .