Grilled Cheese

ExploreLog inSign up

Sven Woltmann

@svenwoltmann.bsky.social

34 Following35 Followers

Java Expert, Trainer, Speaker & Author · Oracle ACE Associate · 30 years of Java · Java training on Java 17, 21, 25 for dev teams · HappyCoders.eu – one of the most widely read Java blogs in the German-speaking world

PostsRepliesMedia
@svenwoltmann.bsky.socialDec 3, 2026, 7:05 AM

Java 28 is set: twelve JEPs. Structured Concurrency and PEM Encodings go final, Value Objects and a JSON API arrive as preview and incubator – and the Vector API enters its 13th incubator round, still waiting for Valhalla.

happycoders.eu/b/java28-freeze

Java 28 is set: twelve JEPs. Final: Structured Concurrency, PEM Encodings. New: Value Objects, Simple JSON API, Strict Field Initialization. Another round: Lazy Constants (4th preview), Vector API (13th incubator with Float16). Faster startup: AOT code compilation, ZGC. Garbage collection: adaptive ZGC heap, generational Shenandoah. Deprecated for removal: macOS/x64 port.
@svenwoltmann.bsky.socialDec 1, 2026, 8:51 AM

This record compiles today. With preview features in Java 28, it won’t: record constructors will no longer be allowed to use this before all fields are set.

Such code is usually a bug anyway – worth fixing today.

happycoders.eu/b/records-this

Code example “Compiles today. Not with preview features in Java 28.” Java 27: a record Name(String value) whose compact constructor calls IO.println(this); new Name("Duke") prints Name[value=null]. Java 28 with --enable-preview: rejected with the compiler error reference to this may only appear after an explicit constructor invocation.
@svenwoltmann.bsky.socialNov 27, 2026, 7:52 AM

I asked Jackson, Gson and Java 28’s new JSON API for the int in { "version": 345.6 }. Jackson and Gson returned 345. The JDK API threw an exception – the only one of the three to reject all six odd documents I tried.

happycoders.eu/b/json-api

Same JSON, same call, different answer: Jackson 3.3 reads { "version": 345.6 } with asInt() as 345. Java 28's Simple JSON API throws a JsonValueException: 345.6 cannot be represented as an int
@svenwoltmann.bsky.socialNov 23, 2026, 7:06 AM

Your comparator passes with 31 elements and fails with 32: (a, b) -> a < b ? -1 : 1 never returns 0. Below 32 elements, Timsort doesn't merge and never notices. With 35 to 63, my test passed again.

happycoders.eu/b/comparator-con…

List graphic “One comparator, three lists” for the comparator (a, b) -> a < b ? -1 : 1 and a list of alternating 0s and 1s, Java 8 and 27. Up to 31 elements: sorted. 32 to 34 elements: exception, “Comparison method violates its general contract!”. 35 to 63 elements: sorted again, but not stable.
@svenwoltmann.bsky.socialNov 19, 2026, 7:17 AM

How did you choose your -Xmx? With -XX:+ZAdaptiveHeapSizing, Java 28 will let ZGC size the heap itself – up to what memory is free, with an OutOfMemoryError only at 95% in use (JEP 546). The price: only with ZGC, and the default limit for direct buffers rises along.

happycoders.eu/b/zgc-heap

List graphic “ZGC will size the heap itself”, Java 28, JEP 546. Heap limit today: 25% of physical memory, unless you set -Xmx. With -XX:+ZAdaptiveHeapSizing: 95% of physical memory in use by all processes, then OutOfMemoryError; before that, ZGC collects more often. The price: only with ZGC; the limit for direct buffers rises too, from 16 to 64 GB on my Mac.
@svenwoltmann.bsky.socialNov 17, 2026, 8:55 AM

Two Integers with the value 1996: == says false. With preview features in Java 28, it will say true – without a code change.

Value objects have no identity, so the JVM may store them flat: 1M LocalDates in 8 instead of 20 MB. But only if they fit into 8 bytes.

happycoders.eu/b/value-objects

Code comparison “Same record, no identity”. Java 27: record Point(int x, int y), two points created with new Point(1, 2), a.equals(b) is true, a == b is false. Java 28 with --enable-preview: value record Point(int x, int y), same two points, a.equals(b) is true, a == b is true.
@svenwoltmann.bsky.socialNov 13, 2026, 7:09 AM

Half of that is on its way: Value Objects (JEP 401), the first piece of Valhalla, are integrated into Java 28 as a preview. String Templates, on the other hand, have been gone since Java 23 – the other preview that was pulled.

@svenwoltmann.bsky.socialNov 11, 2026, 2:33 PM

Five preview rounds, then the JDK developers pulled the plug: Primitive Types in Patterns won't be in Java 28, not even with --enable-preview. Valhalla's new numeric types got in the way.

This is exactly what previews are for. Just keep them out of production.

happycoders.eu/java/primitive-t…

List graphic “Five previews, no final release”: Java 23–27, five preview rounds, JEP 455 to JEP 532. Java 28: removed, even with --enable-preview, stamped WITHDRAWN. Next: Constant Patterns, draft JEP to follow.
Terms of UsePrivacy PolicyCommunity StandardsHelpGet the app

Grilled Cheese is a product of Village Compute

Version devBuilt at: 2026-12-03 22:42:33 EST