<!DOCTYPE html><html><head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
</head>
<body>
<font size="4" face="monospace">This line:<br>
<br>
> </font><strong style="background-color: rgb(208, 255, 208); font-weight: inherit; text-decoration: underline; color: rgb(0, 0, 0); font-family: "DejaVu Sans", "Bitstream Vera Sans", "Luxi Sans", Verdana, Arial, Helvetica, sans-serif; font-size: 13.3333px; font-style: normal; font-variant-ligatures: normal; font-variant-caps: normal; letter-spacing: normal; orphans: 2; text-align: start; text-indent: 0px; text-transform: none; widows: 2; word-spacing: 0px; -webkit-text-stroke-width: 0px; white-space: normal;">Each
method of a value class that has its<span> </span><code style="white-space: pre-wrap; font-family: "DejaVu Sans Mono", "Bitstream Vera Sans Mono", "Luxi Mono", "Courier New", monospace;">ACC_SYNCHRONIZED</code><span> </span>flag
set must also have its<span> </span><code style="white-space: pre-wrap; font-family: "DejaVu Sans Mono", "Bitstream Vera Sans Mono", "Luxi Mono", "Courier New", monospace;">ACC_STATIC</code><span> </span>flag
set.</strong><br>
<br>
makes me think we might want to take this further. The
ACC_SYNCHRONIZED bit was a design mistake; it makes for two ways to
do the same thing in the bytecode. We might consider simply not
allowing ACC_SYNC in value classes at all, and either (a) have the
compiler simulate the effect of a static sync method by wrapping the
body with a suitable sync block, or simply (b) disallowing sync
methods in value classes entirely. <br>
<br>
<br>
<div class="moz-cite-prefix">On 10/29/2024 11:59 PM, Dan Smith
wrote:<br>
</div>
<blockquote type="cite" cite="mid:8F7B3D31-0209-4AA4-BB21-7AE17D54CF2E@oracle.com">
<pre wrap="" class="moz-quote-pre">Here's a draft spec for JEP 401 that adds verification rules to ensure that strict instance fields are assigned to before a constructor calls 'super()':
<a class="moz-txt-link-freetext" href="https://cr.openjdk.org/~dlsmith/jep401/jep401-20241030/specs/value-objects-jvms.html">https://cr.openjdk.org/~dlsmith/jep401/jep401-20241030/specs/value-objects-jvms.html</a>
Briefly, this change includes:
- Enhancing the treatment of verification flags to support new kinds of flags
- Defining 'flagFieldUnset' flags for unset strict instance fields
- Enhancing StackMapTable to be able to express these flags
- Removing the flags in 'putfield'
- Ensuring the fields are removed in 'invokespecial'
I'd like to go over it at tomorrow's EG meeting. It's fresh, so I wouldn't be surprised if there are a few bugs! Hopefully it covers all the key new concepts.
</pre>
</blockquote>
<br>
</body>
</html>