deniz.in

Markets

Weather

Loading weather

· via dev.to (home feed)

Java 27 makes G1 the only default GC and activates compact headers and post-quantum TLS

Java 27 shipped in September 2026 as a non-LTS release, but it flips several JDK experiments into defaults: G1 becomes the sole default GC, compact object headers turn on, and TLS 1.3 gains quantum-resistant key exchange.

Java 27 makes G1 the only default GC and activates compact headers and post-quantum TLS

A non-LTS release with defaults worth knowing

Java 27 arrived in September 2026, and according to a dev.to writeup, most production teams will skip it and stay on Java 25 LTS. But the release switches several long-running JDK experiments into defaults, and those changes signal what the next LTS will look like. The writeup highlights five JEPs in particular: G1 as the sole default garbage collector (JEP 523), compact object headers on by default (JEP 534), quantum-resistant TLS key exchange (JEP 527), pattern matching on primitives (JEP 532), and further preview rounds for Structured Concurrency, Lazy Constants and the Vector API (JEPs 533, 531 and 537).

G1 becomes the only default collector

Until now, which collector a JVM used by default depended on the machine's CPU count and memory at startup. The dev.to author demonstrates that a constrained environment, such as a one-CPU container with a 256 MB heap, could silently end up on Serial GC without anyone choosing it. On Java 27, the same command reports G1 unconditionally. Teams that deliberately relied on Serial's lower overhead for sidecar processes can still opt in with -XX:+UseSerialGC; it simply stops being a default you get without asking.

Compact headers and the rounding catch

JEP 534 shrinks object headers from 96 bits (12 bytes) to 64 bits (8 bytes) and turns the feature on by default. The JEP cites 10 to 20% less heap for typical workloads, but the dev.to benchmark argues that figure is incomplete: HotSpot rounds every object up to an 8-byte boundary, so savings only appear when the smaller header pushes an object across a boundary the standard header straddled.

The writeup measured five tiny classes with 0 to 4 int fields, 10 million instances each. A class with no fields dropped from 16 to 8 bytes per instance, a 50% saving; one int field showed no change; two ints saved 33%; three saved nothing; four saved 25%. The result is a sawtooth pattern driven entirely by alignment, and the practical advice is to re-run the measurement against your own classes before assuming the headline percentage applies. The feature was finalized as JEP 519 in JDK 25, so no experimental flag is needed anymore.

Post-quantum TLS by default

JEP 527 makes TLS 1.3 negotiate a hybrid key exchange, classical ECDHE combined with NIST-standardized ML-KEM, automatically whenever both peers support it, with zero code changes for most applications. The motivation is the "harvest now, decrypt later" threat: encrypted traffic recorded today could be decrypted once quantum hardware exists, so the defense has to ship before the threat is fully real.

The dev.to author also tested JDK 25 against a real server to show the migration story. Requesting only the X25519MLKEM768 group fails with a handshake exception, because JDK 25 does not implement the hybrid group yet. Requesting it alongside classical fallbacks like X25519 succeeds and simply negotiates down. The takeaway: list a classical group next to the post-quantum one until both ends of a connection are confirmed to support it.

Previews inch forward

The one actual language feature this cycle is pattern matching on primitives (JEP 532), now in its fifth preview. switch and instanceof can match primitive types directly with guards and no boxing, still behind --enable-preview, and the exact syntax should not be treated as locked in after five rounds of feedback.

Structured Concurrency reaches its seventh preview (JEP 533), now throwing ExecutionException instead of a custom type and renaming onTimeout() to timeout(). Lazy Constants gets a third preview (JEP 531) that adds Set.ofLazy(). The Vector API sits at its twelfth incubator round (JEP 537) with no API change, still waiting on Valhalla. The author's scalar-versus-vector dot-product benchmark measured roughly a 2x speedup with 512-bit AVX-512 vectors, far from the dramatic multiples often implied, because the kernel is memory-bandwidth-bound at that array size rather than compute-bound.

Why it matters

Even teams that never install Java 27 will meet these defaults at their next LTS jump. G1 everywhere removes a silent collector choice that could surprise constrained deployments. Compact headers change heap footprints in ways that vary with each class's shape, so capacity planning numbers may shift. Hybrid post-quantum TLS will start appearing in handshakes whether or not anyone planned for it, which makes checking peer support a real operational task. The dev.to writeup's advice is straightforward: if you are on Java 21 or 25 LTS, there is no reason to move yet. Track these features, benchmark compact headers against your own workloads, and keep preview-enabled code out of production.

  • #java
  • #jdk
  • #garbage-collection
  • #tls
  • #post-quantum-cryptography