4 December 2019

New Classes in Java 10

New in Java 10As Java developer I used to monitor the new features of Java very closely. As Code Cop my focus on programming languages is much broader. Currently I am working with clients using C#, Java, JavaScript, Kotlin, Oracle PL/SQL, PHP, Python and TypeScript. (And I would love a few more clients using some F#, Go or Scheme.) Since version 9, Java is released much more often than it used to be and I lost track of its new features. Eventually I had to catch up. Here is the list of all new classes in Java 10. Java 10 was launched March 2018 and went EOL September 2018. While it is not relevant as a version on its own, I want to be explicit about it as it is part of 11 and all later releases.

Local-Variable Type Inference
The most interesting new feature is the var keyword, Local-Variable Type Inference. This is a compiler feature and is not visible in the public classes available in the JRE/JDK. The var causes a lot of discussions about readability of source code. I recommend checking out the Style Guidelines for Local Variable Type Inference in Java to avoid confusion.

Experimental Java-Based JIT Compiler
JEP 317 enables the Java-based JIT compiler named Graal. It comes with the jaotc command which produces native code for compiled Java methods. While this is a feature of Java 9, JEP 295, the new class jdk.tools.jaotc.Main and the packages jdk.tools.jaotc.* show up for the first time.

Other Smaller Changes
The number of new classes in Java 10 is below 50, of which 40 classes are the jaotc. The remaining are
javafx.scene.control.TabPane$TabDragPolicy

jdk.incubator.http.HttpRequest$BodyPublisher
jdk.incubator.http.HttpResponse$BodySubscriber
jdk.incubator.http.HttpResponse$MultiSubscriber

jdk.jfr.events.FileForceEvent

jdk.packager.services.singleton.SingleInstanceListener
jdk.packager.services.singleton.SingleInstanceNewActivation
jdk.packager.services.singleton.SingleInstanceService
a change to JavaFX, drag policies for tabs in a TabPane, providing Flow implementations for the experimental HTTP 2 client, something in the Oracle Flight Recorder, a commercial feature that must be unlocked before being used and Single Instance functionality for Java Packager.

This is a very small release, still Simon Ritter from Azul Systems managed to find 109 New Features In JDK 10. Check them out!

List of all public classes
You can download the complete list of all classes available in Java from version 1.0 to 10.0.2. Each class name is annotated with [release] showing the release it first appeared, e.g. java.lang.annotation.Annotation [5].

No comments: