# JEP-401

Published articles for JEP-401.

This is one page of public article previews, not the complete archive. Follow Next page to continue. Summaries are not the original full articles.

## Value Classes Still Need Compiler Sympathy

DevFeed: [Value Classes Still Need Compiler Sympathy](<https://devfeed.tech/articles/value-classes-still-need-compiler-sympathy-15126.md>)

Original publisher: [Read original article](<https://inside.java/2026/08/24/value-classes-compiler-sympathy/>)

Author: Johan Sjölén

Published: 2026-08-24T00:00:00Z

Content type: article

Language: en

Sources: [Inside Java](<https://devfeed.tech/sources/inside-java.md>)

Topics: [Java](<https://devfeed.tech/topics/java.md>), [Project Valhalla](<https://devfeed.tech/topics/project-valhalla.md>), [JEP-401](<https://devfeed.tech/topics/jep-401.md>), [Compiler](<https://devfeed.tech/topics/compiler.md>), [inlining](<https://devfeed.tech/topics/inlining.md>), [code analysis](<https://devfeed.tech/topics/code-analysis.md>)

Tags: [abi](<https://devfeed.tech/tags/abi.md>), [abstraction](<https://devfeed.tech/tags/abstraction.md>), [adapter](<https://devfeed.tech/tags/adapter.md>), [analysis](<https://devfeed.tech/tags/analysis.md>), [annotation](<https://devfeed.tech/tags/annotation.md>), [apply](<https://devfeed.tech/tags/apply.md>), [argument](<https://devfeed.tech/tags/argument.md>), [c2](<https://devfeed.tech/tags/c2.md>), [class](<https://devfeed.tech/tags/class.md>), [classes](<https://devfeed.tech/tags/classes.md>), [code](<https://devfeed.tech/tags/code.md>), [compiler](<https://devfeed.tech/tags/compiler.md>), [identity](<https://devfeed.tech/tags/identity.md>), [jep-401](<https://devfeed.tech/tags/jep-401.md>), [jvm](<https://devfeed.tech/tags/jvm.md>), [openjdk](<https://devfeed.tech/tags/openjdk.md>), [optimize](<https://devfeed.tech/tags/optimize.md>), [profiling](<https://devfeed.tech/tags/profiling.md>), [project-valhalla](<https://devfeed.tech/tags/project-valhalla.md>), [semantic](<https://devfeed.tech/tags/semantic.md>), [state](<https://devfeed.tech/tags/state.md>), [valhalla](<https://devfeed.tech/tags/valhalla.md>), [value](<https://devfeed.tech/tags/value.md>), [values](<https://devfeed.tech/tags/values.md>)

### AI overview

JDK 28's preview value classes can enable flattening and scalarization, but they do not guarantee faster code. The source shows that immutable final fields can hold large values in flattened form, while mutable fields may use references to preserve tear-free assignment. C2 can eliminate allocations in a value transformation loop; the comparable identity-record example retained allocations. A further allocation source is generic type erasure: a megamorphic call through an inherited `Object apply(Object)` descriptor forces scalarized values to be materialized as heap references. Explicitly redeclaring the typed method in the interface (`Carrier apply(LargeValue)`) lets values cross that dynamic call boundary scalarized; in the reported reproducer, allocation fell from 192 bytes per invocation to zero. The author recommends profiling and inspecting generated code because compiler optimizations depend on context.

### Source excerpt

Declaring a value class is first and foremost a semantic decision. It tells our fellow programmers that its instances are defined entirely by their state and do not need identity. That clearer model is valuable in itself! The JVM's additional freedom to optimize how those values are represented is a welcome bonus. C2 can do amazing things with that freedom, but it cannot always recover information hidden behind abstraction boundaries. Profiling and inspecting the generated code remain the best ways to understand what is happening. To get the best results, we may still need to have a little sympathy for the compiler.

## Project Valhalla Uses Java Value Classes to Reduce Domain-Primitive Overhead

DevFeed: [Project Valhalla Uses Java Value Classes to Reduce Domain-Primitive Overhead](<https://devfeed.tech/articles/rethink-domain-primitives-with-valhalla-41529.md>)

Original publisher: [Read original article](<https://dfa1.github.io/articles/rethink-domain-primitives-with-valhalla.html>)

Author: Davide Angelocola

Published: 2026-05-16T00:00:00Z

Content type: opinion

Language: en

Sources: [Davide Angelocola](<https://devfeed.tech/sources/davide-angelocola.md>)

Topics: [Project Valhalla](<https://devfeed.tech/topics/project-valhalla.md>), [JEP-401](<https://devfeed.tech/topics/jep-401.md>), [Scala](<https://devfeed.tech/topics/scala.md>), [Java](<https://devfeed.tech/topics/java.md>), [software-architecture](<https://devfeed.tech/topics/software-architecture.md>)

Tags: [compiler](<https://devfeed.tech/tags/compiler.md>), [heap](<https://devfeed.tech/tags/heap.md>), [java](<https://devfeed.tech/tags/java.md>), [jep-401](<https://devfeed.tech/tags/jep-401.md>), [jvm](<https://devfeed.tech/tags/jvm.md>), [memory](<https://devfeed.tech/tags/memory.md>), [performance](<https://devfeed.tech/tags/performance.md>), [project-valhalla](<https://devfeed.tech/tags/project-valhalla.md>), [scala](<https://devfeed.tech/tags/scala.md>), [valhalla](<https://devfeed.tech/tags/valhalla.md>)

### AI overview

The article examines how Project Valhalla value classes can make domain-specific types more practical in performance-sensitive Java code. It focuses on flattening wrappers into arrays, registers, and object fields to reduce heap allocation, indirection, memory use, cache misses, and garbage-collection overhead.

### Source excerpt

Your Compiler Is Already Part of Your Security Team made the case for domain primitives: encode constraints in types, the compiler enforces them forever. The recurring objection -- a wrapper class per int is one heap object per value, plus a pointer to reach it. Fine at the boundary; questionable in a hot loop where allocations and cache misses dominate.