<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=us-ascii">
<style type="text/css" style="display:none;"> P {margin-top:0;margin-bottom:0;} </style>
</head>
<body dir="ltr">
<div style="font-family: "Calibri Light", "Helvetica Light", sans-serif; font-size: 12pt; color: rgb(0, 0, 0);" class="elementToProof">
I don't think flattening or scalarization is required by the specs for any JVM implementation. The reference implementation may be able to support such inlining in the future, but it definitely requires all classes in this hierarchy are described in the LoadableDescriptors
 attribute.</div>
<div id="appendonsend"></div>
<hr style="display:inline-block;width:98%" tabindex="-1">
<div id="divRplyFwdMsg" dir="ltr"><font face="Calibri, sans-serif" style="font-size:11pt" color="#000000"><b>From:</b> valhalla-spec-observers <valhalla-spec-observers-retn@openjdk.org> on behalf of Ben <benharless820@gmail.com><br>
<b>Sent:</b> Thursday, November 13, 2025 12:27 PM<br>
<b>To:</b> valhalla-spec-observers@openjdk.org <valhalla-spec-observers@openjdk.org><br>
<b>Subject:</b> Tagged Unions in valhalla</font>
<div> </div>
</div>
<div>
<div dir="ltr">
<div>Hello,</div>
<div><br>
</div>
<div>I've been looking for information on how tagged unions will pan out in valhalla.</div>
<div><br>
</div>
<div>A tagged union in java would be something like</div>
<div><br>
</div>
<div>```</div>
<div>public sealed abstract value class Shape permits Circle, Square {}</div>
<div><br>
</div>
<div>public value class Circle extends Shape {</div>
<div>  public float radius;</div>
<div>}</div>
<div><br>
</div>
<div>public value class Square extends Shape {</div>
<div>  public float side;</div>
<div>}</div>
<div>```</div>
<div>(adapted from <a href="https://docs.oracle.com/en/java/javase/17/language/sealed-classes-and-interfaces.html">https://docs.oracle.com/en/java/javase/17/language/sealed-classes-and-interfaces.html</a>)</div>
<div><br>
</div>
<div>From what I know currently, this wouldn't end up being scalarized or flattened, even though the JVM runtime knows that only Circle and Square can extend Shape.</div>
<div>Is there a future where these do end up getting flattened or scalarized? </div>
</div>
</div>
</body>
</html>