Changes in Java 10 and 11
Contents
Introduction
JDK 11 was released almost two months ago (as of this writing), yet it almost seems as if nobody noticed it.
After the roar and thunder of Java 9's JPMS (or Jigsaw, as some may know it) it's gone awfully quiet on the Java front.
But that's far from saying nothing is happening - after Java Module System (which was about the single biggest feature in Java 9), the world moves on.
If version 9 was mostly a clean-up release with the much-hated Java Plugin and the Applet API having been deprecated, CMS GC and all garbage collector combinations involving it, as well, several rather big improvements and additions had been made to both the language and the virtual machine in the two subsequent versions, Java 10 and Java 11.
Language
Type Inference for Local Variables (v10)
Among the biggest additions to Java 10 is its ability to "guess" the type of a variable that has an initialiser, that is to say, perform LHS (left-hand-side) type inference.
RHS type inference should be quite familiar by now as it was by far the biggest change in Java 8 - Lambda Expressions for the Java Language allow us to save space, time, and improve readability, making heavy use of type inference all the time:
example here
Notice how parameter declarations in lambda lack type definitions. You can read more about this in a small write-up of mine.
In Java 10, this is extended even further. For cases when the compiler can infer the type of a variable, its declaration can be simplified to just the keyword var
:
another example here
Trololo.
Local Variable Syntax for Lambda Parameters (v11)
BLABLA
New Nest-Based Field/Method Access Control (v11)
BLABLA
Virtual Machine
Application Class Data Sharing (v10)
BLABLA
No-Op Garbage Collector (v11)
BLABLA
ZGC (v11)
BLABLA
Tools
Flight Recorder (v11)
BLABLA
Low-Impact Heap Profiling (v11)
BLABLA
Launching Single-File Programs from Source (v11)
BLABLA