Java 13 is Here: the Biggest Features that the Release Brings
Oracle finally introduced Java 13, thus, steadily following the recently adopted strategy “less is more”.
With Oracle’s plan to release new features every six months, the arrival of Java 13 cannot be called groundbreaking – but it was anticipated, for sure. Such a granular release strategy is aimed to facilitate the development process by offering developers easier and predictable management of the new features. In this way, developers will not have to tackle dozens of brand-new features at once but are able to digest the innovations in a steady manner with no rush.
As for Java 13, Oracle has added five new features to it which are designed to make the development process faster and more reliable.
Dynamic CDS Archives
Oracle introduced the Class Data Sharing feature in Java 5 version and it was designed to store the information about classes in the CDS archives. This data could be used by a few Java Virtual Machines and till Java 10, the archives were available for the Bootstrap Class Loader only. With Java 10 arrived the update on extending the CDS with Application Class Data Sharing and now, in version 13, we see dynamic CDS archives.
The main goal behind this update is to facilitate the development process by eliminating the need to do trial runs to determine the class lists that helped identify which classes were loaded. Now, all loaded application and library classes that are not present in the default CDS archive will be archived, with no need to run trial tests. And Oracle plans to make the archiving process completely autonomous in the future.
ZGC: return of unused storage
For better memory management, Oracle introduced the Z Garbage Collector in Java 11. Its primary goal was to shorten the time needed to clean up the heap memory.
In Java 13, the ZGC is now able to return the unused heap memory to the operating system and the pause time (between heap memory cleaning) is 1 millisecond only. This update, alongside dynamic archiving, is also aimed at speeding up the performance.
Update of legacy socket APIs
The problem with the java.net.Socket and java.net.ServerSocket APIs is that most of them consist of legacy Java or C code and thus are incredibly hard to maintain and debug.
To solve the problem, Oracle replaced the existing PlainSocketImpl with a more modern implementation called NioSocketImpl. The NioSocketImpl can be used for work with user-mode threads and is overall much simpler and easier than the outdated implementation. In addition, the newly introduced NioSocketImpl will be 100% compatible with future extensions.
Switch expressions were first introduced in Java 12 with an aim to facilitate the coding process and in Java 13, switch expressions came as a new feature in accordance with the users’ feedback.
The extended switch expressions in Java 13 allow using switch either as a statement or an expression. This update makes the coding process easier and prepares the ground for the future pattern-matching feature which is currently under development.
This update adds text blocks to the language, thus, bringing numerous benefits:
- Eliminate the need for most escape sequences
- Automatical string formatting
- Enhanced strings readability
- Support of migration from string literal
The introduction of text blocks simplifies the coding process and contributes to better development experience.
It’s great to see Oracle accurately releasing the new Java versions in accordance with the promised plan. While the updates may seem minor at first glance, they actually have a big impact on the performance and significantly ease the coding process.
As a company with rich experience in Java development, SoftTeco keeps an eye on every update. We love delivering high-quality products to our clients – and for that, we need high-quality tools for the successful realization of the most complex projects.