Hi, this is @chan_kaku! This time, I will explain the APIs and functions added in Java 9 to 11 for those who are thinking about migrating from Java 8 to Java 11.
Java9 Please refer to here for new features of Java9.
In Java 9, there was a project called Project Jigsaw. Details can be found at the link below About Project Jigsaw In other words, the following four points were the goals of this project
Make it easier for developers to construct and maintain libraries and large applications
Facilitates maintenance of libraries and large applications
Improve the security and maintainability of Java SE Platform Implementations in general, and the JDK in particular
Improved security and maintainability of the Java SE platform
Enable improved application performance
Improved application performance
Enable the Java SE Platform, and the JDK, to scale down for use in small computing devices and dense cloud deployments.
Java SE platform and JDK can be scaled down for use in low-performance computing devices and dense cloud deployments
To solve these problems, Java 9 introduced a modular system.
The module system is explained in detail in Around here.
In other words, when using the public and protected members of another module (library), or when using the public and protected members for another module, it is necessary to prepare a file called module-info.java. This module system makes it easier to understand module dependencies and hierarchies than ever before.
Java10 The new features of Java 10 are summarized in here. I will pick up the functions that I personally care about
JEP 286: Local-Variable Type Inference
This is a type inference function for local variables
var list = new ArrayList<String>(); // infers ArrayList<String> var stream = list.stream(); // infers Stream<String>
In Java, if you use this var for anything, you will not know the type well, so I do not have the impression that you use it so often, but you can use it if the type is specified on the right side as described above. Isn't it?
Java11 As usual, the new features of Java 11 are summarized in here. I would like to pick up some of them.
JEP 181: Nest-Based Access Control
It is described here that the private access of the nested mate is restricted as the access rule of the JVM. By the way, the nested mate that came out here is defined as follows
A field or method R is accessible to a class or interface D if and only if any of thefollowing conditions are true: ・ R is private and is declared in a different class or interface C, and C and D, are nestmates.
This is the same for the user, but when I use bytecode, I read a method that I didn't understand until now, and now it's what I intended. It's like that
JEP 321: HTTP Client (Standard)
This is said to support Modan APi, HTTP2, WebSocket, Reactive.
JEP 323: Local-Variable Syntax for Lambda Parameters
This says that type inference, which was also explained in Java 10, can now be used as a parameter for lambda expressions.
Various features have been added in Java 9 ~ 11, but personally, I have the impression that it's okay if you hold down the areas introduced here. If you don't know about this feature, please comment!