<div dir="ltr"><div dir="ltr">Am Fr., 19. Aug. 2022 um 07:58 Uhr schrieb Adam Sotona <<a href="mailto:adam.sotona@oracle.com">adam.sotona@oracle.com</a>>:<br></div><div class="gmail_quote"><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><div class="msg3267711331424491286">
<div lang="en-CZ" style="overflow-wrap: break-word;">
<div class="gmail-m_3267711331424491286WordSection1">
<p class="MsoNormal" style="margin-left:36pt"><span style="font-size:13.5pt;color:black">From: Michael van Acken <</span><a href="mailto:michael.van.acken@gmail.com" title="mailto:michael.van.acken@gmail.com" target="_blank"><span style="color:rgb(0,120,212)">michael.van.acken@gmail.com</span></a><span style="font-size:13.5pt;color:black">><u></u><u></u></span></p>
<p class="MsoNormal" style="margin-left:36pt"><u></u> <u></u></p>
<p class="MsoNormal" style="margin-left:36pt">I have a single use of CodeBuilder.labelToBci(): decide whether the labels marking</p>
<p class="MsoNormal" style="margin-left:36pt">the start and end of a try block refer to the same position, as a proxy for "enclosed<br>
region is empty". If this is the case, then no exceptionCatch can be installed and
<br>
all exception handlers become unreachable.<br>
<br>
How can this scenario still be supported?<br>
<br>
-- mva</p>
<p class="MsoNormal" style="margin-left:36pt"><u></u> <u></u></p>
<p class="MsoNormal"><span lang="EN-US">It is not guaranteed to get the right bytecode indexes from CodeBuilder::labelToBci, the method is really an exposure of internal implementation.<u></u><u></u></span></p>
<p class="MsoNormal"><span lang="EN-US">Frequent common cases (like for example dropping exception handler when try block is empty) can be solved with CodeBuilder::trying support.<u></u><u></u></span></p>
<p class="MsoNormal"><span lang="EN-US">CodeBuilder::trying uses CodeBuilder::block and before further actions asks CodeBuilder.BlockCodeBuilder::isEmpty.<u></u><u></u></span></p>
<p class="MsoNormal"><span lang="EN-US">Now it throws an exception in case of an empty try block, however I can imagine it might skip all handlers instead:</span></p></div></div></div></blockquote><div><br></div><div>This sounds interesting. Right now I am staying away from the higher level entry points,</div><div>because of their WIP implementation -- as I found out when I tried to use ifThenElse(). </div><div>`trying` doesn't seem to support finally right now.</div><div><br></div><div>Having access to a BlockCodeBuilder instance and its isEmpty would solve my</div><div>problem. Is this something that can be done from the public API?</div><div><br></div><div>-- mva</div><div><br></div><div><br></div><div><br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><div class="msg3267711331424491286"><div lang="en-CZ" style="overflow-wrap: break-word;"><div class="gmail-m_3267711331424491286WordSection1">
</div>
</div>
</div></blockquote></div></div>