<!-- mobian-agent-page publisher="dailydev" canonical="https://daily.dev/posts/value-based-classes-nipafx-i7fvlpxak" -->

---
title: Value-Based Classes // nipafx | daily.dev
description: Java 8 introduced value-based classes (Optional, LocalDate, Duration, etc.) as precursors to future value types. These classes have no guaranteed object...
canonical: https://daily.dev/posts/value-based-classes-nipafx-i7fvlpxak
twitter:card: summary_large_image
twitter:site: @dailydotdev
og:type: website
og:site_name: daily.dev
og:title: Value-Based Classes // nipafx | daily.dev
og:description: Java 8 introduced value-based classes (Optional, LocalDate, Duration, etc.) as precursors to future value types. These classes have no guaranteed object...
og:url: https://daily.dev/posts/value-based-classes-nipafx-i7fvlpxak
og:image: https://api.daily.dev/og/posts/i7FvLPXAk.png
og:image:alt: Value-Based Classes // nipafx
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.

# Value-Based Classes // nipafx

**[nipafx \(Nicolai Parlog\)](https://daily.dev/sources/nipafx)** · 12 min read · 0 upvotes · 0 comments

## Summary

Java 8 introduced value-based classes (Optional, LocalDate, Duration, etc.) as precursors to future value types. These classes have no guaranteed object identity, meaning the JVM may freely destroy and recreate their references. This imposes concrete limitations: instances must be final and immutable, must not be used in synchronized blocks, must not be compared with ==, must not be serialized directly, and must not be used as keys in IdentityHashMap or passed to System.identityHashCode. Violating these rules is safe in Java 8 but may silently break code when value types are eventually introduced. The post also covers how Optional and java.time classes already violate some of their own rules, and discusses a FindBugs feature request to detect these violations statically.

## Full article

daily.dev links to this article rather than hosting it. Read it at the original source: <https://nipafx.dev/java-value-based-classes>

## Similar posts on daily.dev

- [Identifying JDK value class candidates](https://daily.dev/posts/identifying-jdk-value-class-candidates-zo2wg9obx) · Inside Java · 2 upvotes · 0 comments

---

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

[View this post on daily.dev](https://daily.dev/posts/value-based-classes-nipafx-i7fvlpxak)

```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":"Value-Based Classes // nipafx","url":"https://daily.dev/posts/value-based-classes-nipafx-i7fvlpxak","mainEntityOfPage":{"@type":"WebPage","@id":"https://daily.dev/posts/value-based-classes-nipafx-i7fvlpxak"},"datePublished":"2026-03-16T08:14:18.676Z","dateModified":"2026-03-16T08:28:37.247Z","description":"Java 8 introduced value-based classes (Optional, LocalDate, Duration, etc.) as precursors to future value types. These classes have no guaranteed object...","image":"https://media.daily.dev/image/upload/f_auto,q_auto/v1/posts/9e4262531403c09feddff544181a0e46?_a=AQAEuop","thumbnailUrl":"https://media.daily.dev/image/upload/f_auto,q_auto/v1/posts/9e4262531403c09feddff544181a0e46?_a=AQAEuop","isAccessibleForFree":true,"articleSection":"nipafx (Nicolai Parlog)","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":"nipafx (Nicolai Parlog)","logo":"https://media.daily.dev/image/upload/s--H_Echo_u--/f_auto,q_auto/v1773648772/logos/nipafx?_a=BAMAMiiu0","url":"https://daily.dev/sources/nipafx"},"commentCount":0,"discussionUrl":"https://daily.dev/posts/value-based-classes-nipafx-i7fvlpxak","interactionStatistic":[{"@type":"InteractionCounter","interactionType":{"@type":"LikeAction"},"userInteractionCount":0},{"@type":"InteractionCounter","interactionType":{"@type":"CommentAction"},"userInteractionCount":0}],"keywords":"java","timeRequired":"PT12M"}
{"@context":"https://schema.org","@type":"BreadcrumbList","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https://daily.dev"},{"@type":"ListItem","position":2,"name":"nipafx (Nicolai Parlog)","item":"https://daily.dev/sources/nipafx"},{"@type":"ListItem","position":3,"name":"Value-Based Classes // nipafx"}]}
```

