Overview of New features in Java 10
Java 10 has been released on 20th March 2018. With this release Java has now moved to a 6 month release cadence. I.e. every six months there will be a new Java release containing all the features which have been planned for that release and were completed in time1 for that release. Let's take a look at the important new features introduced in Java 10. Prominent new features in Java 10
- Local Variable Type Inference - This is one of the most significant and widely awaited changes in JDK 10. Java now supports local variable declaration using the keyword
var. The type of this variable, instead of being declared explicitly, will instead be inferred from the value assigned to the variable.
- Garbage Collector Interface - This change defines a garbage collector interface to improve the source code isolation of existing garbage collectors.
- Parallel Full GC for G1 - G1 garbage collector was made the default from JDK 9. This feature has been added to improve worst-case latencies of G1 by making full GC parallel.
- Consolidation of the JDK Forest into a Single Repository - This change is more relevant to open source contributors who work with the actual code running the JDK implementation. Until JDK 10, there were 8 Mercurial repositories holding JDK code viz.root, corba, hotspot, jaxp, jaxws, jdk, langtools, and nashorn. A commit across multiple repositories cannot be done in an atomic manner. JDK 10 solves this issue by bringing all these repositories' code in a single consolidated code repository to allow atomic commits across entire code.
- Application Class-Data Sharing - This feature extends the existing Class Data Sharing (CDS) to allow application classes to be stored in a shared archive. This change provides the benefits such as lower memory footprint and reduced startup times.
- Remove the Native-Header Generation Tool (javah) - javah tool used for native header generation before JDK 8 has been removed. From JDK 8, native headers can be generated by passing -h argument to the javac command which generates headers for classes annotated with java.lang.annotation.Native annotation.
- Additional Unicode Language-Tag Extensions - This feature adds additional Unicode extensions of BCP 47 to java.util.Locale and related APIs.
- Heap Allocation on Alternative Memory Devices - With newer and cheaper memory type NV-DIMM, upcoming system designs can have multiple memory types onboard. This features enables the HotSpot VM to allow Java object heap on user specified memory devices like the NV-DIMM.
- Experimental Java-Based JIT Compiler - With this new feature, Graal(Java-based JIT Compiler) can be used as an experimental JIT compiler on Linux/x64 systems.
- Root Certificates - JDK's security certificates are stored in cacerts keystore. Before JDK 10, the default cacert keystore used to be empty. With this feature a default set of root Certification Authority certificates will be provided in the JDK. This will in turn allow critical security components(like TLS) to work out of the box in JDK builds.
- Time-Based Release Versioning - With six-month release cadence being adopted for JDK releases from JDK 10 onwards, this JEP(Java Enhancement Proposal) defines specific version numbering scheme to correctly specify the JDK 6-monthly feature release version along with various interim, update and patch release which may take place under that feature release.
- Thread-Local Handshakes - With this feature JDK 10 allows executing a callback on a thread without performing a global VM safepoint. It allows stopping of individual threads in a cost effective manner instead of having to stop all threads.