Java 28 is coming, and it brings some Genuinely BIG stuff
13 min readVasilios Kuznos

Java 28 is scheduled for March 2027, and while it is a non-LTS release, calling it a “quiet” one would be underselling it quite a bit. Between the long-awaited first public preview of Project Valhalla, the finalization of Structured Concurrency after what felt like an eternity of preview rounds, and some serious ZGC improvements that will make your apps start faster and behave smarter under load, there is plenty here worth paying attention to.
Let’s go through what is actually landing
Project Valhalla Finally Knocks on the Door
If you have been following Java for a few years, you have heard of Project Valhalla. It has been in the works for so long that people have made Norse mythology jokes about it. Well, JEP 401 Value Objects is now targeted for JDK 28 as a preview feature, and it is the real thing.
The problem value objects solve is one those who have been writing Java for a while know well, even if they stopped thinking about it because it just became background noise. In Java, everything that is not a primitive is a reference type. That means every object has an identity, a memory address that makes it unique in the JVM. Most of the time this is fine, but for types that model pure immutable data, identity is meaningless and expensive.
Take LocalDate. When you do this:
LocalDate d1 = LocalDate.of(1996, 1, 23);
LocalDate d3 = d1.plusYears(30).minusYears(30);
d1 == d3 // false
Those two dates represent the same thing. The same year, the same month, the same day. But == returns false because they are different objects in memory. We all know to use .equals() instead, but the identity requirement also has a real cost: the JVM has to allocate heap memory for every single LocalDate instance, and when you build an array of them, you get a block of pointers pointing all over the heap rather than a flat block of data you can stream through efficiently.
Value objects change this. You declare a class with the value modifier:
value record Point(int x, int y) {}
And from that point on, instances of Point have no identity. Two Point instances with the same fields are indistinguishable, not just by convention but by definition. The == operator compares them by field values. The JVM is now free to store them however it likes directly in arrays without pointers, on the stack, in CPU registers during JIT compilation. You get the expressiveness of a class and the performance characteristics closer to a primitive.
JDK 28 ships this with 30 existing platform classes already migrated: Integer, Long, LocalDate, Duration, Optional, and many others become value classes under preview mode. With enable-preview, Integer x = 1996; Integer y = 1996; x == y returns true. That alone fixes one of the oldest confusing edges in the language.
There are sensible restrictions. Value objects cannot be synchronized on, because synchronization depends on identity. Serialization needs manual work via writeReplace/readResolve. And since value objects can never have their fields mutated after construction, the JVM enforces strict field initialization during the construction phase. That last bit brings us to the next JEP.
Brian Goetz has been upfront that this is “just the first part of Valhalla,” and it will likely still be in preview in the next LTS. But the foundation is being laid now, and it required changes to over 197,000 lines of code across 1,816 files. The integration that happened here was one of the largest single commits in OpenJDK history.
Strict Field Initialization in the JVM
JEP 539 is the JVM-level mechanism that makes value objects possible, but it is also useful on its own terms.
The current JVM initializes every field to a default value (0, false, or null) before any user code runs. This is safe but it creates a class of bugs that are genuinely hard to diagnose. If class initialization triggers a circular dependency say, class A’s static initializer calls something that loads class B, which reads a static final field from A before A has set it you end up reading the default value of 0 or null when you expected the real value. The JVM never complained. The bug just silently happened.
Strictly-initialized fields fix this at the bytecode level. They cannot be read before they are written. For value object constructors, all fields must be set before the object escapes the constructor. The JVM verifier enforces this at load time, not at runtime, so you pay no performance cost once the class is loaded.
For most developers working in Java at the source level, you will not directly interact with this JEP. Its effects flow through the language features built on top of it. But if you work on tools, frameworks that use reflection to mutate final fields, or you write custom class file generators, you will want to read JEP 539 carefully because those patterns are no longer valid for strictly-initialized fields.
JSON in the Standard Library, Finally
JEP 540 delivers what many developers have been asking about forever: a simple JSON API in the JDK itself, without needing Jackson, Gson, or anything else.
This is an incubator feature in JDK 28, meaning it lives in jdk.incubator.json and you need add-modules jdk.incubator.json to use it. But the API is clean and the use cases it covers are exactly the kind of thing most developers actually do with JSON.
Here is the weather forecast example from the JEP:
String body = ... // REST response body
JsonValue json = Json.parse(body);
json.get("properties").get("periods").asList().stream()
.mapToInt(j -> j.get("temperature").asInt())
.average()
.ifPresent(IO::println);
That is it. Parse, navigate, extract, done. The JsonValue type is sealed, with subtypes JsonString, JsonNumber, JsonBoolean, JsonNull, JsonObject, and JsonArray. Because the interface is sealed, switch expressions on a JsonValue do not need a default clause, and the compiler tells you when you have not handled a case. The API is strict about RFC 8259 compliance, rejects duplicate member names in objects, and throws with descriptive path-aware messages when navigation goes wrong.
It is not trying to replace Jackson. It does not do data binding, it does not support streaming, and it does not have configuration options for every edge case. That is deliberate. If you need those things, keep using the library you already have. But for the enormous number of cases where you just want to grab a value out of an API response without adding a dependency, this does the job with zero ceremony.
Structured Concurrency: It’s Official
JEP 543 finalizes Structured Concurrency. No more preview. After going through incubation in JDK 19 and 20, becoming a preview in JDK 21, re-previewing in JDK 22, 23, 24, 25, 26, and 27, it is now part of the standard API.
The core problem it solves is one of those things you notice once you start working seriously with concurrent code. When you fan out subtasks with ExecutorService, the relationship between the parent task and the subtasks exists only in your head. If one subtask fails, the others keep running unless you manually cancel them. If the parent thread is interrupted, nothing propagates automatically. Thread dumps show all threads on equal footing, giving you no idea which thread is a subtask of which.
StructuredTaskScope changes the model:
Response handle() throws ExecutionException, InterruptedException {
try (var scope = StructuredTaskScope.open()) {
Subtask<String> user = scope.fork(() -> findUser());
Subtask<Integer> order = scope.fork(() -> fetchOrder());
scope.join();
return new Response(user.get(), order.get());
}
}
The lifetimes of subtasks are now bound to the try-with-resources block. If findUser() fails, fetchOrder() is automatically cancelled. If the outer thread is interrupted before join() returns, both subtasks are cancelled. Thread dumps show subtasks as children of the scope’s owner thread. You get the error propagation behavior you always wanted without the coordination boilerplate.
The Joiner interface lets you customize the completion policy. The built-in factory methods cover the most common patterns: anySuccessfulOrThrow() for racing redundant services and returning the first winner, allSuccessfulOrThrow() for running everything and collecting all results, and a few others. For anything more exotic, you implement Joiner directly.
This pairs naturally with virtual threads, which became permanent in JDK 21. Virtual threads are cheap, so you can dedicate one to each subtask without worrying about thread pool sizing. Structured concurrency gives you the discipline to manage their lifetimes correctly.
ZGC Gets Smarter About Memory
Two JEPs target ZGC in JDK 28: JEP 545 for faster startup and warmup, and JEP 546 for adaptive heap sizing.
The startup and warmup story matters because ZGC has historically made you choose. A small initial heap (-Xms) means fast startup but slow warmup the JVM spends significant time expanding the heap incrementally, triggering page faults as the OS maps physical memory on demand. A large initial heap means slow startup but fast warmup because the memory is committed and touched up front.
JEP 545 resolves this tradeoff. ZGC now starts with a default initial heap of just 2MB, which means startup is fast. But when the application starts demanding more memory, ZGC expands aggressively using its own worker threads, pre-touching new memory pages concurrently so the application threads do not pay the page fault cost. On Linux 6.1+, it also upgrades pages to 2MB large pages automatically during expansion, which reduces TLB pressure and speeds up memory access.
The numbers from the Spring PetClinic benchmark on the JEP are striking. In JDK 25 with a small initial heap, warmup took about 80 seconds before P99 latency stabilized. With the JDK 28 improvements, that same application warms up within 10 seconds, with startup time essentially unchanged. You just run:
java -XX:+UseZGC -XX:+ZAdaptiveHeapSizing -jar app.jar
And stop worrying about -Xms and -Xmx.
That second flag comes from JEP 546, adaptive heap sizing. With it enabled, ZGC continuously monitors GC CPU usage and adjusts the heap size to maintain a target intensity. If GC is using too much CPU, ZGC grows the heap to reduce collection frequency. If the heap is larger than needed, ZGC contracts it. Crucially, ZGC also monitors what other JVMs and processes on the same host are doing. If a neighbor process starts consuming memory, ZGC contracts its heap to make room and shifts toward more frequent, more CPU-intensive collections. When the neighbor leaves, it expands again. Multiple JVMs on the same machine using ZGC with adaptive sizing will naturally share resources without stepping on each other.
This is a meaningful quality-of-life improvement for anyone running Java services in containers or on shared hardware.
Shenandoah GC Goes Generational by Default
JEP 535 is a small but meaningful signal. The Shenandoah garbage collector’s generational mode becomes the default, and the non-generational (SATB) mode is deprecated for eventual removal.
Generational Shenandoah collects young objects frequently and old objects less frequently, which is the right strategy for most real applications. The original non-generational mode treated all objects equally, which meant it did more work than necessary for the common case where most allocated objects die young. Switching the default means most users will get better throughput, lower concurrent GC overhead, and a smaller memory footprint without changing any configuration.
If you are using -XX:+UseShenandoahGC today, you might notice differences in GC log output after upgrading. If you had tuned specifically for the non-generational mode, you may need to revisit those settings. The non-generational mode is still available with -XX:ShenandoahGCMode=satb, though you will see a deprecation warning.
PEM Encoding of Cryptographic Objects
JEP 542 finalizes the PEM API that has been in preview since JDK 25. If you work with TLS, cryptographic keys, certificates, or anything involving OpenSSL in your Java code, this one will clean up a surprising amount of boilerplate.
The PEM format those files with -BEGIN PUBLIC KEY- headers is everywhere in security tooling. OpenSSL uses it, certificate authorities issue chains in it, SSH keys are stored in it, YubiKeys work with it. Java’s existing crypto APIs always had the underlying data but never had a clean way to get to and from PEM text. Developers typically had to manually parse the header, base64-decode the body, figure out the right factory, and wire everything together with a dozen lines of plumbing.
Now it is:
PEMDecoder pd = PEMDecoder.of();
ECPublicKey key = pd.decode(pem, ECPublicKey.class);
And for encoding:
PEMEncoder pe = PEMEncoder.of();
String pem = pe.encodeToString(new KeyPair(publicKey, privateKey));
For encrypted private keys:
String pem = PEMEncoder.of()
.withEncryption(password)
.encodeToString(privateKey);
The PEMDecoder and PEMEncoder instances are immutable and thread-safe. Pattern matching works naturally for handling different key types when you do not know what you are going to get from the input. The BinaryEncodable interface is sealed, so you get exhaustive switch coverage. This is a well-designed API that has clearly benefited from multiple preview rounds.
Ahead-of-Time Compilation
JEP 544, Ahead-of-Time Code Compilation, is proposed for JDK 28 and comes from Project Leyden. The idea is to capture optimized native code from a profiling run and make it available to the JVM at startup, so the JIT compiler does not have to redo all that work from scratch every time the application starts.
This is different from GraalVM’s native image approach. You are still running on the HotSpot JVM, still getting JIT compilation for code that runs after startup, still getting the full generality of the Java runtime. You are just seeding the JVM with pre-compiled native code so it can skip the warmup phase for hot paths that are known from profiling.
The promise is meaningful especially when combined with the ZGC improvements above. Fast startup, fast warmup from AOT code, and a GC that adapts to your workload dynamically: the old complaint that JVM applications are slow to start and slow to warm up is becoming less and less true.
One Port Is Leaving
JEP 541 deprecates the macOS/x64 port for eventual removal. Apple stopped making x64 Macs when they transitioned to Apple Silicon, and Oracle engineers stopped maintaining the port as of JDK 27. If you are still running on an Intel Mac, you have time, but the message is clear: move to an ARM build or a different platform.
The Bigger Picture
JDK 28 arrives in March 2027. Looking across these features, there are a few threads worth noticing.
The JVM performance story is getting genuinely competitive. Adaptive ZGC heap sizing, faster startup, concurrent pre-touching with large pages, AOT compilation these are not incremental improvements. They are answers to legitimate criticisms about JVM startup and steady-state resource usage that have been valid for years.
Valhalla’s arrival, even as a preview, marks a shift in what Java can express at the type system level. Value types allow the JVM to close the gap between “I want object-oriented code” and “I need this to run like a numeric array.” The ecosystem implications will take time to materialize, but library authors and framework teams should be paying attention now.
Structured concurrency going final is the kind of thing that looks boring from the outside but matters enormously in practice. It is an API that makes concurrent code safer and more debuggable in ways that ExecutorService simply cannot match. Now that it is stable, adoption should accelerate.
And the JSON API, while still incubating, shows the platform continuing to reduce the gap between “things that should be trivial” and “things that actually are trivial.” Writing a program that parses a REST response should not require a dependency decision.
If your team is running on JDK 21 LTS, you probably want to start testing against JDK 28 early-access builds once they stabilize, particularly if you have workloads sensitive to GC behavior or startup time. The early-access builds are available now and the feature set is taking shape.
Comments
Loading comments…