惯性聚合 高效追踪和阅读你感兴趣的博客、新闻、科技资讯
阅读原文 在惯性聚合中打开

推荐订阅源

Blog — PlanetScale
Blog — PlanetScale
J
Java Code Geeks
N
Netflix TechBlog - Medium
Martin Fowler
Martin Fowler
A
About on SuperTechFans
腾讯CDC
B
Blog RSS Feed
H
Hackread – Cybersecurity News, Data Breaches, AI and More
Microsoft Azure Blog
Microsoft Azure Blog
D
Docker
Y
Y Combinator Blog
Microsoft Security Blog
Microsoft Security Blog
F
Fortinet All Blogs
I
InfoQ
博客园 - 【当耐特】
美团技术团队
GbyAI
GbyAI
量子位
宝玉的分享
宝玉的分享
爱范儿
爱范儿
有赞技术团队
有赞技术团队
博客园 - Franky
L
LangChain Blog
阮一峰的网络日志
阮一峰的网络日志

DEV Community

Authentication Security Deep Dive: From Brute Force to Salted Hashing (With Java Examples) Why AI Systems Don’t Fail — They Drift Spilling beans for how i learn for exam😁"Reinforcement Learning Cheat Sheet" I Replaced Chrome with Safari for AI Browser Automation. Here's What Broke (and What Finally Worked) How Python Borrows Other People's Work The $40 Architecture: Processing 1 Billion API Requests with 99.99% Uptime Vibe Coding: A Workflow Guide (From Zero to SaaS) Most webhook security guides protect the wrong side. The scary part is delivery. Headless CMS for TanStack Start: Build a Blog with Cosmic EU Age Verification App "Hacked in 2 Minutes" — What Actually Happened Comfy Cloud’s delete function does not actually remove files Running AI Models on GPU Cloud Servers: A Beginner Guide Event-driven media intelligence with AWS Step Functions and Bedrock I scored 500 AI prompts across 8 quality dimensions — here's what broke How to Call Google Gemini API from Next.js (Free Tier, No Backend Needed) The Portal Protocol: Reclaiming Human Connection in the Age of AI How to Fix Your Team's Scattered Knowledge Problem With a Self-Hosted Forum Intro to tc Cloud Functors: A Graph-First Mental Model for the Modern Cloud Designing Multi-Tenant Backends With Both Ownership and Team Access I Built a Neumorphic CSS Library with 77+ Components — Here's What I Learned PostgreSQL Performance Optimization: Why Connection Pooling Is Critical at Scale Cómo construí un SaaS multi-rubro para gestionar expensas en Argentina con FastAPI + Vue 3 🚀 I Built an Ethical Hacking Scanner Tool – Open Source Project I Replaced /usage and /context in Claude Code With a Single Statusline A Pythonic Way to Handle Emails (IMAP/SMTP) with Auto-Discovery and AI-Ready Design I Collected 8.9 Million Polymarket Price Points — Here's What I Found About How Markets Really Move EcoTrack AI — Carbon Footprint Tracker & Dashboard Everyone's Using AI. No One Agrees How. 5 self-hosted ebook managers worth trying in 2026 Building Your First AI Agent with LangChain: From Chatbot to Autonomous Assistant
Project Valhalla in JDK 28: What Value Classes Actually C...
Dev Encyclopedia · 2026-06-27 · via DEV Community

Project Valhalla has been Java's most anticipated, slowest arriving feature for over a decade. On June 15, 2026, Oracle engineer Lois Foltan confirmed JEP 401 (Value Classes and Objects) is integrating into OpenJDK mainline, targeting a preview in JDK 28.

The scale is significant: 197,000 lines across 1,816 files. Oracle described it as the biggest change to Java's object model since the language's creation in 1995.

If you have heard "Valhalla" mentioned for years without anything shipping, this is the moment something concrete actually lands.

The problem it solves

In Java, everything except eight primitive types is a reference type. Write Point p = new Point(1, 2) and p is not a point, it is a pointer to an object on the heap. For a million-element array of Point objects, you get a million scattered pointers, each requiring a separate dereference.

Valhalla's goal, in Brian Goetz's words, is to let code "look like a class, work like an int."

How to try it

Early access builds are at jdk.java.net/valhalla.

javac --enable-preview --release 28 Point.java
java --enable-preview Point

A minimal value class:

value class Point {
    int x;
    int y;

    Point(int x, int y) {
        this.x = x;
        this.y = y;
    }
}

Or the same thing as a value record, usually the better choice for a pure data tuple:

value record Point(int x, int y) {}

The detail that will surprise you

Value classes can still be null.

Point p = null; // perfectly legal in JDK 28's value class model

"Value type" intuitively sounds like "works like a primitive, so no null," but that is a separate, later JEP. In this preview, value classes are still reference types under the hood. They have given up identity, not nullability.

The breaking change to audit for

java.lang.Integer and other wrapper classes are migrating to value classes under this preview. That means synchronized(someInteger) now throws an exception.

If you have code anywhere doing synchronized on wrapper types, a pattern most developers do not realize they rely on, this preview surfaces it immediately. Search your codebase before opting in.

What scalarization actually does

When the JIT can prove the concrete type at a call site, it breaks the value object into its constituent fields at the machine code level. Instead of passing a pointer to a Color, it passes three bytes plus a null flag directly. No allocation. Nothing for the garbage collector to track.

Heap flattening handles arrays: instead of pointers to scattered objects, the array stores the actual data inline and contiguously, with real field names and real validation.

What is NOT in JDK 28

  • Null restricted (non nullable) types, a separate JEP
  • Full specialized generics (List<int>)
  • 128 bit value encodings
  • Vector API, still in incubation

JDK 28 is also not an LTS release. The next LTS is expected to be JDK 29 in September 2027, and Goetz has called hoping for Valhalla to fully exit preview by then "optimistic."

Should you use it now?

It is a preview feature, disabled by default, and the syntax can still change. If you work on performance-critical Java fighting object overhead with hand-rolled primitive encodings, it is worth experimenting with now and reporting findings to valhalla-dev@openjdk.org. It is not yet something to migrate production code onto.

Full breakdown, including the value class vs record comparison table and the type category breakdown after JEP 401:

https://devencyclopedia.com/blog/project-valhalla-jdk-28-value-classes