<!-- mobian-agent-page publisher="dailydev" canonical="https://daily.dev/posts/project-valhalla-s-first-preview-jep-401-redefines-for-java-objects-zpmyfc4q3" -->

---
title: Project Valhalla&#x27;s First Preview: JEP 401 Redefines ==...
description: JEP 401, Value Objects (Preview), has been integrated into JDK 28 as part of Project Valhalla. It introduces a new `value` modifier for classes, making their...
canonical: https://daily.dev/posts/project-valhalla-s-first-preview-jep-401-redefines-for-java-objects-zpmyfc4q3
twitter:card: summary_large_image
twitter:site: @dailydotdev
og:type: website
og:site_name: daily.dev
og:title: Project Valhalla&#x27;s First Preview: JEP 401 Redefines == for Java Objects | daily.dev
og:description: JEP 401, Value Objects (Preview), has been integrated into JDK 28 as part of Project Valhalla. It introduces a new `value` modifier for classes, making their...
og:url: https://daily.dev/posts/project-valhalla-s-first-preview-jep-401-redefines-for-java-objects-zpmyfc4q3
og:image: https://api.daily.dev/og/posts/zpMYfc4Q3.png
og:image:alt: Project Valhalla&#x27;s First Preview: JEP 401 Redefines == for Java Objects
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.

# Project Valhalla's First Preview: JEP 401 Redefines == for Java Objects

**[InfoQ](https://daily.dev/sources/infoq)** · 4 min read · 0 upvotes · 0 comments

## Summary

JEP 401, Value Objects (Preview), has been integrated into JDK 28 as part of Project Valhalla. It introduces a new `value` modifier for classes, making their instance fields implicitly final and changing how `==` behaves — two value objects with identical field values are considered equal. Value classes cannot use `synchronized` on instance methods, and several JDK value-based classes (like primitive wrappers and `LocalDate`) become value classes when preview is enabled. The JVM may optimize value objects by scalarizing or flattening them into compact representations, reducing heap allocation and GC pressure. The preview is disabled by default and requires `--enable-preview` at both compile and run time. Security considerations include potential indirect exposure of private fields via `==` and unbounded comparison time for large value-object trees.

## Full article

daily.dev links to this article rather than hosting it. Read it at the original source: <https://www.infoq.com/news/2026/08/jep401-value-objects-preview>

## Questions this post answers

### What does JEP 401 change about == for value objects in Java?

For value objects declared with the `value` modifier, `==` returns true when both operands are instances of the same class with identical field values, including recursive `==` comparison for reference-typed fields. For identity objects (all other classes), `==` behavior is unchanged. This does not replace `equals` — a value object's internal state may differ from the state it represents, so `equals` should still be used for logical equality.

_Java developers navigating the shift from identity to value semantics track JEP discussions and JDK previews on daily.dev._

### What restrictions apply to value classes in JEP 401 JDK 28?

Value classes must have all instance fields implicitly final, with every field assigned before construction completes. Instance methods of a value class may not be `synchronized`. Creating a `Reference` for a value object throws `IdentityException`. Code compiled with the preview enabled must also run with `--enable-preview`. JEP 539 supplies the bytecode verification that enforces the construction rules.

_Teams evaluating whether to adopt JDK 28 preview features find the trade-off discussions on daily.dev._

### How does the JVM optimize value objects introduced by Project Valhalla?

The JVM may scalarize a value object into its constituent fields or flatten it into a compact representation stored directly in a field or array element, avoiding heap allocation and reducing GC pressure. Flattening is constrained by atomicity — on typical platforms the available encoding may be as small as 64 bits including a null flag. When neither optimization applies, the JVM falls back to ordinary allocation, especially before JIT-optimized code is available.

_Engineers chasing JVM performance improvements follow Project Valhalla progress on daily.dev._

## Similar posts on daily.dev

- [JEP 401: Value Objects \(Preview\)](https://daily.dev/posts/jep-401-value-objects-preview--1rxfjujqr) · Inside Java · 2 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
- [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

---

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

[View this post on daily.dev](https://daily.dev/posts/project-valhalla-s-first-preview-jep-401-redefines-for-java-objects-zpmyfc4q3)

```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":"Project Valhalla's First Preview: JEP 401 Redefines == for Java Objects","url":"https://daily.dev/posts/project-valhalla-s-first-preview-jep-401-redefines-for-java-objects-zpmyfc4q3","mainEntityOfPage":{"@type":"WebPage","@id":"https://daily.dev/posts/project-valhalla-s-first-preview-jep-401-redefines-for-java-objects-zpmyfc4q3"},"datePublished":"2026-08-10T14:46:08.983Z","dateModified":"2026-08-13T09:13:55.429Z","description":"JEP 401, Value Objects (Preview), has been integrated into JDK 28 as part of Project Valhalla. It introduces a new `value` modifier for classes, making their...","image":"https://media.daily.dev/image/upload/f_auto,q_auto/v1/posts/060f1666411757fa2195d5d049835a92?_a=AQAEuop","thumbnailUrl":"https://media.daily.dev/image/upload/f_auto,q_auto/v1/posts/060f1666411757fa2195d5d049835a92?_a=AQAEuop","isAccessibleForFree":true,"articleSection":"InfoQ","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":"InfoQ","logo":"https://media.daily.dev/image/upload/t_logo,f_auto/v1/logos/afc3bced3e1e4b188dd9127017a60e0c","url":"https://daily.dev/sources/infoq"},"commentCount":0,"discussionUrl":"https://daily.dev/posts/project-valhalla-s-first-preview-jep-401-redefines-for-java-objects-zpmyfc4q3","interactionStatistic":[{"@type":"InteractionCounter","interactionType":{"@type":"LikeAction"},"userInteractionCount":0},{"@type":"InteractionCounter","interactionType":{"@type":"CommentAction"},"userInteractionCount":0}],"keywords":"java,jvm","timeRequired":"PT4M"}
{"@context":"https://schema.org","@type":"BreadcrumbList","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https://daily.dev"},{"@type":"ListItem","position":2,"name":"InfoQ","item":"https://daily.dev/sources/infoq"},{"@type":"ListItem","position":3,"name":"Project Valhalla's First Preview: JEP 401 Redefines == for Java Objects"}]}
{"@context":"https://schema.org","@type":"FAQPage","@id":"https://daily.dev/posts/project-valhalla-s-first-preview-jep-401-redefines-for-java-objects-zpmyfc4q3#faq","mainEntity":[{"@type":"Question","name":"What does JEP 401 change about == for value objects in Java?","acceptedAnswer":{"@type":"Answer","text":"For value objects declared with the `value` modifier, `==` returns true when both operands are instances of the same class with identical field values, including recursive `==` comparison for reference-typed fields. For identity objects (all other classes), `==` behavior is unchanged. This does not replace `equals` — a value object's internal state may differ from the state it represents, so `equals` should still be used for logical equality. Java developers navigating the shift from identity to value semantics track JEP discussions and JDK previews on daily.dev."}},{"@type":"Question","name":"What restrictions apply to value classes in JEP 401 JDK 28?","acceptedAnswer":{"@type":"Answer","text":"Value classes must have all instance fields implicitly final, with every field assigned before construction completes. Instance methods of a value class may not be `synchronized`. Creating a `Reference` for a value object throws `IdentityException`. Code compiled with the preview enabled must also run with `--enable-preview`. JEP 539 supplies the bytecode verification that enforces the construction rules. Teams evaluating whether to adopt JDK 28 preview features find the trade-off discussions on daily.dev."}},{"@type":"Question","name":"How does the JVM optimize value objects introduced by Project Valhalla?","acceptedAnswer":{"@type":"Answer","text":"The JVM may scalarize a value object into its constituent fields or flatten it into a compact representation stored directly in a field or array element, avoiding heap allocation and reducing GC pressure. Flattening is constrained by atomicity — on typical platforms the available encoding may be as small as 64 bits including a null flag. When neither optimization applies, the JVM falls back to ordinary allocation, especially before JIT-optimized code is available. Engineers chasing JVM performance improvements follow Project Valhalla progress on daily.dev."}}]}
```

