<html><body><div style="font-family: arial, helvetica, sans-serif; font-size: 12pt; color: #000000"><div>This is an interesting case because i'm not sure the compiler should emit an error here.</div><div><br data-mce-bogus="1"></div><div>Currently the error occurs because as you said the call to super() is added after the call to throw.</div><div><br data-mce-bogus="1"></div><div>But throwing an exception in a constructor of an identity class is valid, and i do not see a reason why this behavior should not be the same in the case of a value class.</div><div><br data-mce-bogus="1"></div><div>regards,</div><div>Rémi</div><div><br></div><hr id="zwchr" data-marker="__DIVIDER__"><div data-marker="__HEADERS__"><blockquote style="border-left:2px solid #1010FF;margin-left:5px;padding-left:5px;color:#000;font-weight:normal;font-style:normal;text-decoration:none;font-family:Helvetica,Arial,sans-serif;font-size:12pt;"><b>From: </b>"David Alayachew" <davidalayachew@gmail.com><br><b>To: </b>"valhalla-dev" <valhalla-dev@openjdk.org><br><b>Sent: </b>Wednesday, October 29, 2025 5:30:23 AM<br><b>Subject: </b>Re: Compiler error message not clear for Valhalla EA 2<br></blockquote></div><div data-marker="__QUOTED_TEXT__"><blockquote style="border-left:2px solid #1010FF;margin-left:5px;padding-left:5px;color:#000;font-weight:normal;font-style:normal;text-decoration:none;font-family:Helvetica,Arial,sans-serif;font-size:12pt;"><div dir="ltr"><div style="font-family:monospace" class="gmail_default">The compiler error message goes away if I put a super(); as the first statement in the constructor. But still, that error message could be clearer.</div></div></blockquote><div><br></div><div><br data-mce-bogus="1"></div><div><div><br></div><div><br></div><hr id="zwchr" data-marker="__DIVIDER__"><div data-marker="__HEADERS__"><blockquote style="border-left: 2px solid #1010FF; margin-left: 5px; padding-left: 5px; color: #000; font-weight: normal; font-style: normal; text-decoration: none; font-family: Helvetica,Arial,sans-serif; font-size: 12pt;" data-mce-style="border-left: 2px solid #1010FF; margin-left: 5px; padding-left: 5px; color: #000; font-weight: normal; font-style: normal; text-decoration: none; font-family: Helvetica,Arial,sans-serif; font-size: 12pt;"><b>From: </b>"David Alayachew" <davidalayachew@gmail.com><br><b>To: </b>"valhalla-dev" <valhalla-dev@openjdk.org><br><b>Sent: </b>Wednesday, October 29, 2025 5:27:55 AM<br><b>Subject: </b>Compiler error message not clear for Valhalla EA 2<br></blockquote></div><div data-marker="__QUOTED_TEXT__"><blockquote style="border-left: 2px solid #1010FF; margin-left: 5px; padding-left: 5px; color: #000; font-weight: normal; font-style: normal; text-decoration: none; font-family: Helvetica,Arial,sans-serif; font-size: 12pt;" data-mce-style="border-left: 2px solid #1010FF; margin-left: 5px; padding-left: 5px; color: #000; font-weight: normal; font-style: normal; text-decoration: none; font-family: Helvetica,Arial,sans-serif; font-size: 12pt;"><div dir="ltr"><div class="gmail_default" style="font-family: monospace;" data-mce-style="font-family: monospace;">Hello <a class="gmail_plusreply" id="plusReplyChip-0" href="mailto:valhalla-dev@openjdk.org" target="_blank" rel="noopener" data-mce-href="mailto:valhalla-dev@openjdk.org" data-mce-tabindex="-1">@valhalla-dev</a>,</div><div class="gmail_default" style="font-family: monospace;" data-mce-style="font-family: monospace;"><br></div><div class="gmail_default" style="font-family: monospace;" data-mce-style="font-family: monospace;">While testing out the new Valhalla EA that came out a few days ago, I ran into the following compiler error.</div><div class="gmail_default" style="font-family: monospace;" data-mce-style="font-family: monospace;"><br></div><div class="gmail_default" style="font-family: monospace;" data-mce-style="font-family: monospace;">Here is a minified example.</div><div class="gmail_default" style="font-family: monospace;" data-mce-style="font-family: monospace;"><br></div><div class="gmail_default" style="font-family: monospace;" data-mce-style="font-family: monospace;">public value class abc<br>{<br><br> public abc()<br> {<br> throw new UnsupportedOperationException();<br> }<br><br> public static void someHelperMethod()<br> {}<br><br>}<br><br></div><div class="gmail_default" style="font-family: monospace;" data-mce-style="font-family: monospace;">And here is the compiler error message.</div><div class="gmail_default" style="font-family: monospace;" data-mce-style="font-family: monospace;"><br></div><div class="gmail_default" style="font-family: monospace;" data-mce-style="font-family: monospace;">$ java --enable-preview abc.java<br>abc.java:5: error: unreachable statement<br> {<br> ^<br>1 error<br>error: compilation failed<br><br></div><div class="gmail_default" style="font-family: monospace;" data-mce-style="font-family: monospace;"><br></div><div class="gmail_default" style="font-family: monospace;" data-mce-style="font-family: monospace;">That location is the opening curly brace of the constructor.</div><div class="gmail_default" style="font-family: monospace;" data-mce-style="font-family: monospace;"><br></div><div class="gmail_default" style="font-family: monospace;" data-mce-style="font-family: monospace;">Can we have a more clear error message?</div><div class="gmail_default" style="font-family: monospace;" data-mce-style="font-family: monospace;"><br></div><div class="gmail_default" style="font-family: monospace;" data-mce-style="font-family: monospace;">Thank you for your time and consideration.</div><div class="gmail_default" style="font-family: monospace;" data-mce-style="font-family: monospace;">David Alayachew</div></div><br></blockquote></div></div></div></div></body></html>