<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
</head>
<body style="word-wrap: break-word; -webkit-nbsp-mode: space; line-break: after-white-space;" class="">
<div>I think the root of the problem here is that CodeBuilder combines the “build my method” with stackmap generation, and if the latter fails, nothing is produced. And when stack map generation fails, you’d like to see a javap-like output so you can see what
you did wrong. </div>
<div><br class="">
</div>
<div>You can suppress stack map generation with an Option, and then you’ll get a classfile out, but that is probably a little hard to discover. </div>
<div><br class="">
</div>
<div>This is a more general problem, not just for stack maps; there are other things that can cause code generation to fail (e.g., forward branch to a label that is never defined; invalid labels in exception tables; etc.) The main vector we have for feeding
back information is the exception message, but putting the entire javap output of the method body in the exception message might be too much (but might not be, since any exception from building a classfile will trigger a round of debugging.)</div>
<div><br class="">
</div>
<div>Any thoughts on how you would like to see this information fed back?</div>
<div><br class="">
<blockquote type="cite" class="">
<div class="">
<div dir="ltr" class="">
<div class="">Is there a way to print out a trace of parts fed to CodeBuilder instances?</div>
<div class=""><br class="">
</div>
<div class="">Just this morning I had Classfile die on me because of a stack underflow,</div>
<div class="">and it was quite hard to find out which parts were missing from the Code</div>
<div class="">attribute. And that with a Code totalling just 5 instructions...</div>
<div class=""><br class="">
</div>
<div class="">If there would have been bytes output, then I could have inspected the</div>
<div class="">situation with javap. But if I mess up and pass inconsistent data to</div>
<div class="">CodeBuilder, causing it to throw instead of producing a byte array, then</div>
<div class="">I have an observability gap.</div>
<div class=""><br class="">
</div>
<div class="">-- mva</div>
<div class=""><br class="">
</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 lang="en-CZ" style="overflow-wrap: break-word;" class="">
<div class="gmail-m_8406389479489885327WordSection1"></div>
</div>
</blockquote>
</div>
</div>
</div>
</blockquote>
</div>
<br class="">
</body>
</html>