<div dir="ltr"><div class="gmail_default" style="font-family:arial,helvetica,sans-serif">On the same token, maybe it's worth considering going farther, and making assertion status determination use a dynamic constant instead of a synthetic field?</div></div><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">On Wed, Jan 28, 2026 at 3:36 PM Eirik Bjørsnøs <<a href="mailto:eirbjo@gmail.com" target="_blank">eirbjo@gmail.com</a>> wrote:<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 dir="ltr"><br><div>Hi,</div><div><br></div><div>Since interfaces cannot have private fields, javac needs to generate a synthetic inner class to hold the $assertionsDisabled field.</div><div><br></div><div>A static initializer is also added to the interface, eagerly initializing the nested class, see the java.util.zip.Checksum for an example:</div><div><br></div><div><font face="monospace"> static {};<br> Code:<br> 0: getstatic #16 // Field java/util/zip/Checksum$1.$assertionsDisabled:Z<br> 3: ifeq 6<br> 6: return</font></div><div><font face="monospace"><br></font></div><div>What is the purpose of this eager initialization in Lower::assertFlagTest? I would presume a lazy initialization of the nested class on the first run of an assert would be sufficient?</div><div><br></div><div>In fact when I remove this eager initialization, assertions seem to load the nested class just fine with -esa enabled, but avoid loading the nested class with assertions disabled. </div><div><br></div><div>Asking because this would save class loading common scenarios where the default method is always overridden and thus the default method with the assert is never executed.</div><div><br></div><div>Can we load these nested synthetic classes lazily?</div><div><br></div><div>Cheers,</div><div>Eirik.</div></div>
</blockquote></div><div><br clear="all"></div><div><br></div><span class="gmail_signature_prefix">-- </span><br><div dir="ltr" class="gmail_signature"><div dir="ltr">- DML • he/him<br></div></div>