Would you be interested in knowing what are the new interesting features in Java 10? Would you also like to know Application Class Data Sharing, Java JIT Compiler, Time based release? If so, then you reached the right place. In this article, we will understand new features in Java 10 language.
Java 10 features
Java 10 is the fastest feature release of a Java SE platform. Features contain various enhancements into many functional areas such as garbage collection and compilation as well as local variable types.
ü Local-Variable Type Inference
ü Application Class-Data Sharing
ü Consolidate the JDK Forest into a Single Repository
ü Garbage-Collector Interface
ü Parallel Full GC for G1
ü Thread-Local Handshakes
ü Remove the Native-Header Generation Tool (javah)
ü Additional Unicode Language-Tag Extensions
ü Heap Allocation on Alternative Memory Devices
ü Experimental Java-Based JIT Compiler
ü Root Certificates
ü Time-Based Release Versioning
1. Local Variable Type Inference
Java now allows var style declarations. We can declare a local variable without specifying its type. The type will be inferred from context i.e from the type of actual object created.
var str = “Welcome to Java 10";
String str = " Welcome to Java 10";
In first the statement, type of str is determined by the type of assignment which of String type.
2. Application Data-Class Sharing:
The main goal of this feature is to improve startup and footprint, extend the existing Class-Data Sharing ("CDS") feature to allow application classes to be placed in the shared archive.
-It reduces the footprint by sharing common class metadata across different Java processes.
-Improves start-up time.
-Application Class-Data Sharing allows the built-in system class loader, the built-in platform class loader, and custom class loaders to load archived classes.
3. Consolidate the JDK Forest into a Single Repository.
This feature is all about housekeeping. It combines the numerous repositories of the JDK forest into a single repository to simplify the development.
4. Garbage-Collector Interface.
It introduces common Garbage Collector Interface, by using this we can improve the code isolation. It allows alternative collectors to be quickly and easily integrated. The main goal is to provide better modularity for HotSpot internal GC code.
5. Parallel Full GC for G1.
This feature of Java 10 improves G1 worst-case latencies by making the full GC parallel.
The current implementation of the full GC for G1 uses a single-threaded mark-sweep-compact algorithm.
6. Thread-Local Handshakes.
It improves performance. While the java thread is in a savepoint safe state, a handshake operation is executed for each Java Thread. While keeping the thread in a blocked state the callback is executed either by the thread itself or by the VM thread.
7. Remove the Native-Header Generation Tool (javah)
It focuses on housekeeping. This feature removes javah tool from JDK. This practicality provides the flexibility to put in writing native header files at the time that Java source code is compiled, thereby eliminating the necessity for a separate tool.
8. Additional Unicode Language-Tag Extensions.
This feature enhances java.util.Locale and related APIs to implement extra Unicode extensions of BCP 47 language tags. This JEP will implement a lot of the extensions laid out in the newest LDML specification, within the relevant JDK classes.
This feature will add support for the following additional extensions:
i. cu (currency type)
ii. fw (first day of the week)
iii. rg (region override)
iv. tz (time zone)
9. Heap Allocation on Alternative Memory Devices
This feature enhances the potential of HotSpot VM to portion the Java object heap on an alternate device, like NV-DIMM, nominative by the user.
For example, with this feature, it is possible to assign lower priority processes to use the NV-DIMM memory, and instead, only allocate the processes which have a higher priority to the DRAM in a multi-JVM environment.
10. Experimental Java-Based JIT Compiler
It enables Graal, to be used as an experimental JIT compiler on the Linux/x64 platform. Graal is basically a new JIT compiler for java, which is the basis of Ahead-of-Time (AOT) compiler.
11. Root Certificates
This feature provides root Certification Authority (CA) certificates in the JDK.
This helps to promote OpenJDK and make it more effective to community users. The aim of this feature is to reduce the difference between the OpenJDK and Oracle JDK builds.
12. Time-Based Release Versioning
Unlike the old releases, the new time-based releases won’t be delayed and features will be released every six months. There are also Long Term Releases (LTS). It is mainly for enterprise customers.