Detailed Overview of JDK 13 New Features and Enhancements
This article reviews the latest JDK 13 enhancements—including switch‑expression optimizations, text‑block syntax, dynamic AppCDS archives, ZGC memory‑reclamation, revamped socket APIs, new FileSystems methods, bulk ByteBuffer operations, the Reiwa era in java.time, expanded Unicode support, and recent HotSpot and security updates—providing code examples and migration guidance for Java developers.
Recent JVM ecosystem surveys show that about 70% of developers still use Oracle JDK and 79% remain on Java 8, so many projects continue to run older JDK versions even though newer releases appear every six months.
1. Switch optimization updates
In JDK 11 and earlier a traditional switch statement required explicit case clauses and break statements:
switch (day) {
case MONDAY:
System.out.println(6);
break;
case TUESDAY:
System.out.println(7);
break;
// …
}JDK 12 introduced switch expressions that allow comma‑separated labels and arrow syntax, eliminating the need for break:
switch (day) {
case MONDAY, FRIDAY, SUNDAY -> System.out.println(6);
case TUESDAY -> System.out.println(7);
case THURSDAY, SATURDAY -> System.out.println(8);
// …
}JDK 13 further refines this feature with pattern‑matching capabilities.
2. Text‑block upgrades
Before JDK 13 developers built multi‑line strings by concatenating literals:
String html = "<html>" +
" <body>" +
" <p>Hello, world</p>" +
" </body>" +
"</html>";JDK 13 adds native text blocks using triple quotes, preserving line breaks and indentation:
String html = """
<html>
<body>
<p>Hello, world</p>
</body>
</html>
""";These blocks also work with SQL strings, making queries more readable.
3. Dynamic AppCDS archives
The goal is to improve the availability of Application Class‑Data Sharing (AppCDS) by removing the need for a trial run that generates a class list. The -Xshare:dump option creates a static archive that works with both built‑in and user‑defined class loaders.
4. Unused‑memory reclamation (ZGC)
JDK 13 enhances ZGC to return unused heap memory to the operating system, addressing scenarios where containers or idle applications hold onto large memory footprints. This mirrors functionality already present in G1 and Shenandoah.
5. Reimplementation of legacy socket APIs
The old java.net.Socket and java.net.ServerSocket implementations, dating back to JDK 1.0, are replaced with a simpler, modern design that is easier to maintain and better suited for Project Loom’s virtual threads.
6. New FileSystems.newFileSystem overloads
Three new overloads are added to simplify creating file‑system providers:
FileSystems.newFileSystem(Path)
FileSystems.newFileSystem(Path, Map<String,?>)
FileSystems.newFileSystem(Path, Map<String,?>, ClassLoader)These overloads avoid ambiguous method calls that previously required explicit casting. 7. New bulk ByteBuffer methods All buffer types now expose absolute bulk get and put operations that transfer a sequence of bytes without altering the buffer’s position, improving performance for low‑level I/O. 8. java.time updates – Reiwa era JDK 13 adds support for the Japanese Reiwa era (starting 2019‑05‑01). The era can be obtained via JapaneseEra.of(3) or JapaneseEra.valueOf("Reiwa") , and a public field is provided for future releases. 9. Unicode 12.1 support Java’s core libraries now include Unicode 12.1 data, adding new scripts, emoji, and the “SQUARE ERA NAME REIWA” character. Classes such as java.lang.Character , java.text.Bidi , java.text.Normalizer , and the regex engine have been updated accordingly. 10. HotSpot GC enhancements JEP 351 introduces ZGC’s ability to release unused memory, a new -XX:SoftMaxHeapSize flag, and raises the maximum heap size supported by ZGC from 4 TB to 16 TB. 11. Security library updates The system property com.sun.security.crl.readtimeout now defaults to 15 seconds, and keytool gains a -showinfo -tls option for displaying TLS configuration. The SunMSCAPI provider adds support for CNG‑format RSA and EC keys. 12. Removed features Deprecated APIs such as the pre‑JDK 1.4 SocketImpl implementation and obsolete runtime tracing methods in java.lang.Runtime have been removed. Overall, JDK 13 delivers a collection of language, library, and runtime improvements that simplify code, enhance performance, and broaden platform compatibility.
Signed-in readers can open the original source through BestHub's protected redirect.
This article has been distilled and summarized from source material, then republished for learning and reference. If you believe it infringes your rights, please contactand we will review it promptly.
Architect's Tech Stack
Java backend, microservices, distributed systems, containerized programming, and more.
How this landed with the community
Was this worth your time?
0 Comments
Thoughtful readers leave field notes, pushback, and hard-won operational detail here.
