<!-- mobian-agent-page publisher="dailydev" canonical="https://daily.dev/posts/jep-401-value-objects-preview--1rxfjujqr" -->

---
title: JEP 401: Value Objects (Preview) | daily.dev
description: JEP 401 introduces value objects as a preview language and VM feature in JDK 28. Value objects are immutable and lack identity, meaning the == operator and...
canonical: https://daily.dev/posts/jep-401-value-objects-preview--1rxfjujqr
twitter:card: summary_large_image
twitter:site: @dailydotdev
og:type: website
og:site_name: daily.dev
og:title: JEP 401: Value Objects (Preview) | daily.dev
og:description: JEP 401 introduces value objects as a preview language and VM feature in JDK 28. Value objects are immutable and lack identity, meaning the == operator and...
og:url: https://daily.dev/posts/jep-401-value-objects-preview--1rxfjujqr
og:image: https://api.daily.dev/og/posts/1rxFjUJqR.png
og:image:alt: JEP 401: Value Objects (Preview)
og:image:width: 1200
og:image:height: 630
og:locale: en
---

> ## Documentation Index
> Fetch the complete documentation index at: https://daily.dev/llms.txt
> Use this file to discover all available pages before exploring further.

# JEP 401: Value Objects (Preview)

**[Inside Java](https://daily.dev/sources/inside_java)** · 44 min read · 2 upvotes · 0 comments

## Summary

JEP 401 introduces value objects as a preview language and VM feature in JDK 28. Value objects are immutable and lack identity, meaning the == operator and other operations compare them by field values rather than by reference. Thirty Java Platform API classes, including Integer, Long, and LocalDate, become value classes when preview features are enabled. This lets JVMs represent such objects more efficiently in memory (flattening and scalarization) instead of always allocating heap objects with pointers, improving memory footprint, locality, and garbage collection efficiency. Developers can declare their own value classes with the new value modifier, following rules around immutability, safe construction, subclassing via abstract value classes, and serialization. The feature requires --enable-preview to compile and run, and comes with caveats around synchronization, weak references, and reflection-based field mutation.

## Full article

daily.dev links to this article rather than hosting it. Read it at the original source: <https://inside.java/2026/09/20/jep401-target-jdk28>

## Questions this post answers

### What is JEP 401 value objects in JDK 28 and how do they change how == works?

JEP 401 is a preview language and VM feature in JDK 28 that introduces value objects, which are immutable and lack object identity. For value objects, the == operator compares field values instead of identity, so two separately created value objects with identical fields are ==. Thirty Platform API classes, including Integer, Long, and LocalDate, become value classes when preview features are enabled.

_Track how immutability and identity semantics evolve in Java releases on daily.dev before you upgrade._

### How do I enable and use preview value classes in JDK 28?

Compile with javac --release 28 --enable-preview and run with java --enable-preview, or use the source code launcher or jshell with --enable-preview. When preview features are enabled, classes like LocalDate compile to their new value-object versions, and you cannot mix identity-object and value-object versions of the same class within a single run.

_Developers evaluating preview JDK features can follow rollout details for Java releases on daily.dev._

### Why can't I synchronize on a LocalDate object in JDK 28 with preview features enabled?

LocalDate becomes a value class under JEP 401 preview features, and value objects lack identity, so synchronization is unsupported. Attempting synchronized(d1) on a value object throws java.lang.IdentityException with the message that you cannot synchronize on an instance of a value class, since locking requires an object with distinguishable identity.

_Anyone migrating locking code to value classes can check breaking-change details for Java upgrades on daily.dev._

## Similar posts on daily.dev

- [8389219: Implement JEP 401: Value Objects \(Preview\) by MrSimms · Pull Request \#31120 · openjdk/jdk](https://daily.dev/posts/8389219-implement-jep-401-value-objects-preview-by-mrsimms-pull-request-31120-openjdk-jdk-hghnkbn5r) · Hacker News · 0 upvotes · 0 comments
- [Java’s biggest language change in a decade is finally landing. It took 197,000 lines of code.](https://daily.dev/posts/java-s-biggest-language-change-in-a-decade-is-finally-landing-it-took-197-000-lines-of-code--8eeespmnb) · The Next Web · 39 upvotes · 1 comments
- [Value Classes Still Need Compiler Sympathy](https://daily.dev/posts/value-classes-still-need-compiler-sympathy-6gmnyemca) · Inside Java · 0 upvotes · 0 comments

---

Tags: [#performance](https://daily.dev/tags/performance), [#java](https://daily.dev/tags/java), [#jvm](https://daily.dev/tags/jvm)

[View this post on daily.dev](https://daily.dev/posts/jep-401-value-objects-preview--1rxfjujqr)

```json
{"@context":"https://schema.org","@graph":[{"@type":"Organization","@id":"https://daily.dev/#organization","name":"daily.dev","url":"https://daily.dev","logo":{"@type":"ImageObject","url":"https://daily.dev/apple-touch-icon.png","width":180,"height":180},"sameAs":["https://twitter.com/dailydotdev","https://github.com/dailydotdev","https://www.linkedin.com/company/daily-dev-ltd"]},{"@type":"WebSite","@id":"https://daily.dev/#website","url":"https://daily.dev","name":"daily.dev","publisher":{"@id":"https://daily.dev/#organization"},"potentialAction":{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https://daily.dev/search?q={search_term_string}"},"query-input":"required name=search_term_string"}}]}
{"@context":"https://schema.org","@type":"TechArticle","headline":"JEP 401: Value Objects (Preview)","url":"https://daily.dev/posts/jep-401-value-objects-preview--1rxfjujqr","mainEntityOfPage":{"@type":"WebPage","@id":"https://daily.dev/posts/jep-401-value-objects-preview--1rxfjujqr"},"datePublished":"2026-09-20T15:12:41.589Z","dateModified":"2026-09-20T15:13:04.300Z","description":"JEP 401 introduces value objects as a preview language and VM feature in JDK 28. Value objects are immutable and lack identity, meaning the == operator and...","image":"https://media.daily.dev/image/upload/s--ZrL_HSsR--/f_auto/v1722860399/public/Placeholder%2006","thumbnailUrl":"https://media.daily.dev/image/upload/s--ZrL_HSsR--/f_auto/v1722860399/public/Placeholder%2006","isAccessibleForFree":true,"articleSection":"Inside Java","inLanguage":"en","publisher":{"@type":"Organization","name":"daily.dev","url":"https://daily.dev","logo":{"@type":"ImageObject","url":"https://daily.dev/apple-touch-icon.png","width":180,"height":180}},"author":{"@type":"Organization","name":"Inside Java","logo":"https://media.daily.dev/image/upload/t_logo,f_auto/v1/logos/de5992d95f374790bdfd2ae03a16f6e3","url":"https://daily.dev/sources/inside_java"},"commentCount":0,"discussionUrl":"https://daily.dev/posts/jep-401-value-objects-preview--1rxfjujqr","interactionStatistic":[{"@type":"InteractionCounter","interactionType":{"@type":"LikeAction"},"userInteractionCount":2},{"@type":"InteractionCounter","interactionType":{"@type":"CommentAction"},"userInteractionCount":0}],"keywords":"performance,java,jvm","timeRequired":"PT44M"}
{"@context":"https://schema.org","@type":"BreadcrumbList","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https://daily.dev"},{"@type":"ListItem","position":2,"name":"Inside Java","item":"https://daily.dev/sources/inside_java"},{"@type":"ListItem","position":3,"name":"JEP 401: Value Objects (Preview)"}]}
{"@context":"https://schema.org","@type":"FAQPage","@id":"https://daily.dev/posts/jep-401-value-objects-preview--1rxfjujqr#faq","mainEntity":[{"@type":"Question","name":"What is JEP 401 value objects in JDK 28 and how do they change how == works?","acceptedAnswer":{"@type":"Answer","text":"JEP 401 is a preview language and VM feature in JDK 28 that introduces value objects, which are immutable and lack object identity. For value objects, the == operator compares field values instead of identity, so two separately created value objects with identical fields are ==. Thirty Platform API classes, including Integer, Long, and LocalDate, become value classes when preview features are enabled. Track how immutability and identity semantics evolve in Java releases on daily.dev before you upgrade."}},{"@type":"Question","name":"How do I enable and use preview value classes in JDK 28?","acceptedAnswer":{"@type":"Answer","text":"Compile with javac --release 28 --enable-preview and run with java --enable-preview, or use the source code launcher or jshell with --enable-preview. When preview features are enabled, classes like LocalDate compile to their new value-object versions, and you cannot mix identity-object and value-object versions of the same class within a single run. Developers evaluating preview JDK features can follow rollout details for Java releases on daily.dev."}},{"@type":"Question","name":"Why can't I synchronize on a LocalDate object in JDK 28 with preview features enabled?","acceptedAnswer":{"@type":"Answer","text":"LocalDate becomes a value class under JEP 401 preview features, and value objects lack identity, so synchronization is unsupported. Attempting synchronized(d1) on a value object throws java.lang.IdentityException with the message that you cannot synchronize on an instance of a value class, since locking requires an object with distinguishable identity. Anyone migrating locking code to value classes can check breaking-change details for Java upgrades on daily.dev."}}]}
```

