skip to content

What is new in JDK 26 and JDK 27, and which Java features are still preview or incubating at 27?

level: middleimportance: should knowfreq 38%

answer

  1. two releases, no new final language feature
  2. opt-in protocol, warning on final
  3. defaults changed at 27
  4. five features still not final
  5. StableValue changed its name

basics

~20 s

JDK 26 added opt-in HTTP/3, warns when reflection mutates ordinary final instance fields, and removed the Applet API; JDK 27 always defaults to G1 and compact object headers. Structured concurrency, lazy constants, primitive patterns and PEM stay preview; the Vector API stays incubating.

solid answer

~40 s

JDK 26 and 27 changed the platform more than the language: neither made a language feature final. JDK 26 adds HTTP/3 to `java.net.http` as an opt-in, warns when deep reflection mutates a final instance field of an ordinary class, and removes the Applet API and `Thread.stop()`. JDK 27 changes defaults too, most visibly two: the JVM always selects G1 when no collector is named, where 25 could select Serial on small machines, and compact object headers are on, where 25 has them off. Five features are still not final at 27: structured concurrency, lazy constants, primitive types in patterns and PEM encodings are previews needing `--enable-preview`, and the Vector API is an incubator module. Both releases follow the Java 25 LTS and are not LTS themselves.

code

java · 21 lines
java
import java.net.http.HttpClient;
import java.util.Comparator;
import java.util.UUID;

public class Jdk27Additions {
    public static void main(String[] args) {
        HttpClient http3 = HttpClient.newBuilder()
                .version(HttpClient.Version.HTTP_3)      // JDK 26
                .build();
        System.out.println(http3.version());
        System.out.println(HttpClient.newHttpClient().version());

        Comparator<String> byLength = Comparator.comparingInt(String::length);
        System.out.println(byLength.max("kiwi", "banana"));  // JDK 26

        UUID id = UUID.ofEpochMillis(System.currentTimeMillis());  // JDK 26
        System.out.println(id.version());

        System.out.println(Math.asinh(0.0));             // JDK 27
    }
}

go deeper

for a junior

Recall that HTTP/3 arrived at 26, that at 27 G1 became the default everywhere and compact object headers the default, and that structured concurrency, lazy constants and the Vector API are still not final.

for a middle

Explain each default and how to override it, how the same JVM behaves at 25 and at 27, and which features at 27 are previews and which is incubating.

for a senior

Show what an upgrade from 25 changes in production without code changes: collector selection in small containers, heap use with smaller headers, removed launcher options, and warnings that predict failures in a later release.

for a principal

Decide whether a service should follow non-LTS releases at all, and set a rule for preview features: where they are allowed, who owns the rework when an API changes, and how warnings get tracked.

## Where these releases sit JDK 26 reached general availability on 17 March 2026 and JDK 27 on 15 September 2026. Both follow JDK 25 and neither is a long-term support release. Neither made a new language feature final. What they carry is API additions, runtime defaults, removals, and more preview rounds. So the answer an interviewer wants has two parts: what would change for a service upgraded from 25, and what you must not call final. ## JDK 26 | Change | JEP or issue | What you would notice | |---|---|---| | HTTP/3 for the HTTP Client API | JEP 517 | Opt in with `HttpClient.Version.HTTP_3`. The default preferred version stays HTTP/2 | | Prepare to Make Final Mean Final | JEP 500 | Deep reflection mutating a final instance field of an ordinary class warns. `--enable-final-field-mutation` enables it for named modules, or `ALL-UNNAMED` for the class path | | Applet API removed | JEP 504 | Deprecated for removal at 17, and now gone | | `Thread.stop()` removed | JDK-8368226 | Code using it no longer compiles. Old class files get `NoSuchMethodError` | | Ahead-of-time object caching with any GC | JEP 516 | The ahead-of-time cache now works fully with ZGC too | | G1 throughput | JEP 522 | Less synchronization between application and GC threads, with no user action | Small additions are also worth knowing: `Comparator.min` and `max`, `UUID.ofEpochMillis` for version 7 UUIDs, `Process.close()` so a `Process` works in try-with-resources, and `Instant.plusSaturating`. In most cases, a virtual thread waiting for another thread's class initializer now unmounts instead of pinning. Mutating a non-static final field of an ordinary class still succeeds by default at 26 and 27, and the JVM warns once per module. Static final fields and fields of record and hidden classes already throw `IllegalAccessException`. `--illegal-final-field-mutation=deny` makes the ordinary case throw as well, and JEP 500 says that mode will become the default in a future release. At 25 the same code runs silently. ## JDK 27 - **G1 by default everywhere** (JEP 523). With no collector named, the JVM always selects G1. At 25, the JVM selected Serial on a machine with a single CPU or less than 1792 MB of physical memory. `-XX:+UseSerialGC` still works, and nothing was removed. - **Compact object headers by default** (JEP 534). Headers shrink from 96 to 64 bits on 64-bit architectures. `-XX:-UseCompactObjectHeaders` turns them off. At 25 the flag defaults to false. - **Post-quantum hybrid key exchange for TLS 1.3** (JEP 527). Applications using `javax.net.ssl` get it by default, with no code change. - **JFR data redaction** (JEP 536). Flight Recorder redacts sensitive command-line arguments, environment variables and system properties before they leave the process. - **Removals.** The options `-noverify` and `-Xverify:none` are gone, so a JVM started with them now fails. JVMCI is removed, and `ThreadPoolExecutor.finalize()` is removed. - **Small additions.** `Math.asinh`, `acosh` and `atanh`, `BigDecimal.rootn`, `String.encodedLength`. ## Still preview or incubating at 27 | Feature | Stage at 27 | JEP | First appeared | |---|---|---|---| | Structured concurrency | Seventh preview | 533 | Incubator at 19, preview since 21 | | Lazy constants | Third preview | 531 | Preview at 25, then named `StableValue` | | Primitive types in patterns, `instanceof` and `switch` | Fifth preview | 532 | Preview at 23 | | PEM encodings of cryptographic objects | Third preview | 538 | Preview at 25 | | Vector API | Twelfth incubator | 537 | Incubator at 16 | Using them has a real cost: - **Previews** need `--enable-preview` at both compile and run time. Code that relies on one is tied to JDK 27. - **Previews change.** At 27, `StructuredTaskScope` gained a third type parameter and `Joiner.awaitAll()` was removed. - **The Vector API** lives in the `jdk.incubator.vector` module, which class-path code must add with `--add-modules` and a module can `requires`. JEP 537 says it will incubate until the necessary Valhalla features are available as previews. ## How to answer Lead with the G1 and compact-header defaults at 27, because they affect a service with no code change. Then give the preview list in one sentence. Name the 25 behaviour beside the 27 behaviour, since 25 is the release most teams are comparing against.

  • What would you check when upgrading a small service from JDK 25 to 27?
    Confirm which collector it now gets, since a one-CPU container moves from Serial to G1, and compare memory and latency. Check that startup scripts do not pass `-noverify`, because the JVM now refuses to start with it. Read the logs for final-field mutation warnings. Compact object headers are on by default too.
  • Why does a preview feature's stage number matter to someone choosing whether to use it?
    It counts rounds, not remaining work: JEP 12 expects a preview to be nearly done, and a round may change nothing, as primitive patterns' fifth did, or change the API, as structured concurrency's seventh did. What matters more is that code relying on a preview is tied to its release, so each upgrade can mean recompiling and rewriting.
  • What happened to the StableValue API from JDK 25?
    JDK 26 renamed it `LazyConstant`, removed low-level methods such as `trySet` and `orElseSet`, and disallowed null as a computed value. It is a third preview at 27. It shows why a preview API should not be treated as settled, and lazy constants have their own question.

  • Structured concurrency became final at JDK 27.
  • A JDK 26 HttpClient uses HTTP/3 by default.
  • JDK 27 removed the Serial collector.
  • Mutating a final instance field of an ordinary class by reflection already throws by default at JDK 27.
  • JDK 27 is a long-term support release, like JDK 25.
  • Compact object headers are still off by default at JDK 27.

HTTP/3 for the HTTP Client API
Java 26
G1 as the default collector in all environments
Java 27
Compact object headers as the default
Java 27
Structured concurrency
not finalpre-release 19
Vector API
not finalpre-release 16

Assumes JDK 27, the latest GA, and gives JDK 25 LTS behaviour where it differs: Serial could be selected and compact object headers were off.

context