New Features and Enhancements in Java 11
The article provides a comprehensive overview of Java 11’s new capabilities, including Unicode 10 support, the standardization of HttpClient, collection API improvements, dynamic compiler threads, advanced garbage collectors, nest‑based access control, added cryptographic algorithms, lambda‑var syntax, single‑file execution, Flight Recorder integration, removed modules, upgrade recommendations, and useful migration tools.
Java 11 is the latest long‑term support release, maintained by Oracle until 2026, and introduces a range of language and JVM enhancements.
Unicode 10 support : Java now aligns with Unicode 10, expanding the character set to 16 018 characters, 18 blocks, and 10 scripts.
HttpClient as a standard API : The incubating jdk.incubator.http package has been replaced by the standard java.net.http package, providing four core classes – HttpClient , HttpRequest , HttpResponse and WebSocket . Example usage:
HttpClient client = HttpClient.newBuilder()
.version(HttpClient.Version.HTTP_1_1)
.connectTimeout(Duration.ofSeconds(3))
.build();
HttpRequest request = HttpRequest.newBuilder()
.uri(URI.create("http://www.baidu.com"))
.build();
HttpResponse
response = client.send(request, HttpResponse.BodyHandlers.ofString());
System.out.println(response.statusCode()); // 200
System.out.println(response.body()); // HTML of Baidu homepageCollection and String API enhancements : java.util.Collection gains toArray(IntFunction) , and String adds lines() , stripLeading() , stripTrailing() , among other utilities.
Dynamic compiler threads : New JVM flag -XX:+UseDynamicNumberOfCompilerThreads allows the JIT compiler to adjust thread count based on workload, reducing CPU and memory waste.
Garbage collection improvements : The low‑pause ZGC is now production‑ready, handling heap sizes from MB to TB with sub‑10 ms pause times; the experimental Epsilon GC offers a no‑op collector.
Nest‑based access control : Classes can now share private members within a nest without synthetic accessor methods. Example:
public class NestBasedTest {
public static class Nest1 {
private int varNest1;
public void f() throws Exception {
final Nest2 nest2 = new Nest2();
// access nest2.varNest2 directly
}
}
public static class Nest2 {
private int varNest2;
}
public static void main(String[] args) throws Exception {
new Nest1().f();
}
}Cryptography updates : New algorithms such as ChaCha20, Poly1305, Curve25519, Curve448, and RSASSA‑PSS are available via Cipher.getInstance . AES‑128/256 now support Kerberos 5 encryption.
Lambda‑var support : Lambda parameters can be declared with var for type inference, e.g., list.forEach((var x) -> System.out.print(x)); .
Single‑file source execution : A *.java file can be run directly with java HelloWorld.java without prior compilation.
Flight Recorder integration : The JDK now includes the low‑overhead Flight Recorder tool for event‑based profiling and post‑mortem analysis.
Removed modules : Several legacy modules and APIs have been dropped, including AWTUtilities, Lucida fonts, appletviewer, certain sun.misc methods, and Java FX from the Oracle JDK.
Upgrade guidance : New projects should start with Oracle JDK 11; existing Java 8 projects may remain unchanged until a migration is planned, noting that third‑party libraries often drive upgrade complexity.
Migration tooling : IBM’s binary‑app‑scanner can analyze WAR files for Java 11 compatibility, generating detailed HTML reports.
Oracle vs. OpenJDK : Oracle JDK offers longer support cycles, commercial stability, and additional platform support (e.g., Solaris), while OpenJDK follows a rapid release cadence.
For further reading, see the official JDK 11 documentation, download pages, and release notes.
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.