<div dir="ltr"><div dir="ltr"><div dir="ltr"><div dir="ltr"><div dir="ltr"><div dir="ltr"><div dir="ltr"><div dir="ltr"><div dir="ltr"><div>I'd like to restart this discussion of <a href="https://bugs.openjdk.org/browse/JDK-8344159" target="_blank">JDK-8344159</a>  - "Add lint warnings for unnecessary warning suppression"</div></div><div dir="ltr"><div><br><div>Note, this is likely not destined for JDK 25. I'm bringing 
it up now simply because some refactoring that arose from the previous discussion back in November (which is <a href="https://mail.openjdk.org/pipermail/compiler-dev/2024-November/028573.html" target="_blank">here</a>) is now mostly done.<div><br></div><div>I think a fair summary of the current state is: Having the compiler emit warnings for unnecessary warning suppression is considered a useful idea in principle, but it's unclear what is the best way to configure/enable that functionality in the compiler.</div></div></div><div><br></div><div>In particular, there are subtle corner cases that could be problematic if these warnings were enabled by <span style="font-family:monospace">-Xlint:all</span>, especially for <span style="font-family:monospace">-Werror</span> builds.</div><div><br></div><div>Also complicating things, there are two different ways to suppress warnings, <span style="font-family:monospace">@SuppressWarnings("foo")</span> and <span style="font-family:monospace">-Xlint:-foo</span> and for similar "corner case" reasons they need to be configurable separately.</div><div><div><br></div><div>There is a <a href="https://bugs.openjdk.org/browse/JDK-8356043" target="_blank">draft </a><a href="https://bugs.openjdk.org/browse/JDK-8356043" target="_blank">CSR</a> that gives an overview of the current prototype, which proposes to add two new lint categories. If you are interested in this topic please review the CSR and its comments and let me know if you have any thoughts or suggestions - but I'm trying to move the design discussion to this mailing list so follow-up here please.</div><div><br></div><div>Here's a quick summary of my latest thinking...</div><div><br></div><div>There is value in defining lint categories for these warnings; the main problem is that including those categories in <span style="font-family:monospace">-Xlint:all</span> may be too aggressive - at least for now.</div><div><br></div><div>So I think we should simply exclude these new lint categories from <span style="font-family:monospace">-Xlint:all</span>. I'll note that <span style="font-family:monospace">-Xlint:all</span> and <span style="font-family:monospace">-Xlint</span> are synonyms, and the documentation for <span style="font-family:monospace">-Xlint</span> says "Enable recommended warning categories", so this is within the existing meaning of this flag.</div><div><br></div><div>In the future, if the <span style="font-family:monospace">suppression</span> warnings are deemed sufficiently advantageous, we could always add them to <span style="font-family:monospace">-Xlint:all</span>. Until if/when that happens, if you want to enable all lint categories including <span style="font-family:monospace">suppression</span> then you will have to add it explicitly via <span style="font-family:monospace">-Xlint:all,suppression</span>, etc.</div><div><br></div><div>Does this approach sound reasonable?</div><div><br></div><div>Thanks,</div><div>-Archie</div><div><div><br></div><span class="gmail_signature_prefix">-- </span><br><div dir="ltr" class="gmail_signature">Archie L. Cobbs<br></div></div></div></div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>